Support Oicq Avatar's Guestbook (a) _php tutorial

Source: Internet
Author: User
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 " "; echo " "; echo " "; echo " "; echo " "; echo "
Message Person: $namePosted in: $time$ip
Title: $title
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: ...

  • 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.