|
|
当前位置:首页 > > php实现网站会员打卡签到 |
php实现网站会员打卡签到 <? require_once('session.php'); ?> <? require_once('conn.php'); ?> <? session_start(); if($_SESSION['Username'] == ""){ // 未登录 echo "<script LANGUAGE='javascript'>alert('您没有登录,无法使用该功能!');history.go(-1);</script>"; } else { $Username=$_SESSION['Username']; } ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>签到</title> </head> <body> <? $LastLoginTime=date('Y-m-d'); $mSql="select * from [User] where LastLoginTime=#".$LastLoginTime."# "; $rs=new COM("adodb.recordset"); $rs->open($mSql,$conn,1,1); $paixu=$rs->RecordCount(); $rs->close(); if($paixu>0){ echo "<script LANGUAGE='javascript'>alert('您已经签到,请勿重复签到!');window.close();</script>"; } else { $rs->open("select * from [User] where username='{$_SESSION["Username"]}'",$conn,1,3); $UserLogins = $rs->Fields(UserLogins)->value; $rs->Fields(UserLogins)->value=$UserLogins+1; $rs->Fields(LastLoginTime)->value=date('Y-m-d'); $rs->update(); $rs->close(); echo "<script LANGUAGE='javascript'>alert('签到成功!');window.close();</script>"; } ?> </body> </html>
|
|