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 "
Message Person: $name | "; echo "
Posted in: $time | "; echo "
| "; echo "
$ip |
"; echo "
Title: $title |
"; echo "
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.