简单的cookie计数器实现源码

yipeiwu_com6年前PHP代码库

复制代码 代码如下:

<?php  if (!empty ($_COOKIE['example'] ))
             $example = ++$_COOKIE['example'] ;
        else $example = 1 ; 
            setcookie("example",$example,time()+54000);
?>

复制代码 代码如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>简单的COOKIE计数器</title>
<style type="text/css">
<!--
.style1 {
    font-size: 14px;
    font-family: "华文琥珀";
}
.style2 {
    font-size: 25px;
    font-family: "华文行楷";
}
.style3 {
    font-size: 13px;
    font-family: "华文琥珀";
}
-->
</style>
</head>
<body>
<table width="350" height="208" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/136.JPG">
      <table width="240" height="208" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="30" align="center" class="style2"> </td>
      </tr>
      <tr>
        <td height="25" align="center" class="style2">欢迎光临</td>
      </tr>
      <tr>
        <td height="30" align="center" valign="top">
          <span class="style1">本页已经被访问:</span>
          <span class="style2"> <?php echo "$example";?>次</span>
        </td>
      </tr>
      <tr>
        <td height="18" align="center" valign="top">
          <span class="style3">简单的COOKIE计数器</span>
        </td>
      </tr>
      <tr>
        <td height="30" align="center"> </td>
      </tr>
    </table> </td>
  </tr>
</table>
</body>
</html>


 

相关文章

PHP网络操作函数汇总

checkdnsrr — 给指定的主机(域名)或者IP地址做DNS通信检查 closelog — 关闭系统日志链接 define_syslog_variables — 初始化所有sysl...

php获取从百度搜索进入网站的关键词的详细代码

分享一个php获取从百度搜索进入网站的关键词的代码,有需要的朋友可以参考一下: 代码: 复制代码 代码如下: <?php function search_word_from() {...

php url地址栏传中文乱码解决方法集合

php地址栏传中文$_GET下来后乱码,urlencode和urldecode用法详解url编码语法: string urlencode(string str);返回值: 字符串函数种类...

php生成短域名函数

php生成短域名函数 public function createRandCode($string) { $code = ''; $hex_code = '1qaz2...

php后门URL的防范

例如,下面WEB应用可能向登入用户显示敏感信息:复制代码 代码如下:<?php$authenticated = FALSE;$authenticated = check_auth(...