Home >Backend Development >PHP Tutorial >Cookie Usage_PHP Tutorial
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