Jquery+php realizes simple front-back and back-table data Interactive Implementation Registration login, add message function

Source: Internet
Author: User
Tags date1 explode

Page styles apply the bootstrap framework.

First look at the login page (login page for account login, you can also jump to the Registration Account page):

<! DOCTYPE html>

Registered account's front page:

<! DOCTYPE html>

Background processing code for registered account:

<?phpheader ("Content-type:text/html;charset=utf-8");//received foreground data $str=$_post["FormData"];list ($userName, $pwd, $ REPWD) =explode ("&", $str), if (strlen ($userName) >9&&strlen ($pwd) >4&& $rePwd = = $pwd) {echo " True "; $str. =" [;] ";
For convenience, the registration information is stored in a use.txt file, there is no related operation of the database, and the way in which the data is stored is so file_put_contents ("User.txt", $str, File_append);} Else{echo "false";}

Background processing code for login account:

<?phpheader ("Content-type:text/html;charset=utf-8"), $str = $_post["FormData"];list ($userName, $pwd) = Explode (" & ", $str); $users = file_get_contents (" User.txt "), $USERARR = explode (" [;] ", $users); foreach ($userArr as $user) {list ($realName, $realPwd) = Explode ("&", $user), if ($userName = = $realName && $pwd = = $realPwd) {echo "true";d ie ();}} echo "false";

Home page after successful login:

<! DOCTYPE html>

Add a comment to the background processing code:

<?phpheader ("Content-type:text/html;charset=utf-8"); $userName = $_post["UserName"]; $time = $_post["Time"];$ Noteval = $_post["Noteval"];//the information obtained by the foreground is stored as an associative array $arr = ["userName" + = $userName, "Time" = $time, "Noteval" =>$ noteval];//Save the array as a JSON object {"UserName": $userName, "Time": $time, "Noteval": $noteVal} $str = Json_encode ($arr);//Will $ STR is deposited in the Note.txt file $num = file_put_contents ("Note.txt", $str. " [;] ", file_append); if ($num >0) {echo" true ";} Else{echo "false";}

To display the message content to the foreground page of the background processing code:

<?phpheader ("Content-type:text/html;charset=utf-8");//Get the contents of the file in the Echo file_get_contents ("Note.txt");

  

Jquery+php realizes simple front-back and back-table data Interactive Implementation Registration login, add message function

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.