Subversion Repositories ALCASAR

Rev

Rev 1349 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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