douliao7930 2019-04-30 05:38
浏览 56

如何在没有SQL的情况下允许一次加载页面

I'm setting up landing page page and I want each user to be able to to only visit my index file only once without saving in SQL database, if opened again get redirected to main page.

I tried one script and modified it but doesn't seem to work or maybe I changed incorrectly.

$ip = $_SERVER['REMOTE_ADDR'];
$ipbreak = $_SERVER['REMOTE_ADDR'].PHP_EOL;
function donothing() {
;
}
if (strpos(file_get_contents("./ipblocker.txt"),$ip) == true) {
   header("location: https://example.com/");
   exit();
    }elseif(strpos(file_get_contents("./ipblocker.txt"),$ip) == false) {
    file_put_contents("ipblocker.txt",$ipbreak, FILE_APPEND);
    donothing();
    echo "LOADED";
}

I only want user to be able to view my landing page once only.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题