Support OICQ Avatar's Guestbook Two

Source: Internet
Author: User
addnote.php



<title>Add message</title>











Include ("config.php");
if ($submit) {
$time =date ("Y year m D-day h:i:s A");
$IP = $REMOTE _addr;//message IP address
$name =trim ($name);
$email =trim ($email);
$title =strip_tags ($top);
$nnote =nl2br (Strip_tags ($content));//Remove the HTML tag first, and then turn the newline character

if (! $name | |! $email | |! $title | |! $nnote) {//check if complete
echo "Sorry, you must fill in all the contents!"
"." Return ";
Exit }elseif (!ereg (' ^[-!#$%& ' *+./0-9=? A-z^_ ' a-z{|} ~]+'.' @'.' [-!#$%& ' *+\/0-9=? A-z^_ ' a-z{|} ~]+.'.' [-!#$%& ' *+\./0-9=? A-z^_ ' a-z{|} ~]+$ ', $email)//email legitimacy Verification
){
echo "Email is not legal!
"." Return ";
Exit
}
Write to Database
$sql = "INSERT into notebook (name,email,time,face,ip,title,nnote) VALUES (' $name ', ' $email ', ' $time ', ' $face ', ' $ip ', ' $ Title ', ' $nnote ') ";
$result = mysql_query ($sql, $db);
Mysql_close ($DB);
echo "The message was successful! ";
}
?>








Home
> Guestbook
> Add Message
View Message



"Class=" > "White12"




delnote.php
Include ("config.php");
if ($superadmin) {//If the administrator has logged in, password verification
if (! ( $user = = $username) | |! ($PSW = = $password)) {
echo "Password Error";
Exit
}
}else{//Admin Login
echo "";
Exit
}
if ($del ==1) {//Determine if you want to delete
mysql_query ("Delete from notebook where time= ' $time '", $db); Take message time as deletion mark
echo "deleted successfully! ";
}
?>



<title>Delete message</title>



$result = mysql_query ("Select * from Notebook", $db);
$row =mysql_num_rows ($result);//See how many rows the result is
$max = $row; Total posts
Set per page 10 articles, $p total pages, $page page, $low read from the first few lines, $x read a few lines
if (! $page) {$page = 1;}
$p =ceil ($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 * Notebook order by Time DESC limit $low, $x", $db);
?>



















Home
> Guestbook

echo "Total posts:", $max, "first";
for ($n =1; $n <= $p; $n + +) {
echo "$n";
}
echo "Page";
?>
View Message

for ($i =0; $i <= ($x-1); $i + +) {
$email =mysql_result ($result, $i, ' email ');
$face =mysql_result ($result, $i, ' face ');
$face = ' Image/face/icon '. $face;
$name =mysql_result ($result, $i, ' name ');
$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);
?>



The above describes the support Oicq Avatar two, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

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