Chillispot forum

Chillispot community is alive again...

You are not logged in.

Announcement

Important keyword hotfix for Chillispot (all versions): If you have already installed chillispot, please verify that key.chillispot.info is set instead of key.chillispot.org.
You should see this in your config file:

domain key.chillispot.info

This should fix the keyword functionality. For more information about keywords please visit this page.

#1 2010-03-09 00:32:24

krys3d
New member
Registered: 2008-04-28
Posts: 5

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–a";
   $R_wait = "Espere por favor...";
   $R_onlinetime = "Tiempo conectado";
   $R_remainingtime = "Tiempo que queda";
   $R_encrypted = "Debe utilizar la conexi—n cifrada";
   $R_saveuser = "Recuerde usuario/contrase–a";
   #$R_login_string = "<a href=\"/help.php\">Ayud</a>";
   $R_login_string = "Login Message";
   $R_loggedin_string = "Bienvenidos!";
   $R_loggedout_string = "Gracias por usar $companyname!";
   $R_Alert = "No cierre esta ventana, sólo reducirlo, de lo contrario se va a desconectar";
}
elsif($language =~ /^de$/)
{
   $R_ChilliError = "Das Login mu§ mit dem Chillispot daemon erfolgen";
   $R_login = "Einloggen";
   $R_logout = "Ausloggen";
   $R_loginfailed = "Einloggen fehlgeschlagen";
   $R_loggingin = "Einloggen";
   $R_loggedin = "Eingeloggt";
   $R_loggedout = "Ausloggen";
   $R_user = "Nutzer";
   $R_password = "Passwort";
   $R_wait = "Bitte warten...";
   $R_onlinetime = "Online Zeit";
   $R_remainingtime = "Verbleibende Zeit";
   $R_encrypted = "Beim Einloggen mu§ eine verschlŸsselte Verbindung genutzt werden";
   $R_saveuser = "Erinnern nutzer/passwort";
   #$R_login_string = "<a href=\"/help.php\">Hilfe</a>";
   $R_login_string = "Login Message";
   $R_loggedin_string = "Wilkommen!";
   $R_loggedout_string = "Danke fur das Verwenden von $companyname!";
   $R_Alert = "Schließen Sie dieses Fenster nicht, nur zu verringern, sonst wird die Verbindung getrennt werden";


}
elsif($language =~ /^fr$/)
{
    $R_ChilliError = "L ouverture doit etre exécutee par le demon de Chillispot";
    $R_login = "Ouverture";
    $R_logout = "Deconnexion";
    $R_loginfailed = "L ouverture echoue";
    $R_loggingin = "Entrer";
    $R_loggedin = "Connecte";
    $R_loggedout = "Deconnecte";
    $R_user = "Utilisateur";
    $R_password = "Mot de passe";
    $R_wait = "Svp attendez...";
    $R_onlinetime = "Temps en ligne";
    $R_remainingtime = "Temps restant";
    $R_encrypted = "L ouverture doit utiliser SSL";
    $R_saveuser = "Se rappeler de mon utilisateur/mot de passe";
    $R_simultaneous = "";
    $R_login_string = "Login Message";
    $R_loggedin_string = "Bienvenue!";
    $R_loggedout_string = "Merci d avoir utilise $companyname!";
    $R_Alert = "Ne fermez pas cette fenetre, reduisez la simplement, sinon vous seriez deconnecte";

}
else
{
   $R_ChilliError = "You can only login while connected to the hotspot.";
   $R_login = "Login";
   $R_logout = "Logout";
   $R_loginfailed = "Login failed";
   $R_loggingin = "Logging in";
   $R_loggedin = "Logged in";
   $R_loggedout = "Logged out";
   $R_user = "User";
   $R_password = "Password";
   $R_wait = "Please wait...";
   $R_onlinetime = "Online time";
   $R_remainingtime = "Remaining time";
   $R_encrypted = "Login must use encrypted connection";
   $R_saveuser = "Remember user/password";
   #$R_login_string = "<a href=\"/help.php\">Help</a>";
   $R_login_string = "Login Message";
   $R_loggedin_string = "Welcome!";
   $R_loggedout_string = "Thanks for using $companyname!";
   $R_Alert = "Do not close this window, just reduce it, otherwise you will be disconnected";
}

# If https required, switch remarks on following "if" statements
#if (!($ENV{HTTPS} =~ /^on$/)) {
if (0) {


print "Content-type: text/html\n\n
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>$companyname/title>
<meta http-equiv=\"Cache-control\" content=\"no-cache\">
<meta http-equiv=\"Pragma\" content=\"no-cache\">
<style type=\"text/css\">
   H2 {FONT-FAMILY: $font; FONT-SIZE: 12px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   H3 {FONT-FAMILY: $font; FONT-SIZE: 10px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   body {color: $text; background-color: $bgcolor; background-image: url($background); font-family: $font; font-size: 10; font-weight: normal }
   a:link {color:$link}
   a:active {color:$alink}
   a:visited {color:$vlink}
   a:hover {color:$hlink}
</style>
</head>
<body>
<h2>$R_loginfailed</H2><br>
$R_encrypted</body></html>";
exit(0);
}

$loginpath = $ENV{'SCRIPT_NAME'};

use Digest::MD5  qw(md5 md5_hex md5_base64);

# Make sure that the form parameters are clean
$OK_CHARS='-a-zA-Z0-9_.@&=%!';
$| = 1;
if ($ENV{'CONTENT_LENGTH'}) {
    read (STDIN, $_, $ENV{'CONTENT_LENGTH'});
}
s/[^$OK_CHARS]/_/go;
$input = $_;

# Make sure that the get query parameters are clean
$OK_CHARS='-a-zA-Z0-9_.@&=%!';
$_ = $query=$ENV{'QUERY_STRING'};
s/[^$OK_CHARS]/_/go;
$query = $_;

#Read form parameters which we care about
@array = split('&',$input);
foreach $var ( @array )
{
    @array2 = split('=',$var);
    if ($array2[0] =~ /^UserName$/) { $username = $array2[1]; }
    if ($array2[0] =~ /^Password$/) { $password = $array2[1]; }
    if ($array2[0] =~ /^challenge$/) { $challenge = $array2[1]; }
    if ($array2[0] =~ /^button$/) { $button = $array2[1]; }
    if ($array2[0] =~ /^logout$/) { $logout = $array2[1]; }
    if ($array2[0] =~ /^prelogin$/) { $prelogin = $array2[1]; }
    if ($array2[0] =~ /^res$/) { $res = $array2[1]; }
    if ($array2[0] =~ /^uamip$/) { $uamip = $array2[1]; }
    if ($array2[0] =~ /^uamport$/) { $uamport = $array2[1]; }
    if ($array2[0] =~ /^userurl$/)   { $userurl = $array2[1]; }
    if ($array2[0] =~ /^timeleft$/)  { $timeleft = $array2[1]; }
    if ($array2[0] =~ /^redirurl$/)  { $redirurl = $array2[1]; }
    if ($array2[0] =~ /^mac$/)  { $mac = $array2[1]; }

# This should be added to 'standard' cgi script also
    if ($array2[0] =~ /^reply$/)     { $replyencoded = $array2[1]; }
}

#Read query parameters which we care about
@array = split('&',$query);
foreach $var ( @array )
{
    @array2 = split('=',$var);
    if ($array2[0] =~ /^res$/)       { $res = $array2[1]; }
    if ($array2[0] =~ /^challenge$/) { $challenge = $array2[1]; }
    if ($array2[0] =~ /^uamip$/)     { $uamip = $array2[1]; }
    if ($array2[0] =~ /^uamport$/)   { $uamport = $array2[1]; }

# This should be changed in 'standard' cgi script also
    if ($array2[0] =~ /^reply$/)     { $replyencoded = $array2[1]; }

    if ($array2[0] =~ /^userurl$/)   { $userurl = $array2[1]; }
    if ($array2[0] =~ /^timeleft$/)  { $timeleft = $array2[1]; }
    if ($array2[0] =~ /^redirurl$/)  { $redirurl = $array2[1]; }
    if ($array2[0] =~ /^mac$/)  { $mac = $array2[1]; }
    if ($array2[0] =~ /^nasid$/)  { $nasid = $array2[1]; }
}

# This should be added to 'standard' cgi script also
$reply = $replyencoded;

$reply =~ s/\+/ /g;
$reply =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/seg;

$button =~ s/\+/ /g;
$button =~ s/\_/ /g;

$userurldecode = $userurl;
$userurldecode =~ s/\+/ /g;
$userurldecode =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/seg;

$redirurldecode = $redirurl;
$redirurldecode =~ s/\+/ /g;
$redirurldecode =~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/seg;

# Tim added these two lines:
$username =~ s/\+/ /g;
$username =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/seg;

$password =~ s/\+/ /g;
$password =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/seg;

# If attempt to login
if ($button =~ $R_login) {
    $hexchal  = pack "H32", $challenge;
    if (defined $uamsecret) {
   $newchal  = md5($hexchal, $uamsecret);
    }
    else {
   $newchal  = $hexchal;
    }
    $response = md5_hex("\0", $password, $newchal);
    $pappassword = unpack "H32", ($password ^ $newchal);

print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>$companyname</title>
<meta http-equiv=\"Cache-control\" content=\"no-cache\">
<meta http-equiv=\"Pragma\" content=\"no-cache\">";
    if ( (defined $uamsecret) && (defined $userpassword)) {
   print "<meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\">";
    } else {
   print "<meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&response=$response&userurl=$userurl\">";
    }

print "<style type=\"text/css\">
   H2 {FONT-FAMILY: $font; FONT-SIZE: 16px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   H3 {FONT-FAMILY: $font; FONT-SIZE: 14px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   body {color: $text; background-color: $bgcolor; font-family: $font; font-size: 12; font-variant: normal; font-style: normal}
   a:link {color:$link}
   a:active {color:$alink}
   a:visited {color:$vlink}
   a:hover {color:$hlink}
</style>
</head><body>
<center>";
print "<h3>$R_loggingin</H3><br>$R_wait</center></body></html>";
exit(0);
}

# Default: It was not a form request
$result = 0;

# If login successful
if ($res =~ /^success$/) { $result = 1; }

# If login failed
if ($res =~ /^failed$/) { $result = 2; }

# If logout successful
if ($res =~ /^logoff$/) { $result = 3; }

# If tried to login while already logged in
if ($res =~ /^already$/) { $result = 4; }

# If not logged in yet
if ($res =~ /^notyet$/) { $result = 5; }

# If login from smart client
if ($res =~ /^smartclient$/) { $result = 6; }

# If requested a logging in pop up window
if ($res =~ /^popup1$/) { $result = 11; }

# If requested a success pop up window
if ($res =~ /^popup2$/) { $result = 12; }

# If requested a logout pop up window
if ($res =~ /^popup3$/) { $result = 13; }


# Otherwise it was not a form request
# Send out an error message
if ($result == 0) {
    print "Content-type: text/html\n\n
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>$companyname</title>
<meta http-equiv=\"Cache-control\" content=\"no-cache\">
<meta http-equiv=\"Pragma\" content=\"no-cache\">
<style type=\"text/css\">
   H2 {FONT-FAMILY: $font; FONT-SIZE: 16px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   H3 {FONT-FAMILY: $font; FONT-SIZE: 14px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   body {color: $text; background-color: $bgcolor; background-image: url($background); font-family: $font; font-size: 12; font-variant: normal; font=style: normal}
   a:link {color:$link}
   a:active {color:$alink}
   a:visited {color:$vlink}
   a:hover {color:$hlink}
</style>
</head>
<body>
<center>
<h3>$R_loginfailed</h3><br>
$R_ChilliError</center></body></html>";
exit(0);
}

#Generate the output
print "Content-type: text/html\n\n
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>$companyname</title>
<meta http-equiv=\"Cache-control\" content=\"no-cache\">
<meta http-equiv=\"Pragma\" content=\"no-cache\">
<SCRIPT LANGUAGE=\"JavaScript\">
    var blur = 0;
    var starttime = new Date();
    var startclock = starttime.getTime();
    var mytimeleft = 0;
    var user = \"\";
    var password = \"\";

   function getCookie(c_name)
   {
      if (document.cookie.length>0)
      {
         c_start=document.cookie.indexOf(c_name + \"=\");

         if(c_start!=-1)
         {
            c_start=c_start + c_name.length+1;
            c_end=document.cookie.indexOf(\";\",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
         }
      }
      return \"\";
   }

   function setCookie(c_name,value,expiredays)
   {
      var exdate=new Date();
      exdate.setDate(exdate.getDate()+expiredays);
      document.cookie=c_name+ \"=\" +escape(value)+((expiredays==null) ? \"\" : \";expires=\"+exdate.toGMTString());
   }


   function getCookies()
   {
      user=getCookie('user');
      if(user!=null && user!=\"\")
      {
         document.form1.UserName.value = user;
         document.form1.saveusrpass.checked = true;
      }

      password=getCookie('password');
      if(password!=null && password!=\"\")
      {
         document.form1.Password.value = password;
      }
   }

   function setCookies()
   {
      if(!document.form1.saveusrpass.checked)
      {
         setCookie('user',\"\",365);
         setCookie('password',\"\",365);
         return;
      }

      user = document.form1.UserName.value;
      password = document.form1.Password.value;

      if(user!=null && user!=\"\")
      {
         if(password!=null && password!=\"\")
         {
            setCookie('user',user,365);
            setCookie('password',password,365);
         }
      }
   }


    function doTime() {
      window.setTimeout( \"doTime()\", 1000 );
      t = new Date();
      time = Math.round((t.getTime() - starttime.getTime())/1000);
      if (mytimeleft) {
        time = mytimeleft - time;
        if (time <= 0) {
          window.location = \"$loginpath?res=popup3&uamip=$uamip&uamport=$uamport\";
        }
      }
      if (time < 0) time = 0;
      hours = (time - (time % 3600)) / 3600;
      time = time - (hours * 3600);
      mins = (time - (time % 60)) / 60;
      secs = time - (mins * 60);
      if (hours < 10) hours = \"0\" + hours;
      if (mins < 10) mins = \"0\" + mins;
      if (secs < 10) secs = \"0\" + secs;
      title = \"$R_onlinetime: \" + hours + \":\" + mins + \":\" + secs;
      if (mytimeleft) {
        title = \"$R_remainingtime: \" + hours + \":\" + mins + \":\" + secs;
      }
      if(document.all || document.getElementById){
         document.title = title;
      }
      else {   
        self.status = title;
      }
    }

    function popUp(URL) {

      if (self.name != \"chillispot_popup\") {
        chillispot_popup = window.open(URL, 'chillispot_popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');
      }
    }

    function doOnLoad(result, URL, userurl, redirurl, timeleft) {

      if (timeleft) {
        mytimeleft = timeleft;
      }
      if ((result == 1) && (self.name == \"chillispot_popup\")) {
        doTime();
      }
      if ((result == 1) && (self.name != \"chillispot_popup\")) {
        chillispot_popup = window.open(URL, 'chillispot_popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');
      }
      if ((result == 2) || result == 5) {
   getCookies();
        document.form1.UserName.focus()
      }
      if ((result == 2) && (self.name != \"chillispot_popup\")) {
        chillispot_popup = window.open('', 'chillispot_popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=200');
        chillispot_popup.close();
      }
      if ((result == 12) && (self.name == \"chillispot_popup\")) {
        doTime();
        if (redirurl) {
          window.opener.top.location.href = redirurl;
        }
        else if (userurl) {
          window.opener.top.location.href = userurl;
        }
        else if (opener.home) {
          window.opener.top.location.href = \"$redir\";
        }
        else {
          window.opener.top.location.href = \"$redir\";
        }
        self.focus();
        blur = 0;
      }
      if ((result == 13) && (self.name == \"chillispot_popup\")) {
        self.focus();
        blur = 1;
      }
    }

    function doOnBlur(result) {
      if ((result == 12) && (self.name == \"chillispot_popup\")) {
        if (blur == 0) {
          blur = 1;
          self.focus();
        }
      }
    }
</script>
<style type=\"text/css\">
   H2 {FONT-FAMILY: $font; FONT-SIZE: 16px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   H3 {FONT-FAMILY: $font; FONT-SIZE: 14px; MARGIN: 1px; PADDING: 1px; TEXT-DECORATION: none}
   body {color: $text; background-color: $bgcolor; background-image: url($background); font-family: $font; font-size: 10; font-variant: normal; font-style: normal}
   table {color: $text; font-family: $font; font-size: 12; font-weight: normal; padding: 0; margin: 0}
   a:link {color:$link}
   a:active {color:$alink}
   a:visited {color:$vlink}
   a:hover {color:$hlink}
</style>
</head>
<body onLoad=\"javascript:doOnLoad($result, '$loginpath?res=popup2&uamip=$uamip&uamport=$uamport&userurl=$userurl&redirurl=$redirurl&timeleft=$timeleft&reply=$replyencoded','$userurldecode', '$redirurldecode', '$timeleft')\" onBlur = \"javascript:doOnBlur($result)\"><center>";
# In body onLoad above, after $timeleft, add '&reply=$replyencoded to 'standard' cgi script

if ($result == 2)
{
   print "<h3>$R_loginfailed</h3>";
   if ($reply) { print "$reply<br>"; }
}

if ($result == 5)
{
   #print "<h3>$R_login</h3>";

}

if ($result == 2 || $result == 5)
{


   print "<br/><br/><br/><table width=\"800\" height=\"400\" border=\"10\" background=\"$bgt\"><tr><td align=\"center\"><form name=\"form1\" method=\"post\" action=\"$loginpath\"\" onSubmit=\"setCookies()\">
  <INPUT TYPE=\"hidden\" NAME=\"challenge\" VALUE=\"$challenge\">
  <INPUT TYPE=\"hidden\" NAME=\"uamip\" VALUE=\"$uamip\">
  <INPUT TYPE=\"hidden\" NAME=\"uamport\" VALUE=\"$uamport\">
  <INPUT TYPE=\"hidden\" NAME=\"userurl\" VALUE=\"$userurldecode\">
  <INPUT TYPE=\"hidden\" NAME=\"mac\" VALUE=\"$mac\">

  <table style=\"width: 250px;\">
      <tr>
        <td align=\"right\">$R_user:</td>
        <td><input type=\"text\" name=\"UserName\" size=\"14\" maxlength=\"128\"></td>
      </tr>
      <tr>
        <td align=\"right\">$R_password:</td>
        <td><input type=\"password\" name=\"Password\" size=\"14\" maxlength=\"128\"></td>
      </tr>
      <tr>
        <td align=\"center\" colspan=\"2\" height=\"23\"><input type=\"submit\" name=\"button\" value=\"$R_login\" onClick=\"javascript:popUp('$loginpath?res=popup1&uamip=$uamip&uamport=$uamport&mac=$mac')\"></td>
      </tr>
   <tr>
   <td align=\"center\" colspan=\"2\">
   <input type=\"checkbox\" name=\"saveusrpass\"> $R_saveuser
   </table></form></div>";

   if($R_login_string) { print "$R_login_string"; }
   print "</center></td></tr></table></body></html>";

}

if ($result == 1)
{
   print "<br/><br/><br/><table width=\"800\" height=\"400\" border=\"10\" background=\"$bgt\"><tr><td align=\"center\"><h3>$R_loggedin</h3><br>";
   if($R_loggedin_string) { print "$R_loggedin_string<br><br>";}
   if ($reply) { print "$reply</BR></BR>";}
   print "<a href=\"http://$uamip:$uamport/logoff\">$R_logout</a></center></td></tr></table></body></html>";

   

}

if (($result == 4) || ($result == 12))
{
   print "<table width=\"450\" height=\"150\" border=\"10\" background=\"$bgt\"><tr><td align=\"center\"><h3>$R_loggedin</h3><br/>";
   if($R_loggedin_string) { print "$R_loggedin_string<br/>"; }
   if ($reply) { print "$reply</BR></BR>";}
   print "<div align=\"center\"><font color=\"red\" size=\"4\">$R_Alert</font</div><br>";

##My side I use  here a dynamic ajax refresh iframe to display username and time but this iframe have another job, this iframe update
##a time field in database, by this way this field is updated each 30 seconds and on server a cron job compare this field to old value each 60 sec
##by this way I can kick-off  a user if he close the login windows and he will not lost all connexion time
##the code is just print"<center><iframe src=\"../refresh.php\" width=\"200px\" height=\"100px\" frameborder=\"1\" /></iframe></center>";
##if you whant to know more about this feature contact me christian**@**comdif.com juste remove the *


   print "<br/><a href=\"http://$uamip:$uamport/logoff\">$R_logout</a><br></center></td></tr></table></body></html>";
}

if ($result == 11)
{
   print "<h3>$R_loggingin</h3><br>";
   print "<br>$R_wait</center></body></html>";

}

if (($result == 3) || ($result == 13))
{
   print "<table width=\"450\" height=\"250\" border=\"10\" background=\"$bgt\"><tr><td align=\"center\">$R_loggedout</h3><br>";
   if($R_loggedout_string) { print "$R_loggedout_string<br><br>"; }
   print "</center></td></tr></table></body></html>";
sleep(3);
print "<SCRIPT LANGUAGE='JavaScript'>window.close();</script>";

}

exit(0);
------------------------------------------------------------------------------------

just some tips path for conf file in cgi script must be absolute
all other path if you whant to use conf or bg pictures out of cgi-bin must be relative to myweb/cgi-bin

enjoy :-)

Offline

 

#2 2010-05-28 20:17:49

Camomille
New member
Registered: 2010-05-16
Posts: 1

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

Offline

 

#3 2010-08-16 10:30:25

dmkhn
Member
From: Ukraine
Registered: 2009-04-28
Posts: 160

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

Little modified variant of hotspotlogin.cgi, placed in post #1
- added russian messages
- for ukrainian browsers messages outs on russian language
- !!! replies from radius about exeeded limits of time, traffic and simultaneous logins are translated too

script is here:
ftp://dmitrykhn.homedns.org/For%20PC/docs/hotspotlogin.cgi

Note about config file - in script placed at my ftp value changed for my mandriva cgi-bin folder placement - /var/www/cgi-bin. So, if you need, change it..

All translates of new messages to english/germany/espaniol/french language i maded by google-translate online service,so if somebody find error and know more right variant of message, please post it here

Offline

 

#4 2010-08-17 23:38:48

krys3d
New member
Registered: 2008-04-28
Posts: 5

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.

Offline

 

#5 2010-08-18 07:58:14

dmkhn
Member
From: Ukraine
Registered: 2009-04-28
Posts: 160

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

i don't try it with win7 yet. You say - its not working?

Offline

 

#6 2010-08-18 14:24:52

krys3d
New member
Registered: 2008-04-28
Posts: 5

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.

Offline

 

#7 2010-08-18 14:48:49

dmkhn
Member
From: Ukraine
Registered: 2009-04-28
Posts: 160

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

in my case (billing used by me) chilli uses standart raidus attribute Acct-Interim-Interval which when it set (in secconds) force chilli to send data about user session (time and octets) every (setted value) secconds/ Other side my billingonce per day checks radius table radacct and fix strings with stale sessions, addig stop time (accounted like sum of start time and seccion duration, sended by chilli because Acct-Interim-Interval attribute) and disonect reason (something like "Iddle-Timeout", or just any you like)..

Offline

 

#8 2010-08-18 16:41:12

krys3d
New member
Registered: 2008-04-28
Posts: 5

Re: My Contrib hotspotlogin.cgi multilanguages and multi browser

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

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson