Subversion Repositories ALCASAR

Rev

Rev 1349 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1349 Rev 1380
1
<?php
1
<?php
2
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
2
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
3
 
3
 
4
$ouvre=fopen(CONF_FILE,"r");
4
$ouvre=fopen(CONF_FILE,"r");
5
if($ouvre){
5
if($ouvre){
6
	while(!feof ($ouvre))
6
	while(!feof ($ouvre))
7
	{
7
	{
8
		$tampon = fgets($ouvre, 4096);
8
		$tampon = fgets($ouvre, 4096);
9
		if(strpos($tampon,"=")!=false)
9
		if(strpos($tampon,"=")!=false)
10
		{
10
		{
11
			$tmp = explode("=",$tampon);
11
			$tmp = explode("=",$tampon);
12
			$conf[$tmp[0]] = $tmp[1];
12
			$conf[$tmp[0]] = $tmp[1];
13
		}
13
		}
14
		
14
		
15
	} 
15
	} 
16
} else {
16
} else {
17
	exit("Erreur d'ouverture du fichier".CONF_FILE);
17
	exit("Erreur d'ouverture du fichier".CONF_FILE);
18
}
18
}
19
fclose($ouvre);
19
fclose($ouvre);
20
$organisme = trim($conf["ORGANISM"]);
20
$organisme = trim($conf["ORGANISM"]);
21
 
21
 
22
?>
22
?>
23
<!DOCTYPE HTML>
23
<!DOCTYPE HTML>
24
<HTML><!-- written by Rexy -->
24
<HTML><!-- written by Rexy -->
25
<head>
25
<head>
26
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
26
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
27
<title>Auto enregistrement</title>
27
<title>Auto enregistrement</title>
28
<link rel="stylesheet" href="/css/style_intercept.css">
28
<link rel="stylesheet" href="/css/style_intercept.css">
29
<style type=text/css"></style>
29
<style type=text/css"></style>
30
</head>
30
</head>
31
<body>
31
<body>
32
<?
32
<?
33
# Choice of language
33
# Choice of language
34
$Language = 'en';
34
$Language = 'en';
35
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
35
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
36
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
36
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
37
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
37
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
38
if($Language == 'fr'){
38
if($Language == 'fr'){
39
	$l_title = "Page d'auto enregistrement";
39
	$l_title = "Page d'auto enregistrement";
40
	$l_num_exist = "Compte actif";
40
	$l_num_exist = "Compte actif";
41
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
41
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
42
 
42
 
43
	$l_num_num = "Numero de téléphone";
43
	$l_num_num = "Numero de téléphone";
44
	$l_num_raison = "Etat de votre numéro";
44
	$l_num_raison = "Etat de votre numéro";
45
	$l_num_expiration = "Expiration du bloquage";
45
	$l_num_expiration = "Expiration du bloquage";
46
	$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
46
	$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
47
	$l_num_empty = "Le champ de recherche est vide.";
47
	$l_num_empty = "Le champ de recherche est vide.";
-
 
48
	$l_num_invalid = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
48
	$l_num_recherche = "Rechercher votre numéro:";
49
	$l_num_recherche = "Rechercher votre numéro:";
49
 
50
 
50
	$l_recherche = "Rechercher";
51
	$l_recherche = "Rechercher";
51
 
52
 
52
	$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
53
	$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
53
	$l_tuto_2 = "Le portail auquel vous essayez de vous connectez offre la possibilité de s'inscrire automatiquement, en envoyant votre mot de passe par SMS au numéro (prix d'un SMS, non surtaxé):";
54
	$l_tuto_2 = "Le portail auquel vous essayez de vous connectez offre la possibilité de s'inscrire automatiquement, en envoyant votre mot de passe par SMS au numéro (prix d'un SMS, non surtaxé):";
54
       	$l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
55
       	$l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
55
	$l_tuto_4 = "A la suite de votre inscription, vous pourrez retrouver votre numéro de téléphone dans le tableau ci-dessous, avec l'état et la date d'expiration de validité ou bloquage de ce dernier. Seul les 30 dernier numéros peuvent être affichés. Un champ de recherche est néanmoins disponible.";	
56
	$l_tuto_4 = "A la suite de votre inscription, vous pourrez retrouver votre numéro de téléphone dans le tableau ci-dessous, avec l'état et la date d'expiration de validité ou bloquage de ce dernier. Seul les 30 dernier numéros peuvent être affichés. Un champ de recherche est néanmoins disponible.";	
-
 
57
	$l_help_s = "Pour la France: +3312234455";
56
}
58
}
57
else {
59
else {
58
 
60
 
59
}
61
}
60
?>
62
?>
61
<center>
63
<center>
62
 
64
 
63
 
65
 
64
<div id="logon">
66
<div id="logon">
65
<h1><?php echo "$organisme" ?></h1>
67
<h1><?php echo "$organisme" ?></h1>
66
<h2><?php echo "$l_title" ?></h2>
68
<h2><?php echo "$l_title" ?></h2>
67
<div>
69
<div>
68
<table id="boite-info">
70
<table id="boite-info">
69
	<tr>
71
	<tr>
70
		<td rowspan="6" width="20%"><img id="logo-organ" src="/images/organisme.png"></td>
72
		<td rowspan="6" width="20%"><img id="logo-organ" src="/images/organisme.png"></td>
71
	</tr>
73
	</tr>
72
	<tr>
74
	<tr>
73
		<td><?php echo "$l_tuto_1" ?></td>
75
		<td><?php echo "$l_tuto_1" ?></td>
74
	</tr>
76
	</tr>
75
	<tr>
77
	<tr>
76
		<td><?php echo "$l_tuto_2" ?></td>
78
		<td><?php echo "$l_tuto_2" ?></td>
77
	</tr>
79
	</tr>
78
 
80
 
79
	<tr>
81
	<tr>
80
		<td align="center">
82
		<td align="center">
81
			<h3>	
83
			<h3>	
82
			<?php 	
84
			<?php 	
83
				$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
85
				$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
84
				echo "$current_num";  
86
				echo "$current_num";  
85
			?>
87
			?>
86
			</h3>
88
			</h3>
87
		</td>
89
		</td>
88
	</tr>
90
	</tr>
89
 
91
 
90
	<tr>
92
	<tr>
91
		<td><?php echo "$l_tuto_3" ?></td>
93
		<td><?php echo "$l_tuto_3" ?></td>
92
	</tr>
94
	</tr>
93
	<tr>
95
	<tr>
94
		<td><?php echo "$l_tuto_4" ?></td>
96
		<td><?php echo "$l_tuto_4" ?></td>
95
	</tr>
97
	</tr>
96
</table>
98
</table>
97
</div>
99
</div>
98
<?php
100
<?php
99
 
101
 
100
require('/etc/freeradius-web/config.php');
102
require('/etc/freeradius-web/config.php');
101
 
103
 
102
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
104
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
103
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
105
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
104
else{
106
else{
105
	echo "<b>Could not include SQL library</b>\n";
107
	echo "<b>Could not include SQL library</b>\n";
106
	exit();
108
	exit();
107
}
109
}
108
 
110
 
109
 
111
 
110
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
112
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
111
 
113
 
112
if(mysqli_connect_errno())
114
if(mysqli_connect_errno())
113
{
115
{
114
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
116
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
115
}
117
}
116
 
118
 
117
$result = mysqli_query($con, "SELECT * 
119
$result = mysqli_query($con, "SELECT * 
118
				FROM `SMS_ban_perm` 
120
				FROM `SMS_ban_perm` 
119
				ORDER BY date_add DESC
121
				ORDER BY date_add DESC
120
				LIMIT 0,30;");
122
				LIMIT 0,30;");
121
 
123
 
122
	echo "	<br />
124
	echo "	<br />
123
		<table id=\"boite-info\" border=\"1\">
125
		<table id=\"boite-info\" border=\"1\">
124
		<tr>
126
		<tr>
125
		<td><b>$l_num_num</b></td>
127
		<td><b>$l_num_num</b></td>
126
		<td><b>$l_num_raison</b></td>
128
		<td><b>$l_num_raison</b></td>
127
		<td><b>$l_num_expiration</b></td>
129
		<td><b>$l_num_expiration</b></td>
128
		</tr>";
130
		</tr>";
129
 
131
 
130
while($row = mysqli_fetch_array($result))
132
while($row = mysqli_fetch_array($result))
131
{
133
{
132
	$start = substr($row['SenderNumber'], 0, 3);
134
	$start = substr($row['SenderNumber'], 0, 5);
133
	$end = substr($row['SenderNumber'], -3);
135
	$end = substr($row['SenderNumber'], -3);
134
	echo "	
136
	echo "	
135
		<tr>
137
		<tr>
136
		<td>".$start."****".$end."</td>";
138
		<td>".$start."****".$end."</td>";
137
	
139
	
138
	if($row['Perm']=='0')
140
	if($row['Perm']=='0')
139
	{
141
	{
140
		echo "<td>$l_num_exist</td>";
142
		echo "<td>$l_num_exist</td>";
141
	}
143
	}
142
	if($row['Perm']=='1')
144
	if($row['Perm']=='1')
143
	{
145
	{
144
		echo "<td>$l_num_flood</td>";
146
		echo "<td>$l_num_flood</td>";
145
	}
147
	}
146
	echo "	<td>" . $row['Expiration']. "</td>
148
	echo "	<td>" . $row['Expiration']. "</td>
147
		</tr>";
149
		</tr>";
148
}
150
}
149
 
151
 
150
if (isset($_POST['number']))
152
if (isset($_POST['number']))
151
{
153
{
152
	$num = mysqli_real_escape_string($con, $_POST['number']);
154
	$num = mysqli_real_escape_string($con, $_POST['number']);
153
	echo "<tr>";
155
	echo "<tr>";
154
	if($num!=""){
156
	if($num!=""){
155
		echo "<td><b>$num</b></td>";
-
 
156
		$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm WHERE SenderNumber='$num';");
-
 
157
		$row = mysqli_fetch_array($result);
-
 
158
		if($row['Perm']=="")
157
		if(preg_match('#^\+#', $num) == 1)
159
		{
158
		{
160
			echo "<td colspan=\"2\"><b><font color=\"red\">$l_num_inconnu</font></b></td>";	
159
			echo "<td><b>$num</b></td>";
-
 
160
			$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm WHERE SenderNumber='$num';");
161
		} else {
161
			$row = mysqli_fetch_array($result);
162
			if($row['Perm']==0)
162
			if($row['Perm']=="")
163
			{
163
			{
-
 
164
				echo "<td colspan=\"2\"><b><font color=\"red\">$l_num_inconnu</font></b></td>";	
-
 
165
			} else {
-
 
166
				if($row['Perm']==0)
-
 
167
				{
164
			echo "<td><b><font color=\"red\">$l_num_exist</font></b></td>";
168
					echo "<td><b><font color=\"red\">$l_num_exist</font></b></td>";
165
		}
169
				}
166
		if($row['Perm']==1)
170
			if($row['Perm']==1)
167
		{
171
			{
168
			echo "<td><b><font color=\"red\">$l_num_flood</font></b></td>";
172
				echo "<td><b><font color=\"red\">$l_num_flood</font></b></td>";
-
 
173
				}
-
 
174
				echo "	<td><b>" . $row['Expiration']. "</b></td>";	
169
			}
175
			}
-
 
176
		} else {
170
			echo "	<td><b>" . $row['Expiration']. "</b></td>";	
177
			echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_invalid</font></b></td>";
171
		}
178
		}
172
	} else {
179
	} else {	
173
		echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_empty</font></b></td>";
180
		echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_empty</font></b></td>";
174
	}
181
	}
175
	echo "</tr>";
182
	echo "</tr>";
176
}
183
}
177
 
184
 
178
 
185
 
179
echo "</table>";
186
echo "</table>";
180
mysqli_close($con);
187
mysqli_close($con);
181
?>
188
?>
182
<table id="boite-info">
189
<table id="boite-info">
183
	<tr>
190
	<tr>
184
		<form action="autoregistrationinfo.php" method="POST">
191
		<form action="autoregistrationinfo.php" method="POST">
185
	<td><?php echo "$l_num_recherche"; ?> <input type="text" name="number" maxlength="10" size="10"> <input type="submit" value="<?php echo "$l_recherche" ?>"></td>
192
	<td><?php echo "$l_num_recherche"; ?> <input type="text" name="number" maxlength="10" size="10"> <input type="submit" value="<?php echo "$l_recherche" ?>"></td>
186
		</form>
193
		</form>
187
	</tr>
194
	</tr>
-
 
195
	<tr>
-
 
196
	<td colspan=\"2\"><?php echo $l_help_s; ?></td>
-
 
197
	</tr>
188
</table>
198
</table>
189
 
199
 
190
 
200
 
191
<br />
201
<br />
192
</div>
202
</div>
193
</center>
203
</center>
194
</body>
204
</body>
195
</html>
205
</html>
196
 
206