index.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. //------------------参数配置
  3. $open=1; //1为关闭,0为开启
  4. $type=0; //0为按ip(同一ip不重复增加点数),1为按cookie(同一机器不重复增加点数)
  5. $retime=3600; //重复增加点数时间间隔,单位为秒
  6. $fen=1; //单一点击点数
  7. $gotourl="../../../"; //转向地址
  8. //------------------
  9. if($open)
  10. {
  11. exit();
  12. }
  13. require("../../class/connect.php");
  14. $id=(int)$_GET['id'];
  15. $n=RepPostVar($_GET['n']);
  16. if(!($id||$n))
  17. {
  18. Header("Location:$gotourl");
  19. exit();
  20. }
  21. require("../../class/db_sql.php");
  22. require("../../member/class/user.php");
  23. $link=db_connect();
  24. $empire=new mysqlquery();
  25. if($id)
  26. {
  27. $where=egetmf('userid')."='".$id."'";
  28. }
  29. else
  30. {
  31. $where=egetmf('username')."='".$n."'";
  32. }
  33. $r=$empire->fetch1("select ".eReturnSelectMemberF('userid,username')." from ".eReturnMemberTable()." where ".$where." limit 1");
  34. if(empty($r[userid]))
  35. {
  36. Header("Location:$gotourl");
  37. exit();
  38. }
  39. //cookie
  40. if($type==1)
  41. {
  42. $gfencookie=getcvar('ecmsgfen');
  43. if($gfencookie)
  44. {
  45. Header("Location:$gotourl");
  46. exit();
  47. }
  48. $set=esetcookie("ecmsgfen","ecms",time()+$retime);
  49. }
  50. //ip
  51. else
  52. {
  53. $ip=egetip();
  54. $time=time();
  55. //删除过期记录
  56. $del=$empire->query("delete from {$dbtbpre}enewsgfenip where ".$time."-addtime>".$retime);
  57. $ipr=$empire->fetch1("select ip,addtime from {$dbtbpre}enewsgfenip where ip='$ip' limit 1");
  58. if($ipr['ip'])
  59. {
  60. Header("Location:$gotourl");
  61. exit();
  62. }
  63. else
  64. {
  65. $usql=$empire->query("insert into {$dbtbpre}enewsgfenip(ip,addtime) values('$ip',$time);");
  66. }
  67. }
  68. $usql=$empire->query("update ".eReturnMemberTable()." set ".egetmf('userfen')."=".egetmf('userfen')."+".$fen." where ".$where);
  69. $set=esetcookie("gfenuserid",$r[userid],0);
  70. $set=esetcookie("gfenusername",$r[username],0);
  71. db_close();
  72. $empire=null;
  73. header("Refresh:0; URL=$gotourl");
  74. ?>