Home  >  Article  >  Backend Development  >  Cookies must be enabled to log in. PHP uses cookies to implement visit statistics code.

Cookies must be enabled to log in. PHP uses cookies to implement visit statistics code.

WBOY
WBOYOriginal
2016-07-29 08:45:111096browse

[/code]
global $count;
$count=1;
if(!isset($_COOKIE["visittime"])){ setcookie("visittime",date("y-m-d H:i: s"));
setcookie("visitcount",1); echo "Welcome to your first visit to the website!";
}
else{
setcookie("visittime",date("y-m-d,H:i:s" ),time()+60); $count=$_COOKIE['visitcount']+1;
setcookie("visitcount",$count); echo "The time you last visited the website was:".$_COOKIE[' visittime'];
echo "
";
}
echo "The time you visited the website ".$_COOKIE['visitcount']." is:".date("y-m-d H:i:s") ;
?>
[/code]

The above has introduced that cookies must be enabled to log in. PHP uses cookies to implement access statistics code, including the content that cookies must be enabled to log in. I hope it will be helpful to friends who are interested in PHP tutorials.

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