Discuz教程网

PHP如何防刷新

[复制链接]
authicon dly 发表于 2011-4-5 12:19:52 | 显示全部楼层 |阅读模式
想办法记录你最近的访问时间。如果时间间隔太短,就提示“刷新不要快于N秒”。
下面是PHPWIND7中的代码(可能有断章取义之嫌,但是可以大致看出PW7的思路)

  1. if (GetCookie('lastvisit')) {
  2. list($c_oltime,$lastvisit,$lastpath) = explode("\t",GetCookie('lastvisit'));
  3. ($onbbstime=$timestamp-$lastvisit)<$db_onlinetime && $c_oltime+=$onbbstime;
  4. }

  5. ......

  6. $onbbstime=$timestamp-$lastvisit;
  7. ......

  8. if ($db_refreshtime && $REQUEST_URI == $lastpath && $onbbstime < $db_refreshtime) {
  9.         !GetCookie('winduser') && $groupid = 'guest';
  10.         $skin = $skinco ? $skinco : $db_defaultstyle;
  11.         Showmsg('refresh_limit');
  12. }

复制代码






上一篇:PHP Cookie设置方法
下一篇:天天团购系统 集成了Ucenter模块 v1.3.6 Build 20110328
authicon D_hong 发表于 2011-5-7 21:59:45 | 显示全部楼层
不错,我喜欢
authicon 皆无 发表于 2011-5-8 05:59:48 | 显示全部楼层
好东东下下来看看
authicon 计晨 发表于 2011-5-8 10:59:51 | 显示全部楼层
回贴下载呀
authicon 风中徜徉 发表于 2011-5-14 09:00:00 | 显示全部楼层
不错,我喜欢
authicon 咫尺天 发表于 2011-5-17 18:59:49 | 显示全部楼层
继续来索要
authicon 乐娃娃 发表于 2011-5-19 17:59:45 | 显示全部楼层
哦哦,发财了啊,看到好东西啦
authicon mjz 发表于 2011-5-22 14:59:51 | 显示全部楼层
看帖必回
authicon Pianissimo 发表于 2011-5-26 11:59:56 | 显示全部楼层
这个不错呀
authicon lilac_yao 发表于 2011-6-19 14:59:31 | 显示全部楼层
看帖必回
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 08:58

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表