Yesterday, JavaScript can still be called. Today, it suddenly cannot be called. how can this problem be solved?

Source: Internet
Author: User
Yesterday, JS was able to call. Today, it suddenly cannot be called. <;? Phpinclude (yanzhengma. php); require_once (common. php); & nbsp; introduce public files, which implement the SQL Injection Vulnerability Check Code $ username & nbsp; trim ($ _ POST [username]); yesterday, JavaScript can still be called. Today, it suddenly cannot be called.
// Include ('yanzhengma. php ');
// Require_once ('Common. php'); // introduces a public file, which implements the SQL Injection Vulnerability Check Code
$ Username = trim ($ _ POST ['username']);

// Echo $ username;
// Obtain the password submitted by the client and use the md5 () function for subsequent verification.
$ Pwd = md5 ($ _ POST ['pwd']);


// Set an error message variable to determine whether an error has occurred.
// And display the error message on the client. The initial value is null.
$ Errmsg = '';
If (! Empty ($ username) {// the user enters the data to perform database operations
//---------------------
// Data verification. the empty () function determines whether the variable content is empty.
If (empty ($ username )){
$ Errmsg = 'incomplete data input ';
}
//---------------------
If (empty ($ errmsg) {// $ if errmsg is null, the verification is successful.
// Call the mysqli constructor to establish a connection and select the database 'test'
$ Db = @ new mysqli ("localhost", "root", "", "test ");
// Check the database connection
If (mysqli_connect_errno ()){
$ Errmsg = "database connection failed! \ N ";
}
Else {
// Query the database to check whether the user name and password are correct
$ SQL = "SELECT * FROM t_user WHERE f_username = '$ username' AND f_password =' $ pwd '";
$ Rs = $ db-> query ($ SQL );
// $ Rs-> num_rows checks whether the preceding execution results contain records. if there are records, the logon is successful.
If ($ rs & $ rs-> num_rows> 0 ){
// You can use the redirection function mentioned above to go to the home page
$ Errmsg = "logon successful! ";
}
Else {
$ Errmsg = "the user name or password is incorrect. logon failed! ";
}

// Close the database connection
$ Db-> close ();
}
}
}
If ($ rs & $ rs-> num_rows> 0 ){
// Use session to save the current user
Session_start ();
$ _ SESSION ['uid'] = $ username;

// You can use the redirection function mentioned above to go to the home page

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.