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

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

Hi,

  I want to thank you for this script. It's running fast and has a nice login interface. Tested OK with IE, Firefox and Safari.

Only one strange behaviour. I worked directly fine with conf.txt in same directory ( /var/www/cgi-bin/ ) and keeping  line "open (LVAR, "/var/lib/cgi-bin/conf.txt");" unmodified wink

  It's running now just fine on my spot . UK, FR,NL and even "else" people have a login page in their favorite language.

  Great thanks again for your nice job.

Greetings to all.

Camomille

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

Thanks @dmkhn for your contribution.

Unfortunately after some Win Seven update this scrip have now difficulty and cookies work one time on ten
and make me crazy.
I think in the Futur no way to do anything accross the browser without signed Microsoft signed ap.

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

I don't say it's not working, it was working fine before last seven update but now the user cookie
is sometime well seting up  and passed to the popup and sometime no, and this is not serious
as on logout you are not able to use customer info with database and customer never logout.

My side as you can see in script I use an iframe into the popup, this iframe is suposed reading
the username in cookie to update a radacct table timestamp value every 50 seconds (using ajax refresh) - Then a php cron
is reading every 60 sec the value and detect if the popup is closed if value is not updated and kick off user.

You can imagine the problem is cookie is not set, the mysql query have empty where clause and is not updating anything
so customer is kiked off in 2 min.
It's easy to fix my side because I can use WHERE FramedIPAddress = $_SERVER['REMOTE_ADDR']  and remove logout link in perl script
by this way customer just logout with closing window.

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

Yes good new is everybody have fixed this problem with personal tip :-)