Home >php教程 >php手册 >一个用SESSION做的图形计数器

一个用SESSION做的图形计数器

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:24:221238browse

这是一个用SESSION做的图形计数器,用户登录后,计数器加一,只有关闭浏览器重新打开时才会加一。

// 用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="" ; //TEMP为图像文件夹,图像文件名需为0.GIF.....9.GIF
}
for($i=1;$i{
$imagpath.="";
}

print"你是第".$imagpath."位来客";
?>

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