dongxiong1935 2014-09-29 14:42 采纳率: 0%
浏览 29

PHP / Ruby强制网络门户第一个域似乎被缓存

I have created a captive portal with iptables

I use what many people seem to use : Users can request DNS, packet marked as 99. 99 means no internet else the user does have access.

When a user visits a page when visiting for example stack overflow. The user gets the disclaimer. He/she clicks on okay. What happened is that the server executes the following rules :

`sudo /sbin/iptables -t mangle -I captivePortal 1 -m mac --mac-source {$mac} -j RETURN`;
    `sudo /sbin/iptables -t mangle -I captivePortal 1 -s {$_SERVER['REMOTE_ADDR']} -j RETURN`;

What i have tried:

Used sinatra stand alone with thin. Render template with erb. When the user reloads after authenticating they get the disclaimer when visiting the initial domain. When the visit another they dont get the disclaimer page.

Set up apache2 with php, rewritten all in php. added meta tags to prevent caching in the browser but same result. original domain redirects to disclaimer always but other sites are okay.

What i want to achieve

Users need to click accept on disclaimer before they can use WIFI.

Edit : Reloading apache2 does correct this problem.

  • 写回答

1条回答 默认 最新

  • douwei8911 2015-02-14 11:20
    关注

    Used rmtrack as described here : http://www.andybev.com/index.php/Using_iptables_and_PHP_to_create_a_captive_portal

    /usr/sbin/conntrack -L \
        |grep $1 \
        |grep ESTAB \
        |grep 'dport=80' \
        |awk \
            "{ system(\"conntrack -D --orig-src $1 --orig-dst \" \
                substr(\$6,5) \" -p tcp --orig-port-src \" substr(\$7,7) \" \
                --orig-port-dst 80\"); }"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)