Home  >  Article  >  Backend Development  >  Cookie Usage_PHP Tutorial

Cookie Usage_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 16:58:45980browse

Cookie Usage Today we will take a look at the php cookie usage and give a simple example to illustrate. I don’t think most people will understand the cookie. It just saves a cookie file on the client. Use a browser to read it, so I won’t say much else. If you want to know more, please go to www.111cn.cn.

$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 the original reprint on this site

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631374.htmlTechArticleCookie Usage Today we will take a look at php cookie usage and give a simple example to illustrate. Cookie I don’t want to Most people will understand that it just saves a cookie file on the client...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn