Tutorial on cookie operations in php _ PHP

Source: Internet
Author: User
Cookie operation instance in php. In php, the cookie operation instance performs a cookie operation. The first file login_frm.PHP is the logon window. Code 1234561011: the second file login. php is used to process the cookie operation instance for logging on to php.

The first file login_frm.PHP is the logon window.

Code 1

2

3

4

5

6

10

11

The second file login. php is used to process the login

1

2 if ($ _ POST ['username'] = 'admin ')

3 {

4 setcookie ('haha', 'gogogo ');

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

6}

7?>

The third file index. php looks at the effect again.

1

2 if ($ _ COOKIE ['hahaha'] = 'gogogogo ')

3 {

4

5 echo $ _ COOKIE ['hahaha'];

6 echo 'cookie set ';

7}

8 else

9 {

10 echo 'You have not set cookies ';

11}

12?>

The worker performs a cookie operation on the instance. The first file login_frm.PHP is the logon window. Code 1 2 3 4 5 6 10 11 second file login. php this is processing login...

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.