zoukankan      html  css  js  c++  java
  • 网页上记录鼠标的点击次数和一段有用的php代码,自己学习使用

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>记录鼠标的点击次数</title>
    <meta http-equiv="content-type" content="text/html;charset=gb2312">
    </head>
    <body>
    <div id="count"></div>
    <script type="text/javascript">
    function addCookie(name,cookievalue,time) {
    if (name != "" && cookievalue != "" && time != "") {
    if (isNaN(time) == false){
    var expires = new Date();
    expires.setTime(expires.getTime() + time * 1000);
    document.cookie = name + '=' + escape(cookievalue) + ';expires=' + expires.toGMTString();
    }
    }
    }
    function getCookie(cookieName) {
    var cookieString = document.cookie;
    var start = cookieString.indexOf(cookieName + '=');
    if (start == -1)
    return null;
    start += cookieName.length + 1;
    var end = cookieString.indexOf(';', start);
    if (end == -1) return unescape(cookieString.substring(start));
    return unescape(cookieString.substring(start, end));
    }
    var html = document.getElementsByTagName("html")[0];
    html.onclick = function(){
    var count = parseInt(getCookie('count'))+1;
    addCookie("count",count,"1000");
    document.getElementById("count").innerHTML = "您点击了"+getCookie('count')+"次!";
    }
    if (getCookie('count')){
    document.getElementById("count").innerHTML = "您点击了"+getCookie('count')+"次!";
    }else{
    document.getElementById("count").innerHTML = "您还没有点击过!";
    addCookie("count","0","1000");

    }
    </script>
    </body>
    </html>

    <?php
    //接受页面传来的值,如果有6个高级会员,那么就接受6个相同的值,当接受6个相同的值的时候并且是6个不同的会员,就是已经通过审核,更改表dede_archives里arcrank的值,审核通过
    $id=$_GET["aid"];
    $name=$_GET["name"];
    $accrant=$_GET["accrant"];
    $con=mysql_connect("localhost","root","120911");
    if(!$con)
    {
    die('Could not connect'.mysql_error());
    }
    mysql_select_db("dedecms",$con);
    //当界面运行的时候就开始执行查询,通过accrant的值来查询会员名称,查到的会员就是已经审核本篇 文章的会员,在界面输出,以示提醒
    $list=mysql_query("select distinct(huiyuan) from dede_shenhe where accrant=1");
    echo "<table border='0'>";
    while($list=mysql_fetch_array($list))
    {
    echo "<tr>";
    echo "<td>这篇通告已经通过".$list['huiyuan']."审核</td>";
    echo "</tr>";
    }
    echo "</table>";
    $sql="
    insert into dede_shenhe (aid,huiyuan,accrant) values($id,'$name',$accrant);
    ";
    mysql_query($sql);
    $huiyuan=mysql_query("
    select COUNT(*) from (select * from dede_shenhe where aid=$id) a group by a.huiyuan
    ");
    $row1 = mysql_num_rows($huiyuan);
    if($row1==3)
    {
    mysql_query("
    update dede_archives set arcrank=0 where id=$id");
    }
    mysql_close($con);
    ?>

  • 相关阅读:
    solr和mongodb比较
    IKAnalyzer原理分析
    maven项目java包名的路径问题
    solr的EmbeddedSolrServer原理深入探讨
    团队冲刺第二阶段06
    构建之法读书笔记06——敏捷流程
    团队冲刺第二阶段05
    团队冲刺第二阶段04
    团队冲刺第二阶段03
    团队冲刺第二阶段02
  • 原文地址:https://www.cnblogs.com/275147378abc/p/5090555.html
Copyright © 2011-2022 走看看