This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Display Custom Home Screen for Different Users
#6
Another option is to use mac address instead of IP. This will only work for local clients (not external via port forward).

Run script once:
Code:
io.writefile('/www/user/mac.lp', [[<?
clientip = ngx.var.remote_addr
lines = io.readfile('/proc/net/arp'):split('\n')

for i = 2, #lines do
  ip, _, _, mac = unpack(lines[ i ]:gsub('%s+', ' '):split(' '))
  if clientip == ip then
    write(mac)
    break
  end
end
?>]])

Add to Custom JS (replace IP check script):
Code:
$(function() {
  if ($('body').hasClass('usermode') || $('html').hasClass('touch')) {
    var plans = {
      'aa:bb:cc:dd:ee:ff': 9,
    };
    
    $.get('/user/mac.lp', function(resp) {
      var mac = $.trim(resp);
      var plan = plans[ mac ];
      
      if (plan) {
        showPlan(plan);
      }
    });
  }
});
Reply


Messages In This Thread
RE: Display Custom Home Screen for Different Users - by admin - 04.08.2022, 06:50

Forum Jump: