Subversion Repositories ALCASAR

Rev

Rev 1124 | Rev 1286 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1124 Rev 1249
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 1124 2013-06-21 08:23:00Z crox53 $
2
# $Id: index.php 1249 2013-10-22 22:09:01Z richard $
-
 
3
#
-
 
4
# index.php for ALACASAR captive portal
-
 
5
# by REXY
-
 
6
# UI & css style by stephane ERARD
-
 
7
# The contents of this file may be used under the terms of the GNU
-
 
8
# General Public License Version 2, provided that the above copyright
-
 
9
# notice and this permission notice is included in all copies or
-
 
10
# substantial portions of the software.
-
 
11
/****************************************************************
-
 
12
*			GLOBAL FILE PATHS			*
-
 
13
*****************************************************************/
-
 
14
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
-
 
15
 
-
 
16
/****************************************************************
-
 
17
*			FILE reading test			*
-
 
18
*****************************************************************/
-
 
19
$conf_files=array(CONF_FILE);
-
 
20
foreach ($conf_files as $file){
-
 
21
	if (!file_exists($file)){
-
 
22
		exit("File ".$file." unknown");
-
 
23
	}
-
 
24
	if (!is_readable($file)){
-
 
25
		exit("You don't have read rights on the file ".$file);
-
 
26
	}
-
 
27
}
-
 
28
/****************************************************************
-
 
29
*			Read CONF_FILE				*
-
 
30
*****************************************************************/
-
 
31
$ouvre=fopen(CONF_FILE,"r");
-
 
32
if ($ouvre){
-
 
33
	while (!feof ($ouvre))
-
 
34
	{
-
 
35
		$tampon = fgets($ouvre, 4096);
-
 
36
		if (strpos($tampon,"=")!==false){
-
 
37
			$tmp = explode("=",$tampon);
-
 
38
			$conf[$tmp[0]] = $tmp[1];
-
 
39
		}
-
 
40
	}
-
 
41
}else{
-
 
42
	exit("Error opening the file ".CONF_FILE);
-
 
43
}
-
 
44
fclose($ouvre);
3
$hostname = "alcasar";
45
$hostname = alcasar.$conf["DOMAIN"];
4
$network_pb = False;
46
$network_pb = False;
5
$cert_add = "http://alcasar/certs";
47
$cert_add = "http://$hostname/certs";
6
$direct_access = False;
48
$direct_access = False;
7
$diagnostic = "can't contact the default router";
49
$diagnostic = "can't contact the default router";
8
$remote_ip = ($_SERVER['REMOTE_ADDR']);
50
$remote_ip = ($_SERVER['REMOTE_ADDR']);
9
$tab = array();$user = array();
51
$tab = array();$user = array();
10
$connection_history =  "";
52
$connection_history =  "";