function wifidog_login($error = null) { header('Content-Type: text/html; charset=iso-8859-1'); $REMOTE_ADDR = $_SERVER["REMOTE_ADDR"]; session_start(); $ipClass = new IP(); $USE_TERMS_ACCEPTED = false; $gateway_addr = $_REQUEST["gw_address"]; $gw_port = $_REQUEST["gw_port"]; $gw_id = $_REQUEST["gw_id"]; $ARP = $_REQUEST["mac"]; $url = $_REQUEST["url"]; $cachefile = "{$GLOBALS["CACHEDIR"]}/{$ARP}." . md5($error . serialize($_REQUEST)) . "." . __FUNCTION__ . ".html"; if (isset($_POST["wifidog-terms"])) { $_SESSION["USE_TERMS_ACCEPTED"] = true; $USE_TERMS_ACCEPTED = true; } if (isset($_SESSION["USE_TERMS_ACCEPTED"])) { $USE_TERMS_ACCEPTED = true; } if (isset($_GET["clear"])) { unset($_SESSION["WIFIDOG_RULES"]); } if (!$ipClass->IsvalidMAC($ARP)) { $CacheError1 = "{$GLOBALS["CACHEDIR"]}/hostspot_network_incompatible.html"; if (!is_file($CacheError1)) { $tpl = new templates(); $text_form = $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{hostspot_network_incompatible}")); @file_put_contents($CacheError1, $text_form); } else { $text_form = @file_get_contents($CacheError1); } } if (!isset($_REQUEST["token"])) { $_REQUEST["token"] = generateToken($ARP); } $wifidog_build_uri = wifidog_build_uri(); $uriext = $wifidog_build_uri[0]; $HiddenFields = $wifidog_build_uri[1]; $wifidog_templates = new wifidog_rules(); $_SESSION["WIFIDOG_RULES"] = $wifidog_templates->ruleid; if ($GLOBALS["HOTSPOT_DEBUG"]) { wifidog_logs("Rule number {$_SESSION["WIFIDOG_RULES"]}", __FUNCTION__, __LINE__); } $wifidog_rule = new wifidog_settings($_SESSION["WIFIDOG_RULES"]); $ArticaHotSpotNowPassword = intval($wifidog_rule->GET_INFO("ArticaHotSpotNowPassword")); $ENABLED_REDIRECT_LOGIN = intval($wifidog_rule->GET_INFO("ENABLED_REDIRECT_LOGIN")); $ENABLED_SMTP = intval($wifidog_rule->GET_INFO("ENABLED_SMTP")); $ENABLED_AUTO_LOGIN = intval($wifidog_rule->GET_INFO("ENABLED_AUTO_LOGIN")); $USE_TERMS = intval($wifidog_rule->GET_INFO("USE_TERMS")); $ALLOW_RECOVER_PASS = intval($wifidog_rule->GET_INFO("ALLOW_RECOVER_PASS")); $DO_NOT_AUTENTICATE = intval($wifidog_rule->GET_INFO("DO_NOT_AUTENTICATE")); $SMS_REGISTER = intval($wifidog_rule->GET_INFO("SMS_REGISTER")); $BOUNCE_AUTH = intval($wifidog_rule->GET_INFO("BOUNCE_AUTH")); if ($BOUNCE_AUTH == 1) { if ($ARP != null) { $CacheARP = "{$GLOBALS["CACHEDIR"]}/{$ARP}"; $ligne["uid"] = null; if (is_file($CacheARP)) { if (file_time_min_Web($CacheARP) > 15) { @unlink($CacheARP); } } if (!is_file($CacheARP)) { $q = new mysql_hotspot(); $sql = "SELECT * FROM hotspot_members WHERE MAC='{$ARP}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $uid = $ligne["uid"]; } else { $ligne["uid"] = @file_get_contents($CacheARP); } if ($ligne["uid"] != null) { $array["LOGIN"] = $ligne["uid"]; $array["IPADDR"] = null; $array["MAC"] = $ARP; $array["ARP"] = $ARP; $array["token"] = $_REQUEST["token"]; $array["ruleid"] = $_SESSION["WIFIDOG_RULES"]; if (UnLock($array)) { wifidog_redirect_after_login(); return; } } } } if ($USE_TERMS == 1) { if (!$USE_TERMS_ACCEPTED) { if ($GLOBALS["HOTSPOT_DEBUG"]) { wifidog_logs("->wifidog_terms()", __FUNCTION__, __LINE__); } return wifidog_terms($ARP); } } $wifidog_templates = new wifidog_templates($_SESSION["WIFIDOG_RULES"]); if ($SMS_REGISTER == 1) { if ($GLOBALS["HOTSPOT_DEBUG"]) { wifidog_logs("->wifidog_register_sms()", __FUNCTION__, __LINE__); } wifidog_register_sms(); return; } if ($ENABLED_SMTP == 1) { if ($ENABLED_REDIRECT_LOGIN == 1) { wifidog_register(); return; } } if (is_file($cachefile)) { echo @file_get_contents($cachefile); return; } $page = CurrentPageName(); $tpl = new templates(); $username = $wifidog_templates->LabelUsername; $password = $wifidog_templates->LabelPassword; $lost_password_text = $wifidog_templates->LostPasswordLink; $please_sign_in = $tpl->_ENGINE_parse_body("{please_sign_in}"); $page = CurrentPageName(); $t = time(); unset($_SESSION["HOTSPOT_AUTO_RECOVER"]); $_SESSION["HOTSPOT_REDIRECT_URL"] = $url; $url_encoded = urlencode($url); if ($DO_NOT_AUTENTICATE == 1) { $ArticaHotSpotNowPassword = 1; } $f[] = "<p>{$wifidog_templates->WelcomeMessage}</p>"; $f[] = "<div id='content'>"; $f[] = ""; $f[] = "<form id='wifidogform' action=\"{$page}\" method=\"post\">"; $f[] = "<input type=\"hidden\" name=\"ruleid\" id=\"ruleid\" value='{$_SESSION["WIFIDOG_RULES"]}'>"; $f[] = "{$HiddenFields}"; if ($wifidog_templates->FORM_HEAD != null) { $f[] = "<p>{$wifidog_templates->FORM_HEAD}</p>"; } $f[] = "<table style='width:100%'>"; $f[] = "<tr>"; $f[] = "<td class=legend>{$username}:</td>"; $f[] = "<td>\n\t<input type=\"text\" \n\t\tname=\"username\" \n\t\tid=\"username\"\n\t\tvalue=\"{$_REQUEST["username"]}\" \n\t\tonfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\tonblur=\"this.removeAttribute('class');\" \n\t\tOnKeyPress=\"javascript:SendLogon{$t}(event)\">"; $f[] = "</td>"; $f[] = "</tr>"; if ($ArticaHotSpotNowPassword == 0) { $f[] = "<tr>"; $f[] = "<td class=legend>{$password}:</td>"; $f[] = "<td><input type=\"password\" name=\"password\" \n\t\t\t\tvalue=\"{$_REQUEST["password"]}\"\n\t\t\t\tid=\"password\" onfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\t\t\tonblur=\"this.removeAttribute('class');\" OnKeyPress=\"javascript:SendLogon{$t}(event)\">"; $f[] = "</td>"; $f[] = "</tr>"; } else { $f[] = "<input type=\"hidden\" name=\"password\" id=\"password\" value=''>"; } $f[] = "<tr><td colspan=2> </td></tr>"; $f[] = "<tr><td colspan=2 align='right' class=ButtonCell>"; if ($ENABLED_AUTO_LOGIN == 1) { $f[] = "<a data-loading-text=\"Chargement...\"\n\t\tstyle=\"text-transform:capitalize\"\n\t\tclass=\"Button2014 Button2014-success Button2014-lg\"\n\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\"\n\t\thref=\"{$page}?wifidog-register=yes&{$uriext}\">« {$wifidog_templates->RegisterTitle} »</a>"; } $f[] = "<a data-loading-text=\"Chargement...\" \n\t\t\tstyle=\"text-transform:capitalize\" \n\t\t\tclass=\"Button2014 Button2014-success Button2014-lg\" \n\t\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\" \n\t\t\tonclick=\"javascript:document.forms['wifidogform'].submit();\" \n\t\t\thref=\"javascript:Blurz()\">« " . $wifidog_templates->char($wifidog_templates->ConnectionButton) . " »</a>"; $f[] = "</td>\n\t</tr>"; if ($ENABLED_SMTP == 1) { if ($ALLOW_RECOVER_PASS == 1) { if ($ArticaHotSpotNowPassword == 0) { $f[] = "<tr><td class=legend colspan=2>"; $f[] = "<a href=\"{$page}?wifidog-recover=yes&email={$_REQUEST["username"]}&{$uriext}\">{$lost_password_text}</a></div>"; $f[] = "</td></tr>"; } } } $f[] = "</table>"; $f[] = "\t\t\t</form>\t"; $f[] = "</div>\n\t<script>\n\t\tfunction SendLogon{$t}(e){\n\t\t\tif(!checkEnter(e)){return;}\n\t\t\tdocument.forms['wifidogform'].submit();\n\t\t}\n\t</script>\n\t\n"; $text_form = @implode("\n", $f); $page = BuildFullPage($text_form, $error); @file_put_contents($cachefile, $page); echo $page; }
function wifidog_login($error = null) { $sock = new sockets(); session_start(); $ipClass = new IP(); $tpl = new templates(); $USE_TERMS_ACCEPTED = false; header('Content-Type: text/html; charset=iso-8859-1'); $gateway_addr = $_REQUEST["gw_address"]; $gw_port = $_REQUEST["gw_port"]; $gw_id = $_REQUEST["gw_id"]; $ARP = $_REQUEST["mac"]; $url = $_REQUEST["url"]; if (isset($_POST["wifidog-terms"])) { $_SESSION["USE_TERMS_ACCEPTED"] = true; $USE_TERMS_ACCEPTED = true; } if (isset($_SESSION["USE_TERMS_ACCEPTED"])) { $USE_TERMS_ACCEPTED = true; } if (!$ipClass->IsvalidMAC($ARP)) { $text_form = $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{hostspot_network_incompatible}")); } if (!isset($_REQUEST["token"])) { $_REQUEST["token"] = generateToken($ARP); } $wifidog_build_uri = wifidog_build_uri(); $uriext = $wifidog_build_uri[0]; $HiddenFields = $wifidog_build_uri[1]; $ArticaHotSpotSMTP = SMTP_SETTINGS(); if ($ArticaHotSpotSMTP["USE_TERMS"] == 1) { if (!$USE_TERMS_ACCEPTED) { return wifidog_terms(); } } $fontsize = $ArticaHotSpotSMTP["SKIN_FONT_SIZE"]; $ArticaSplashHotSpotTitle = $sock->GET_INFO("ArticaSplashHotSpotTitle"); if ($ArticaSplashHotSpotTitle == null) { $ArticaSplashHotSpotTitle = "HotSpot system"; } $tpl = new templates(); $username = $tpl->_ENGINE_parse_body("{username}"); $password = $tpl->_ENGINE_parse_body("{password}"); $please_sign_in = $tpl->_ENGINE_parse_body("{please_sign_in}"); $page = CurrentPageName(); $ArticaSplashHotSpotTitle = $sock->GET_INFO("ArticaSplashHotSpotTitle"); if ($ArticaSplashHotSpotTitle == null) { $ArticaSplashHotSpotTitle = "HotSpot system"; } $lost_password_text = $tpl->_ENGINE_parse_body("{lost_password}"); if (!isset($ArticaHotSpotSMTP["ENABLED_AUTO_LOGIN"])) { $ArticaHotSpotSMTP["ENABLED_AUTO_LOGIN"] = 0; } if (!isset($ArticaHotSpotSMTP["ENABLED_SMTP"])) { $ArticaHotSpotSMTP["ENABLED_SMTP"] = 0; } $t = time(); unset($_SESSION["HOTSPOT_AUTO_RECOVER"]); $_SESSION["HOTSPOT_REDIRECT_URL"] = $url; $url_encoded = urlencode($url); $Connexion = $tpl->_ENGINE_parse_body("{connection}"); $page = CurrentPageName(); $f[] = ""; $f[] = " <div id='content'>"; $f[] = " "; $f[] = "\t\t\t<form id='wifidogform' action=\"{$page}\" method=\"post\">"; $f[] = "{$HiddenFields}"; $f[] = "\t\t\t\t<div class=\"f\">"; $f[] = "\t\t\t\t\t<div class=\"field\">"; $f[] = "\t\t\t\t\t\t<label for=\"username\" style='font-size:{$ArticaHotSpotSMTP["SKIN_LABEL_FONT_SIZE"]}'>{$username}:</label> <input type=\"text\" \n\t\tname=\"username\" \n\t\tid=\"username\"\n\t\tvalue=\"{$_REQUEST["username"]}\" \n\t\tonfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\tonblur=\"this.removeAttribute('class');\" \n\t\tOnKeyPress=\"javascript:SendLogon{$t}(event)\">"; $f[] = "\t\t"; $f[] = "</div>"; $f[] = "\t<div class=\"field\">"; $f[] = "\t\t<label for=\"password\" style='font-size:{$ArticaHotSpotSMTP["SKIN_LABEL_FONT_SIZE"]}'>{$password}:</label> <input type=\"password\" name=\"password\" \n\t\t\t\tvalue=\"{$_REQUEST["password"]}\"\n\t\t\t\tid=\"password\" onfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\t\t\tonblur=\"this.removeAttribute('class');\" OnKeyPress=\"javascript:SendLogon{$t}(event)\">"; if ($ArticaHotSpotSMTP["ENABLED_SMTP"] == 1) { $f[] = "<div style='text-align:right'><a href=\"{$page}?wifidog-recover=yes&email={$_REQUEST["username"]}&{$uriext}\">{$lost_password_text}</a></div>"; } $f[] = "\t\t\t\t\t</div>"; $f[] = "\t\t\t\t\t<div class=\"field button\">"; if ($ArticaHotSpotSMTP["ENABLED_AUTO_LOGIN"] == 1) { $register = $tpl->_ENGINE_parse_body("{register}"); $f[] = "\t\t\t\t\t\t<a data-loading-text=\"Chargement...\"\n\t\tstyle=\"font-size:{$fontsize};text-transform:capitalize\"\n\t\tclass=\"Button2014 Button2014-success Button2014-lg\"\n\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\"\n\t\thref=\"{$page}?wifidog-register=yes&{$uriext}\">« {$register} »</a>"; } $f[] = "<a data-loading-text=\"Chargement...\" \n\t\t\tstyle=\"font-size:{$fontsize};text-transform:capitalize\" \n\t\t\tclass=\"Button2014 Button2014-success Button2014-lg\" \n\t\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\" \n\t\t\tonclick=\"javascript:document.forms['wifidogform'].submit();\" \n\t\t\thref=\"javascript:Blurz()\">« {$Connexion} »</a>"; $f[] = "\t\t\t\t\t</div>"; if ($ArticaHotSpotSMTP["SKIN_TEXT_LOGON"] != null) { $f[] = "<p style='font-size:{$ArticaHotSpotSMTP["SKIN_FONT_SIZE"]};padding:8px'>{$ArticaHotSpotSMTP["SKIN_TEXT_LOGON"]}</p>"; } $f[] = "\t\t\t\t</div>"; $f[] = "\t\t"; $f[] = "\t\t\t</form>\t"; $f[] = "</div>\n\t<script>\n\t\tfunction SendLogon{$t}(e){\n\t\t\tif(!checkEnter(e)){return;}\n\t\t\tdocument.forms['wifidogform'].submit();\n\t\t}\n\t</script>\n\t\n"; $text_form = @implode("\n", $f); echo BuildFullPage($text_form, $error); }
function wifidog_login($error = null) { $sock = new sockets(); $page = CurrentPageName(); session_start(); $ipClass = new IP(); $tpl = new templates(); $USE_TERMS_ACCEPTED = false; header('Content-Type: text/html; charset=iso-8859-1'); $gateway_addr = $_REQUEST["gw_address"]; $gw_port = $_REQUEST["gw_port"]; $gw_id = $_REQUEST["gw_id"]; $ARP = $_REQUEST["mac"]; $url = $_REQUEST["url"]; if (isset($_POST["wifidog-terms"])) { $_SESSION["USE_TERMS_ACCEPTED"] = true; $USE_TERMS_ACCEPTED = true; } if (isset($_SESSION["USE_TERMS_ACCEPTED"])) { $USE_TERMS_ACCEPTED = true; } if (!$ipClass->IsvalidMAC($ARP)) { $text_form = $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{hostspot_network_incompatible}")); } if (!isset($_REQUEST["token"])) { $_REQUEST["token"] = generateToken($ARP); } $wifidog_build_uri = wifidog_build_uri(); $uriext = $wifidog_build_uri[0]; $HiddenFields = $wifidog_build_uri[1]; if (!isset($_SESSION["WIFIDOG_RULES"])) { $wifidog_templates = new wifidog_rules(); $_SESSION["WIFIDOG_RULES"] = $wifidog_templates->ruleid; } $wifidog_rule = new wifidog_settings($_SESSION["WIFIDOG_RULES"]); $ArticaHotSpotNowPassword = intval($wifidog_rule->GET_INFO("ArticaHotSpotNowPassword")); $ENABLED_REDIRECT_LOGIN = intval($wifidog_rule->GET_INFO("ENABLED_REDIRECT_LOGIN")); $ENABLED_SMTP = intval($wifidog_rule->GET_INFO("ENABLED_SMTP")); $ENABLED_AUTO_LOGIN = intval($wifidog_rule->GET_INFO("ENABLED_AUTO_LOGIN")); $USE_TERMS = intval($wifidog_rule->GET_INFO("USE_TERMS")); $ALLOW_RECOVER_PASS = intval($wifidog_rule->GET_INFO("ALLOW_RECOVER_PASS")); $DO_NOT_AUTENTICATE = intval($wifidog_rule->GET_INFO("DO_NOT_AUTENTICATE")); if ($USE_TERMS == 1) { if (!$USE_TERMS_ACCEPTED) { return wifidog_terms(); } } $wifidog_templates = new wifidog_templates($_SESSION["WIFIDOG_RULES"]); $ArticaSplashHotSpotTitle = $wifidog_templates->MainTitle; if ($ENABLED_SMTP == 1) { if ($ENABLED_REDIRECT_LOGIN == 1) { wifidog_register(); return; } } $tpl = new templates(); $username = $wifidog_templates->LabelUsername; $password = $wifidog_templates->LabelPassword; $lost_password_text = $wifidog_templates->LostPasswordLink; $please_sign_in = $tpl->_ENGINE_parse_body("{please_sign_in}"); $page = CurrentPageName(); $t = time(); unset($_SESSION["HOTSPOT_AUTO_RECOVER"]); $_SESSION["HOTSPOT_REDIRECT_URL"] = $url; $url_encoded = urlencode($url); if ($DO_NOT_AUTENTICATE == 1) { $ArticaHotSpotNowPassword = 1; } $f[] = "<p>{$wifidog_templates->WelcomeMessage}</p>"; $f[] = " <div id='content'>"; $f[] = " "; $f[] = "\t\t\t<form id='wifidogform' action=\"{$page}\" method=\"post\">"; $f[] = "\t\t\t<input type=\"hidden\" name=\"ruleid\" id=\"ruleid\" value='{$_SESSION["WIFIDOG_RULES"]}'>"; $f[] = "{$HiddenFields}"; $f[] = "<table style='width:100%'>"; $f[] = "<tr>"; $f[] = "<td class=legend>{$username}:</td>"; $f[] = "<td>\n\t<input type=\"text\" \n\t\tname=\"username\" \n\t\tid=\"username\"\n\t\tvalue=\"{$_REQUEST["username"]}\" \n\t\tonfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\tonblur=\"this.removeAttribute('class');\" \n\t\tOnKeyPress=\"javascript:SendLogon{$t}(event)\">"; $f[] = "</td>"; $f[] = "</tr>"; if ($ArticaHotSpotNowPassword == 0) { $f[] = "<tr>"; $f[] = "<td class=legend>{$password}:</td>"; $f[] = "<td><input type=\"password\" name=\"password\" \n\t\t\t\tvalue=\"{$_REQUEST["password"]}\"\n\t\t\t\tid=\"password\" onfocus=\"this.setAttribute('class','active');RemoveLogonCSS();\" \n\t\t\t\tonblur=\"this.removeAttribute('class');\" OnKeyPress=\"javascript:SendLogon{$t}(event)\">"; $f[] = "</td>"; $f[] = "</tr>"; } else { $f[] = "<input type=\"hidden\" name=\"password\" id=\"password\" value=''>"; } $f[] = "<tr><td colspan=2> </td></tr>"; $f[] = "<tr><td colspan=2 align='right' class=ButtonCell>"; if ($ENABLED_AUTO_LOGIN == 1) { $f[] = "\t\t\t\t\t\t<a data-loading-text=\"Chargement...\"\n\t\tstyle=\"text-transform:capitalize\"\n\t\tclass=\"Button2014 Button2014-success Button2014-lg\"\n\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\"\n\t\thref=\"{$page}?wifidog-register=yes&{$uriext}\">« {$wifidog_templates->RegisterTitle} »</a>"; } $f[] = "<a data-loading-text=\"Chargement...\" \n\t\t\tstyle=\"text-transform:capitalize\" \n\t\t\tclass=\"Button2014 Button2014-success Button2014-lg\" \n\t\t\tid=\"fb92ae5e1f7bbea3b5044cbcdd40f088\" \n\t\t\tonclick=\"javascript:document.forms['wifidogform'].submit();\" \n\t\t\thref=\"javascript:Blurz()\">« {$wifidog_templates->ConnectionButton} »</a>"; $f[] = "</td>\n\t</tr>"; if ($ENABLED_SMTP == 1) { if ($ALLOW_RECOVER_PASS == 1) { if ($ArticaHotSpotNowPassword == 0) { $f[] = "<tr><td class=legend colspan=2>"; $f[] = "<a href=\"{$page}?wifidog-recover=yes&email={$_REQUEST["username"]}&{$uriext}\">{$lost_password_text}</a></div>"; $f[] = "</td></tr>"; } } } $f[] = "</table>"; $f[] = "\t\t\t</form>\t"; $f[] = "</div>\n\t<script>\n\t\tfunction SendLogon{$t}(e){\n\t\t\tif(!checkEnter(e)){return;}\n\t\t\tdocument.forms['wifidogform'].submit();\n\t\t}\n\t</script>\n\t\n"; $text_form = @implode("\n", $f); echo BuildFullPage($text_form, $error); }