Home > Backend Development > PHP Tutorial > A graphical counter made with SESSION_PHP tutorial

A graphical counter made with SESSION_PHP tutorial

WBOY
Release: 2016-07-13 17:24:20
Original
833 people have browsed it

This is a graphical counter made with SESSION. After the user logs in, the counter is incremented by one. It will only be incremented by one when the browser is closed and reopened.

// Counter written in SESSION,
session_start();
if (session_is_registered(count)==false){
while(($fp=fopen("counter .txt","r+"))==false);
while(flock($fp,3)==false);
$count=fgets($fp,255);
$count+ =1;
fseek($fp,0);
fputs($fp,$count);
fclose($fp);
session_register(count);
}

$len=strlen($count);
for($i=1;$i{
$imagpath="A graphical counter made with SESSION_PHP tutorial" ; //TEMP is an image folder, and the image file name needs to be 0.GIF...9.GIF
}
for($i=1;$i{
$imagpath.="A graphical counter made with SESSION_PHP tutorial";
}

print "You are the ".$imagpath." visitor";
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532156.htmlTechArticleThis is a graphical counter made with SESSION. After the user logs in, the counter will be incremented by one. Only by closing the browser and reopening it It will be increased by one. // Counter written with SESSION, session_start(...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template