Topic: My Contrib hotspotlogin.cgi multilanguages and multi browser
Hi all
I have just lost my day because I would like to have a loggin page working with all browsers old and new
bypassing all popup blocker and multilanguage.
First I have found this post here
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=16085&sid=aa1bdf68479bac9bb7eec97183c26e06
Right it seem nice but need some change for my use as I would like to have a nice design
and be able to change some var with just a simple configuration file like a txt file.
and be able to change conf with a php page.
This script is tested 100% working with FF 3.6 IE8 and Google chrome on win7
txt file is just something like
-----------conf.txt------------------
uamsecret = mysecret
sitname = HOTSPOT ACCESS
redir = http://google.com
bgt = hspot.jpg
textcolor =
bg =
bgcolor =
fnt =
link = #0000ff
alink = #4040ff
vlink = ##80008
hlink = #4040ff
------------------------------------
-----------hotspotlogin.cgi-------
#!/usr/bin/perl
open (LVAR, "/var/lib/cgi-bin/conf.txt");
while (<LVAR>) {
chomp;
my ($var, $val) = split(/\s*\=\s*/);
$cnf{$var} = $val;
}
close(LVAR);
$companyname = $cnf{'sitname'};
$uamsecret = $cnf{'uamsecret'};
$redir = $cnf{'redir'};
$bgt = $cnf{'bgt'};
$text = $cnf{'textcolor'};
$background = $cnf{'bg'};
$bgcolor = $cnf{'bgcolor'};
$font = $cnf{'fnt'};
$link = $cnf{'link'};
$alink = $cnf{'alink'};
$vlink = $cnf{'vlink'};
$hlink = $cnf{'hlink'};
# Uncomment the following line if you want to use ordinary user-password
# for radius authentication. Must be used together with $uamsecret.
$userpassword=1;
$language = $ENV{'HTTP_ACCEPT_LANGUAGE'};
@array = split(',',$language);
foreach $var ( @array )
{
$var = substr($var,0,2);
if($var =~ /^de$/) { $language = "de"; last; }
if($var =~ /^es$/) { $language = "es"; last; }
if($var =~ /^fr$/) { $language = "fr"; last; }
if($var =~ /^en$/) { $language = "en"; last; }
}
if($language =~ /^es$/)
{
$R_ChilliError = "La Conexion solo por ChilliSpot daemon";
$R_login = "Conecte";
$R_logout = "Desconecte";
$R_loginfailed = "No conectar";
$R_loggingin = "Accediendo";
$R_loggedin = "Conectado";
$R_loggedout = "Est desconectado";
$R_user = "Usuario";
$R_password = "Contrase