Characteristics:
Support OICQ Avatar, automatic pagination, display message person ip,email legality verification, convenient and safe message management,
Without complex functions, beginners are easy to read.
program Example: http://medguider.51.net/notebook/
Full program download (including picture) Http://medguider.51.net/download/notebook.zip
List of programs:
config.php configuration file mysql.txt database file index.php Show message main program addnote.php add message delnote.php Delete message
Mysql.txt
CREATE table notebook (name char (6), email varchar (+), time char (+), face char (2), IP varchar (+), title varchar (255), Nnote text);
Guestbook name Name email time face Avatar IP title title nnote content
config.php
Change this to your own database user name and password
$db = mysql_connect ("localhost", "root");
mysql_select_db ("Test", $db);
Change this to your own admin username and password
$username = "Demo";
$password = "Demo";
?>
index.php
<title>Guestbooks</title>
Include ("config.php");
$result = mysql_query ("Select * from Notebook", $db);
$row =mysql_num_rows ($result);//View how many rows the query results
$max = $row; Total posts
Set to show 10 per page, can be set by itself, $p the total number of pages, $page the first few pages, $low read from the first few lines, $x read a few lines
if (! $page) {$page = 1;} $page Default value is 1
$p =ceil ($max/10);//maximum number of pages $MAX/10
$low =10* ($page-1);
if ($page = = $p && ($max%10) <>0) {$x = ($max%10);} else {$x = 10;} If it is the last page and is not an integer multiple of 10, read the remainder of $max divided by 10, otherwise take 10
if ($max ==0) {$x = 0;} If there is no post, $x take 0
$result = mysql_query ("SELECT * from Notebook order by time DESC limit $low, $x", $db);//query in descending order of the Post's time
?>
Home > Guestbook |
echo "Total posts:", $max, "first"; for ($n =1; $n <= $p; $n + +) { echo "$n"; } echo "Page"; ?>
|
|
Message Management |
for ($i =0; $i <= ($x-1); $i + +) { $name =mysql_result ($result, $i, ' name '); $email =mysql_result ($result, $i, ' email '); $face =mysql_result ($result, $i, ' face '); $face = ' Image/face/icon '. $face; User picture $time =mysql_result ($result, $i, ' time '); $ip =mysql_result ($result, $i, ' IP '); $title =mysql_result ($result, $i, ' title '); $nnote =mysql_result ($result, $i, ' nnote '); echo "
"; echo "
| "; echo "
Message Person: $name | "; echo "
Posted in: $time | "; echo "
| "; echo "
$ip |
"; echo "
Title: $title |
"; echo "
Message content: $nnote |
"; } Mysql_close ($DB); ?> |
http://www.bkjia.com/PHPjc/316261.html www.bkjia.com true http://www.bkjia.com/PHPjc/316261.html techarticle Features: Support OICQ avatar, automatic pagination, display message ip,email legality verification, convenient and safe message management, no complex functions, beginners are also easy to read. Example program: ...