Cookie usage _ PHP Tutorial

Source: Internet
Author: User
Cookie usage. Cookie usage today, let's take a look at phpcookie usage and give a simple example to illustrate it. I don't want to say that most of them will understand it. it just saves a cookie file on the client. Cookie usage today let's take a look at php cookie usage and give a simple example to illustrate. I don't know much about cookies. it only saves a cookie file on the client and reads it using a browser, well, I won't say much about others. please go to www.111cn.cn for more information.

$ Value = $ _ SERVER ['http _ host'];
Echo $ value;
If (empty ($ _ COOKIE ["cook"]) {
Setcookie ("cook", $ value, time () + 1800 ,"/");
If (sizeof ($ _ POST) <8) {echo 'BB ';}
For ($ I = 1; $ I <= 8; $ I ++ ){
$ C = $ _ POST ['R'. $ I];
Switch (intval ($ c )){
Case 0:
$ Word = 'vote _ r1 ';
Break;
Case 1:
$ Word = 'vote _ R2 ';
Break;
Case 2:
$ Word = 'vote _ r3 ';
Break;
Default:
Exit ('error ');
}
$ SQL = "update gx_votes set $ word = $ word + 1 where id = $ I ";
Mysql_query ($ SQL) or die (mysql_error ());
}
Echo 'OS ';
} Else {
Print '00 ';
}

Note: Please indicate www.111cn.cn for original reprinted on this site

Today, let's take a look at the usage of php cookies and give a simple example to illustrate them. I don't want to say much about cookies. it only saves a cookie file on the client...

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.