PHP Member Login code, verification through, jump page can not get the value of cookies

Source: Internet
Author: User
PHP Member Login code, verification through, jump page after the value of the cookie can not be obtained.
Tracking code, user login verification through, and then jump to the first page, in the first page and there is a code to verify whether the user is logged in (the cookie has the user name), the result cookie has been empty, the local test is normal. The server is IIS, and the locally tested server is Apache.
The relevant code is as follows:

PHP Code
  
  ...... Slightly


index.php page Code:
PHP Code
  
   
  
   ...... Slightly


This is the code for the checklogin.php page:
PHP Code
  
   
  
   


The site does not have cross-domain issues and is under the same site.


------Solution--------------------
PHP code
setcookie ("House_havelogin", "true", Time () + 36000);             Setcookie ("House_username", $row [' House_username '], time () + 36000);p rint_r ($_cookie);                       Header ("Location:index.php"); echo ""; 
------Solution--------------------
Above if you do not judge the direct Print_f ($_cookie), see what results or use the Firecookie plugin to see if the COOKIE has no value
----- -Solution--------------------
1 Comment out header ("Location:index.php");
2 in header ("Location:index.php"), add Print_r ($row) below, confirm that there is user information
3 add echo $_cookie[' House_ in index.php Username ']; Verify that the cookie has a value

PHP.ini need to set
Output_buffering = on

The program itself still has problems, if the login is OK, So anyone who can write a username and password will be able to log in.
recommends querying SQL Plus username and password 2 fields for query
  • 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.