Examples of cookie manipulation in PHP _php tutorial

Source: Internet
Author: User

Examples of cookie manipulation in PHP


Made an instance of a cookie operation, the first file login_frm. PHP This is the login window.

Code 1

2

3

4

5

6

10

11

The second file login.php This is the process login

1

2 if ($_post[' username ') = ' admin ')

3 {

4 Setcookie (' haha ', ' Gogo ');

5 Header ("location:index.php");

6}

7?>

Third file index.php look at the effect again

1

2 if ($_cookie[' haha ') = = ' GoGoGo ')

3 {

4

5 echo $_cookie[' haha ';

6 echo ' You set a cookie ';

7}

8 Else

9 {

"You did not set a cookie";

11}

?>

http://www.bkjia.com/PHPjc/847198.html www.bkjia.com true http://www.bkjia.com/PHPjc/847198.html techarticle The cookie operation instance in PHP makes an instance of a cookie operation, the first file login_frm. PHP This is the login window. Code 1 2 3 4 5 6 10 11 second file login.php This is processing login ...

  • Related Article

    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.