Support for oicq headers (2)

Source: Internet
Author: User
Support for oicq headers (2) addnote. php



Add message











Include ("config. php ");
If ($ submit ){
$ Time = date ("Y, m, d, H: I: s ");
$ Ip = $ REMOTE_ADDR; // The ip address of the contact.
$ Name = trim ($ name );
$ Email = trim ($ email );
$ Title = strip_tags ($ top );
$ Nnote = nl2br (strip_tags ($ content); // remove the html tag and convert the linefeed
.
If (! $ Name |! $ Email |! $ Title |! $ Nnote) {// check whether it is complete
Echo "Sorry, you must fill in all content!
"." Back ";
Exit;} elseif (! Ereg ('^ [-! # $ % & '* +./0-9 =? A-Z ^ _ 'a-z {|} ~] + '.'@'.'[-! # $ % & '* + \/0-9 =? A-Z ^ _ 'a-z {|} ~] + .'.'[-! # $ % & '* + \./0-9 =? A-Z ^ _ 'a-z {|} ~] + $ ', $ Email) // verify email validity
){
Echo "email is invalid!
"." Back ";
Exit;
}
// Write data to the 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 "message successful! ";
}
?>








Homepage
> Message book
> Add a message
View messages



"Class =" white12 ">




Delnote. php
Include ("config. php ");
If ($ superadmin) {// if you have logged on as an administrator, verify the password.
If (! ($ User = $ username) |! ($ Psw = $ password )){
Echo "incorrect password ";
Exit;
}
} Else {// administrator login
Echo "";
Exit;
}
If ($ del = 1) {// determine whether to delete
Mysql_query ("delete from notebook where time = '$ time'", $ db); // use the message time as the delete flag
Echo "deleted successfully! ";
}
?>



Delete message



$ Result = mysql_query ("SELECT * FROM notebook", $ db );
$ Row = mysql_num_rows ($ result); // Check the number of rows in the result.
$ Max = $ row; // total number of posts
// Set 10 entries per page, total number of pages of $ p, number of pages of $ page, starting with the row where $ low reads, and number of rows read by $ x
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 the last page 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, set $ x to 0.
$ Result = mysql_query ("select * from notebook order by time DESC limit $ low, $ x", $ db );
?>



















Homepage
> Message book

Echo "total number of posts:", $ max, "no ";
For ($ n = 1; $ n <= $ p; $ n ++ ){
Echo "$ n ";
}
Echo "page ";
?>
View messages

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, 'note ');
Echo"






";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo"
Contact: $ namePosted at: $ time$ Ip
Title: $ title
Message content: $ nnote
";
}
Mysql_close ($ db );
?>


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.