Php+dbfile Development of Small message book

Source: Internet
Author: User
Board.php is used to store data, you can add a message record in it first.

Code
<?php$board=array (Array (1081410332, ' Test ', ' Test message book ', ' http://www.piscdong.com '));? >

index.php is the message display and submission page.

Code
<?phprequire_once (' board.php '); function HTMLEncode ($content) {$content =htmlspecialchars ($content); $content = Preg_replace ("/\r/i", "<br/>", $content); return $content;} if ($HTTP _server_vars[' request_method ']== ' POST ') {$configpath _parts1 = pathinfo ($SCRIPT _filename); $time =time (); Name= $HTTP _post_vars[' name '; $url = (Preg_match ("/^[\\w-]+ \\.[ \\w-]+) *@[\\w-]+ (\\.[ \\w-]+) +$/i ", $HTTP _post_vars[' url ') | | $HTTP _post_vars[' url ']== ')? $HTTP _post_vars[' url ': ' http://'. Htmlspecialchars (Preg_replace ("/https?\:\/\//i", ' ', $HTTP _post_vars[' url ']), ent_quotes); $info =htmlencode ($HTTP _post_vars[' info '); if ($name!= ' && $info!= ' ') {$Board []=array ($time, $name, $info, $url);} for ($i =0; $i <count ($Board); $i + +) {$bd =current ($Board); $s []=] \tarray (". $BD [0].", ' ". $BD [1]. $BD [2]. BD[3]. "')"; Next ($Board); $content = "<?php\n\ $Board =array (\ n". Join ($s, ", \ n"). " \ n);\n?> "; $filename = $configpath _parts1[' dirname ']. ' /'.' Board.php '; if (is_writable ($filename) | | |!file_exists ($filename)) {if (! $handle =fopen ($FileName, ' W ')) {return false;} if (!fwrite ($handle, $content)) {return false;} Fclose ($handle); Else{return false; Header (' Location:. ');} else{?><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><ptml xmlns=" http://www.w3.org/1999/xhtml "><pead><title> message book </title><meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/></pead><body><form method=" Post "Name=" Form1 "action=" "><table border=" 0 " cellspacing= "5" cellpadding= "0" align= "center" ><tr><td><div style= "overflow:auto;height:250px; border:1px dotted #999999;p adding:5px;word-wrap:break-word;width:400px; " ><?php End ($Board), for ($i =0; $i <count ($Board); $i + +) {$bd =current ($Board); $s []= ' <strong>]. ( $BD [3]!= '] <a href= "':". (Preg_match ("/^[\\w-]+ \\.[ \\w-]+) *@[\\w-]+ (\\.[ \\w-]+) +$/i ", $BD [3])? ' mailto: ': '). $BD [3]. (($bd [3]!= ' &&!preg_match ("/^[\\w-]+") (\\.[ \\w-]+) *@[\\w-]+ (\\.[ \\w-]+) +$/i ", $BD [3]))? ' target= ' _blank ': '. ($BD [3]!= '] > ': '). $BD [1]. ($BD [3]!= '] </a> ': ':</strong> '. $BD [2]. ' <br/><em>-'. Date ("G:i, M J, Y", $BD [0]). ' </em> ';p rev ($Board);} echo join ($s, ' <br/><br/> ');? &GT;&LT;/DIV&GT;&LT;/TD&GT;&LT;/TR&GT;&LT;TR&GT;&LT;TD align= "Center" > Name: <input type= "text" name= "name"/ > Url/email:<input type= "text" name= "URL"/><br/><textarea name= "info" cols= "" rows= "8" ></ Textarea><br/><input type= "Submit" value= "release"/></td></tr></table></form> </body></ptml><?php}?>

config.php is stored in the management of the message of the password, put the password in a separate file for easy modification.

Code
<?php $password = ' 123456 ';?>


admin.php is the admin page, the function is very simple, can only delete the message. When you delete, you need to enter the admin password and the admin password is stored in the config.php.

Code
<?phprequire_once (' board.php '); require_once (' config.php '); if (Isset ($HTTP _post_vars[' id ')) && $HTTP _ post_vars[' id ']!= ' && addslashes ($HTTP _post_vars[' password ') = = $password) {if (count ($Board) >1) {unset ( $Board [Intval ($HTTP _post_vars[' id]]); for ($i =0; $i <count ($Board); $i + +) {$bd =current ($Board); $s []=] \tarray (". $BD [0]. " <p> This news total <font color=red><b>2</font></b> page <a href=185938.html>1</a> <a href=185938-2.html>2</a> Next Page </TD></TR></TBODY></TABLE></DIV>< TABLE class=pagespacenewsseparator cellspacing=0 cellpadding=1 width= "100%" border=0><tbody><tr>< TD width= "71%" Height=24><a href=/sendmail.asp?filename=185938 target=_blank class=a01> recommended Friends </a> < SPAN class=pageicon>| <a href=/member/add_favorite.asp?filename=185938 Target=_blank class=a01> Channel Collection </a> | <a class=a01 onclick=javascript:doprint () href= "" > Print Documents </A> | <a href=/senderror.asp?filename=185938 target=_blank class=a01> Report error </a> &LT;/SPAN&GT;&LT;/TD&GT;&LT;TD align= Right width= "29%" > <a href= "javascript:window.close ()" ></a><a href=" http://www.channel7.cn/admin/ Templet_textbox.asp?action=modify&id=3#top "></a></td></tr></tbody></table> <table height=117 cellspacing=2 cellpadding=0 width= "100%" Border=0><tbody><tr><td class= Titlenewsremark id=fontzoom valign=top width= "56%" height=40><table cellspacing=0 "cellPadding=5 width=" 100% " BORDER=0&GT;&LT;TBODY&GT;&LT;TR&GT;&LT;TD class=titlelistnews><strong> Related Connections </STRONG></TD> </tr><tr><td> <a href= http://www.channel7.cn/2005/1-1/18847.html target=_blank&gtUsing PHP to call the database storage process </a><br> <a href= http://www.channel7.cn/2004/12-31/11570.html target=_blank> PHP injection 2</a><br> <a href= http://www.channel7.cn/2004/12-31/115612.html target=_blank>php injection!</ a><br> <a href= http://www.channel7.cn/2004/12-30/175521.html target=_blank>php upload, manage photo samples </a> <br> <a href= http://www.channel7.cn/2004/12-30/175141.html target=_blank>php full-text Search in Text station &LT;/A&GT;&LT;BR > <a href= http://www.channel7.cn/2004/12-30/17482.html target=_blank> Comprehensive review "Disable browser back button" </a><br Java extensions in the > <a href= http://www.channel7.cn/2004/12-30/174713.html target=_blank>php </a><br> <a href= http://www.channel7.cn/2004/12-24/1266.html Target=_blank>php-push technology to realize refresh function </a><br>< /td></tr></tbody></table><!--content start--><!--content end--></td>< TD class=titlenewsremark id=fontzoom valign=top width= "44%" ><table cellspacing=0 cellPadding=5 WidtH= "100%" BORDER=0&GT;&LT;TBODY&GT;&LT;TR&GT;&LT;TD class=titlelistnews><strong> the same topic </strong></ td></tr><tr><td> No Related Topics </td></tr></tbody></table></td></ Tr></tbody></table><table class=titlenewsremark cellspacing=0 cellPadding=1 width= "100%" border=0 &GT;&LT;TBODY&GT;&LT;TR&GT;&LT;TD class=pagespacenewsseparator width= "56%" Height=26><span class=style1> <font color= #ff6347 > <STRONG> Comments </strong></font></span></td><td align= Left width= "44%" Rowspan=2><span class=titlenewsremark><font color= #f26c4f > Copyright Notice:</font> In addition to some special notices do not reprint, or authorize me to stand exclusive broadcast articles, we can freely reprint the original article of my site, but the original author and the link from my station must be retained (not I stand original, in accordance with the original from a section, the link). The article copyright belongs to my station and the author altogether <br><font color= #f26c4f > Reprint </font></span><span style= "Background-color: # F9f9f9 "#invalid_attr_id =" 16px "><font color= #f26c4f > Requirements </font></span><span class= Titlenewsremark><font color= #f26c4f>:</font> reproduced in the pictures, documents, links please do not hotlinking to the site, and do not play the watermark on their respective sites, also can not erase my site watermark. &LT;/SPAN&GT;&LT;/TD&GT;&LT;/TR&GT;&LT;TR&GT;&LT;TD Height=118><span Class=style2><form Method=post Action=http://www.channel7.cn/add_review.asp><input Type=hidden name=filename value=185938> shared Comments <font Color=red><script Src=http://www.channel7.cn/reviewcount.asp?filename=185938></script></font > Article <a href=185938.asp> View comments </a><br> Name: <input type=text name=name><input Type=submit Name=submit value= Comments ><br><textarea name=content cols=30 rows=4 title= do not support HTML, support UBB code >



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.