Subversion Repositories ALCASAR

Rev

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

Rev 1380 Rev 1387
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
<!-- DataTables CSS -->
-
 
31
<link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.css">
-
 
32
<!-- jQuery -->
-
 
33
<script type="text/javascript" charset="utf8" src="../js/jquery.js"></script>
-
 
34
<!-- DataTables -->
-
 
35
<script type="text/javascript" charset="utf8" src="../js/jquery.dataTables.js"></script>
-
 
36
<script type="text/javascript">
-
 
37
$(document).ready( function () {
-
 
38
    $('#table_id').DataTable({
-
 
39
		"language": {
-
 
40
			"paginate": {
-
 
41
			"sFirst": "Premier",
-
 
42
			"sLast": "Dernier",
-
 
43
			"sPrevious": "Précédent",
-
 
44
			"sNext": "Suivant"
-
 
45
			},
-
 
46
            "lengthMenu": "Montrer _MENU_ résultat par page",
-
 
47
            "zeroRecords": "Aucun résultat",
-
 
48
            "info": "Affiche la page _PAGE_ sur _PAGES_",
-
 
49
            "infoEmpty": "Aucun résultat",
-
 
50
			"sSearch": "Recherche (5 dernier chiffre) :"
-
 
51
        }
-
 
52
	});
-
 
53
} );
-
 
54
</script>
30
</head>
55
</head>
31
<body>
56
<body>
32
<?
57
<?
33
# Choice of language
58
# Choice of language
34
$Language = 'en';
59
$Language = 'en';
35
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
60
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
36
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
61
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
37
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
62
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
38
if($Language == 'fr'){
63
if($Language == 'fr'){
39
	$l_title = "Page d'auto enregistrement";
64
	$l_title = "Page d'auto enregistrement";
40
	$l_num_exist = "Compte actif";
65
	$l_num_exist = "Compte actif";
41
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
66
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
42
 
67
 
43
	$l_num_num = "Numero de téléphone";
68
	$l_num_num = "Numero de téléphone";
44
	$l_num_raison = "Etat de votre numéro";
69
	$l_num_raison = "Etat de votre numéro";
45
	$l_num_expiration = "Expiration du bloquage";
70
	$l_num_expiration = "Expiration du bloquage";
46
	$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
71
	$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
47
	$l_num_empty = "Le champ de recherche est vide.";
72
	$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)";
73
	$l_num_invalid = "Le format n'est pas correct: xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
49
	$l_num_recherche = "Rechercher votre numéro:";
74
	$l_num_recherche = "Rechercher votre numéro:";
50
 
75
 
51
	$l_recherche = "Rechercher";
76
	$l_recherche = "Rechercher";
52
 
77
 
53
	$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
78
	$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é):";
79
	$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.";
80
       	$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.";	
81
	$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.";	
57
	$l_help_s = "Pour la France: +3312234455";
82
	$l_tuto_5 = "Le champ de recherche ci-dessous vous permet de rechercher votre numéro suivant les 5 derniers chiffres.";	
58
}
83
}
59
else {
84
else {
60
 
85
 
61
}
86
}
62
?>
87
?>
63
<center>
88
<center>
64
 
89
 
65
 
90
 
66
<div id="logon">
91
<div id="logon">
67
<h1><?php echo "$organisme" ?></h1>
92
<h1><?php echo "$organisme" ?></h1>
68
<h2><?php echo "$l_title" ?></h2>
93
<h2><?php echo "$l_title" ?></h2>
69
<div>
94
<div>
70
<table id="boite-info">
95
<table id="boite-info">
71
	<tr>
96
	<tr>
72
		<td rowspan="6" width="20%"><img id="logo-organ" src="/images/organisme.png"></td>
97
		<td rowspan="6" width="30%"><img id="logo-organ" src="/images/organisme.png"></td>
73
	</tr>
98
	</tr>
74
	<tr>
99
	<tr>
75
		<td><?php echo "$l_tuto_1" ?></td>
100
		<td><?php echo "$l_tuto_1" ?></td>
76
	</tr>
101
	</tr>
77
	<tr>
102
	<tr>
78
		<td><?php echo "$l_tuto_2" ?></td>
103
		<td><?php echo "$l_tuto_2" ?></td>
79
	</tr>
104
	</tr>
80
 
105
 
81
	<tr>
106
	<tr>
82
		<td align="center">
107
		<td align="center">
83
			<h3>	
108
			<h3>	
84
			<?php 	
109
			<?php 	
85
				$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
110
				$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
86
				echo "$current_num";  
111
				echo "$current_num";  
87
			?>
112
			?>
88
			</h3>
113
			</h3>
89
		</td>
114
		</td>
90
	</tr>
115
	</tr>
91
 
116
 
92
	<tr>
117
	<tr>
93
		<td><?php echo "$l_tuto_3" ?></td>
118
		<td><?php echo "$l_tuto_3" ?></td>
94
	</tr>
119
	</tr>
95
	<tr>
120
	<tr>
96
		<td><?php echo "$l_tuto_4" ?></td>
121
		<td><?php echo "$l_tuto_4" ?></td>
97
	</tr>
122
	</tr>
-
 
123
	<tr>
-
 
124
		<td colspan="2"><?php echo "$l_tuto_5" ?></td>
-
 
125
	</tr>
98
</table>
126
</table>
99
</div>
127
</div>
100
<?php
128
<?php
101
 
129
 
102
require('/etc/freeradius-web/config.php');
130
require('/etc/freeradius-web/config.php');
103
 
131
 
104
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
132
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
105
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
133
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
106
else{
134
else{
107
	echo "<b>Could not include SQL library</b>\n";
135
	echo "<b>Could not include SQL library</b>\n";
108
	exit();
136
	exit();
109
}
137
}
110
 
138
 
111
 
139
 
112
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
140
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
113
 
141
 
114
if(mysqli_connect_errno())
142
if(mysqli_connect_errno())
115
{
143
{
116
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
144
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
117
}
145
}
118
 
146
 
119
$result = mysqli_query($con, "SELECT * 
147
$result = mysqli_query($con, "SELECT * 
120
				FROM `SMS_ban_perm` 
148
				FROM `SMS_ban_perm` 
121
				ORDER BY date_add DESC
149
				ORDER BY date_add DESC;");
122
				LIMIT 0,30;");
-
 
123
 
150
?>
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
 
151
 
-
 
152
<table id="table_id" class="display">
-
 
153
    <thead>
-
 
154
        <tr>
-
 
155
            <th><b><?php echo $l_num_num; ?></b></th>
-
 
156
			<th><b><?php echo $l_num_raison; ?></b></th>
-
 
157
			<th><b><?php echo $l_num_expiration; ?></b></th>
-
 
158
        </tr>
-
 
159
    </thead>
-
 
160
    <tbody>
-
 
161
<?php 
132
while($row = mysqli_fetch_array($result))
162
while($row = mysqli_fetch_array($result))
133
{
163
{
134
	$start = substr($row['SenderNumber'], 0, 5);
164
	$start = substr($row['SenderNumber'], 0, 3);
135
	$end = substr($row['SenderNumber'], -3);
165
	$end = substr($row['SenderNumber'], -5);
136
	echo "	
166
	echo "	
137
		<tr>
167
		<tr>
138
		<td>".$start."****".$end."</td>";
168
		<td>".$start."****".$end."</td>";
139
	
169
	
140
	if($row['Perm']=='0')
170
	if($row['Perm']=='0')
141
	{
171
	{
142
		echo "<td>$l_num_exist</td>";
172
		echo "<td>$l_num_exist</td>";
143
	}
173
	}
144
	if($row['Perm']=='1')
174
	if($row['Perm']=='1')
145
	{
175
	{
146
		echo "<td>$l_num_flood</td>";
176
		echo "<td>$l_num_flood</td>";
147
	}
177
	}
148
	echo "	<td>" . $row['Expiration']. "</td>
178
	echo "	<td>" . $row['Expiration']. "</td>
149
		</tr>";
179
		</tr>";
150
}
180
}
151
 
-
 
152
if (isset($_POST['number']))
-
 
153
{
-
 
154
	$num = mysqli_real_escape_string($con, $_POST['number']);
-
 
155
	echo "<tr>";
-
 
156
	if($num!=""){
-
 
157
		if(preg_match('#^\+#', $num) == 1)
-
 
158
		{
-
 
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']=="")
-
 
163
			{
-
 
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>";	
-
 
175
			}
-
 
176
		} else {
-
 
177
			echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_invalid</font></b></td>";
-
 
178
		}
-
 
179
	} else {	
-
 
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
?>
181
?>
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>
182
    </tbody>
194
	</tr>
-
 
195
	<tr>
-
 
196
	<td colspan=\"2\"><?php echo $l_help_s; ?></td>
-
 
197
	</tr>
-
 
198
</table>
183
</table>
199
 
184
 
200
 
-
 
-
 
185
<?php mysqli_close($con); ?>
201
<br />
186
<br />
202
</div>
187
</div>
203
</center>
188
</center>
204
</body>
189
</body>
205
</html>
190
</html>
206
 
191