Urgent session problems

Source: Internet
Author: User
Urgent! Sessionquestion rewriterule {index.html & amp; fun = 000 $ & nbsp; gyjw/check. php overwrites the url my login page & lt ;? Phpsession_start (); // use session to store user information if (isset ($ _ POST ["u urgent! Session problems
RewriteRule into index.html & fun = 000 $ gyjw/check. php rewrite the url
My login page
 Session_start (); // use session to store user information

If (isset ($ _ POST ["username"])
{
$ Ss_user_id = "";

// Use the User-tired IsValid () method to determine whether the entered User name and password are correct
Require_once ("user/UserClass. php ");
$ User = new User ();
// If it is correct, go to the system homepage
If ($ user-> IsValid ($ _ POST ["username"], $ _ POST ["password"], $ ss_user_id ))
{
$ _ SESSION ["ss_user_id"] = $ ss_user_id;
Echo" ";
Echo "location='index.html ';";
Echo "script";
}
// If not, go to the login page
Else
{
Echo" ";
Echo "alert ('incorrect user name or password ');";
Echo "script";
}
}

?>
Home page php
 Include 'http: // localhost/gyjw/index.html & fun = 000 ';
?>
// Omit the html part
Check. php
 If (! Isset ($ _ SESSION ['SS _ user_id '])
{
Echo" ";
Echo "alert ('your user does not have permission to perform this operation! ');";
Echo "top.location+'login.html ';";
Echo "script";
Exit;
}
?>
The problem is that when you log on to the home page, you first jump to check. php, which directly shows that 'your users are not authorized to perform this operation! ', Indicating that $ _ SESSION ['SS _ user_id'] does not exist. Then, if you modify the php
 include ("check.php");
?>
The $ _ SESSION ['SS _ user_id '] normally displays the homepage content.
Please help us! Session url php shared:
------ Solution --------------------
Check. php missing session_start ();

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.