1,8 → 1,50 |
<?php |
# $Id$ |
$hostname = "alcasar"; |
# |
# index.php for ALACASAR captive portal |
# by REXY |
# UI & css style by stephane ERARD |
# The contents of this file may be used under the terms of the GNU |
# General Public License Version 2, provided that the above copyright |
# notice and this permission notice is included in all copies or |
# substantial portions of the software. |
/**************************************************************** |
* GLOBAL FILE PATHS * |
*****************************************************************/ |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
|
/**************************************************************** |
* FILE reading test * |
*****************************************************************/ |
$conf_files=array(CONF_FILE); |
foreach ($conf_files as $file){ |
if (!file_exists($file)){ |
exit("File ".$file." unknown"); |
} |
if (!is_readable($file)){ |
exit("You don't have read rights on the file ".$file); |
} |
} |
/**************************************************************** |
* Read CONF_FILE * |
*****************************************************************/ |
$ouvre=fopen(CONF_FILE,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
{ |
$tampon = fgets($ouvre, 4096); |
if (strpos($tampon,"=")!==false){ |
$tmp = explode("=",$tampon); |
$conf[$tmp[0]] = $tmp[1]; |
} |
} |
}else{ |
exit("Error opening the file ".CONF_FILE); |
} |
fclose($ouvre); |
$hostname = alcasar.$conf["DOMAIN"]; |
$network_pb = False; |
$cert_add = "http://alcasar/certs"; |
$cert_add = "http://$hostname/certs"; |
$direct_access = False; |
$diagnostic = "can't contact the default router"; |
$remote_ip = ($_SERVER['REMOTE_ADDR']); |