Why is the value transmitted by session null? Member_login_do.php & lt; html & gt; & lt ;? Php & nbsp;/* & nbsp; Member Login processing page & nbsp; */& nbsp; require_once (".. why does/conn/Co use session to pass the value blank?
Member_login_do.php
/* Member Login processing page */
Require_once ("../conn/Conn_DB.php"); // contains the database link file
If ($ _ POST ["txt_username"]! = "" & $ _ POST ["txt_pwd"]! = "")
{
$ Name = $ _ POST ["txt_username"]; // Obtain the submitted user name
$ Pwd = $ _ POST ["txt_pwd"]; // Obtain the submitted password
$ Str = "select * from Member_Info where M_Name = '$ name' and M_Password =' $ pwd'"; // query statement
$ Result = mysql_query ($ str); // execute an SQL statement
If (mysql_num_rows ($ result)> 0) // view the number of returned query results
{
Session_id (SID );
Session_start (); // login successful, set the SESSION value
$ _ SESSION ['member'] = $ _ POST ['txt _ username'];
// Session_write_close ();
Echo "script window. location. href = '../member_info.php'; script";
// Exit (0 );
}
Else
{
Echo "script alert ('user name or password is incorrect! '); Window. location. href =' ../member_login.php 'script ";
}
}
Else
{
Echo "script" alert ('Enter your username and password! '); Window. location. href =' ../member_login.php 'script ";
}
?>
Session MySQL php shared:
------ Solution --------------------
Session_member_check.php
Do you not need start?
------ Solution --------------------
Each program requires session_start (); you cannot do it only in member_login_do.php.
SID has a value only after session_start ().
------ Solution --------------------
Injection
------ Solution --------------------
If (mysql_num_rows ($ result)> 0) // view the number of returned query results
{
Exit; // is it here?
..................
First, you need to know whether to jump to the member_login.php file in member_info.php or before.
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