Subversion Repositories ALCASAR

Rev

Rev 1416 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1416 Rev 1452
1
<?php
1
<?php
-
 
2
# CHECK IF the SMS service is enable
-
 
3
$service_SMS_status=false;
-
 
4
 
-
 
5
if(!$service_SMS_status){
-
 
6
	header('Location: ./');
-
 
7
}
-
 
8
?>
-
 
9
<?php
2
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
10
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
3
 
11
 
4
$ouvre=fopen(CONF_FILE,"r");
12
$ouvre=fopen(CONF_FILE,"r");
5
if($ouvre){
13
if($ouvre){
6
	while(!feof ($ouvre))
14
	while(!feof ($ouvre))
7
	{
15
	{
8
		$tampon = fgets($ouvre, 4096);
16
		$tampon = fgets($ouvre, 4096);
9
		if(strpos($tampon,"=")!=false)
17
		if(strpos($tampon,"=")!=false)
10
		{
18
		{
11
			$tmp = explode("=",$tampon);
19
			$tmp = explode("=",$tampon);
12
			$conf[$tmp[0]] = $tmp[1];
20
			$conf[$tmp[0]] = $tmp[1];
13
		}
21
		}
14
		
22
		
15
	} 
23
	} 
16
} else {
24
} else {
17
	exit("Erreur d'ouverture du fichier".CONF_FILE);
25
	exit("Erreur d'ouverture du fichier".CONF_FILE);
18
}
26
}
19
fclose($ouvre);
27
fclose($ouvre);
20
$organisme = trim($conf["ORGANISM"]);
28
$organisme = trim($conf["ORGANISM"]);
21
 
29
 
22
?>
30
?>
23
<?
31
<?
24
# Choice of language
32
# Choice of language
25
$Language = 'en';
33
$Language = 'en';
26
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
34
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
27
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
35
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
28
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
36
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
29
  
37
  
30
if($Language == 'fr'){
38
if($Language == 'fr'){
31
	$l_title = "Page d'auto enregistrement";
39
	$l_title = "Page d'auto enregistrement";
32
	$l_num_exist = "Compte actif";
40
	$l_num_exist = "Compte actif";
33
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
41
	$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
34
 
42
 
35
	$l_num_num = "Numero de téléphone";
43
	$l_num_num = "Numero de téléphone";
36
	$l_num_raison = "Etat de votre numéro";
44
	$l_num_raison = "Etat de votre numéro";
37
	$l_num_expiration = "Expiration du bloquage";
45
	$l_num_expiration = "Expiration du bloquage";
38
 
46
 
39
	$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
47
	$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
40
	$l_tuto_2 = "Le portail auquel vous essayez de vous connecter offre la possibilité de s'inscrire automatiquement, en envoyant votre mot de passe par SMS au numéro (prix d'un SMS, non surtaxé):";
48
	$l_tuto_2 = "Le portail auquel vous essayez de vous connecter offre la possibilité de s'inscrire automatiquement, en envoyant votre mot de passe par SMS au numéro (prix d'un SMS, non surtaxé):";
41
    $l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
49
    $l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
42
	$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 blocage de ce dernier.";	
50
	$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 blocage de ce dernier.";	
43
	$l_tuto_5 = "Le champ de recherche ci-dessous vous permet de rechercher votre numéro suivant les 5 derniers chiffres.";	
51
	$l_tuto_5 = "Le champ de recherche ci-dessous vous permet de rechercher votre numéro suivant les 5 derniers chiffres.";	
44
 
52
 
45
	$l_tab_first = "premier";
53
	$l_tab_first = "premier";
46
	$l_tab_last = "dernier";
54
	$l_tab_last = "dernier";
47
	$l_tab_next = "suivant";
55
	$l_tab_next = "suivant";
48
	$l_tab_prev = "précédent";
56
	$l_tab_prev = "précédent";
49
	$l_tab_search = "Recherche :";
57
	$l_tab_search = "Recherche :";
50
	$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
58
	$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
51
	$l_tab_info = "Montrer _MENU_ résultats par page";
59
	$l_tab_info = "Montrer _MENU_ résultats par page";
52
	$l_tab_infoempty = "Aucun résultat";
60
	$l_tab_infoempty = "Aucun résultat";
-
 
61
	$l_autorefresh = "Rafraichissement : 10 sec";
53
	
62
	
54
} elseif($Language == 'en'){
63
} elseif($Language == 'en'){
55
	$l_title = "Autoregistration";
64
	$l_title = "Autoregistration";
56
	$l_num_exist = "Account enables";
65
	$l_num_exist = "Account enables";
57
	$l_num_flood = "Phone number banned: Number of trial exceeded.";
66
	$l_num_flood = "Phone number banned: Number of trial exceeded.";
58
 
67
 
59
	$l_num_num = "Phone number";
68
	$l_num_num = "Phone number";
60
	$l_num_raison = "Status of your phone number";
69
	$l_num_raison = "Status of your phone number";
61
	$l_num_expiration = "Expiration";
70
	$l_num_expiration = "Expiration";
62
 
71
 
63
	$l_tuto_1 = "Welcome";
72
	$l_tuto_1 = "Welcome";
64
	$l_tuto_2 = "You can have an acces to the Internet if you send a password via SMS to this phone number (no surcharge) :";
73
	$l_tuto_2 = "You can have an acces to the Internet if you send a password via SMS to this phone number (no surcharge) :";
65
    $l_tuto_3 = "Just send 1 word in your SMS.";
74
    $l_tuto_3 = "Just send 1 word in your SMS.";
66
	$l_tuto_4 = "If your registration is a success or a failure, you can find the raison in the table bellow.";
75
	$l_tuto_4 = "If your registration is a success or a failure, you can find the raison in the table bellow.";
67
	$l_tuto_5 = "You can search your phone number according to the 5 last digits in your phone number.";	
76
	$l_tuto_5 = "You can search your phone number according to the 5 last digits in your phone number.";	
68
	
77
	
69
	$l_tab_first = "first";
78
	$l_tab_first = "first";
70
	$l_tab_last = "last";
79
	$l_tab_last = "last";
71
	$l_tab_next = "next";
80
	$l_tab_next = "next";
72
	$l_tab_prev = "previous";
81
	$l_tab_prev = "previous";
73
	$l_tab_search = "Search :";
82
	$l_tab_search = "Search :";
74
	$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
83
	$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
75
	$l_tab_info = "Show _MENU_ entries";
84
	$l_tab_info = "Show _MENU_ entries";
76
	$l_tab_infoempty = "No matching records found";
85
	$l_tab_infoempty = "No matching records found";
77
	
86
	
-
 
87
	$l_autorefresh = "Rafraichissement : 10 sec";
-
 
88
	
78
} else {
89
} else {
79
 
90
 
80
	$l_title = "Autoregistration";
91
	$l_title = "Autoregistration";
81
	$l_num_exist = "Account enables";
92
	$l_num_exist = "Account enables";
82
	$l_num_flood = "Phone number banned: Number of trial exceeded.";
93
	$l_num_flood = "Phone number banned: Number of trial exceeded.";
83
 
94
 
84
	$l_num_num = "Phone number";
95
	$l_num_num = "Phone number";
85
	$l_num_raison = "Status of your phone number";
96
	$l_num_raison = "Status of your phone number";
86
	$l_num_expiration = "Expiration";
97
	$l_num_expiration = "Expiration";
87
 
98
 
88
	$l_tuto_1 = "Welcome";
99
	$l_tuto_1 = "Welcome";
89
	$l_tuto_2 = "You can have an acces to the Internet if you send a password via SMS to this phone number (no surcharge) :";
100
	$l_tuto_2 = "You can have an acces to the Internet if you send a password via SMS to this phone number (no surcharge) :";
90
    $l_tuto_3 = "Just send 1 word in your SMS.";
101
    $l_tuto_3 = "Just send 1 word in your SMS.";
91
	$l_tuto_4 = "If your registration is a success or a failure, you can find the raison in the table bellow.";
102
	$l_tuto_4 = "If your registration is a success or a failure, you can find the raison in the table bellow.";
92
	$l_tuto_5 = "You can search your phone number according to the 5 last digits in your phone number.";	
103
	$l_tuto_5 = "You can search your phone number according to the 5 last digits in your phone number.";	
93
	
104
	
94
	$l_tab_first = "first";
105
	$l_tab_first = "first";
95
	$l_tab_last = "last";
106
	$l_tab_last = "last";
96
	$l_tab_next = "next";
107
	$l_tab_next = "next";
97
	$l_tab_prev = "previous";
108
	$l_tab_prev = "previous";
98
	$l_tab_search = "Search :";
109
	$l_tab_search = "Search :";
99
	$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
110
	$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
100
	$l_tab_info = "Show _MENU_ entries";
111
	$l_tab_info = "Show _MENU_ entries";
101
	$l_tab_infoempty = "No matching records found";
112
	$l_tab_infoempty = "No matching records found";
-
 
113
	
-
 
114
	$l_autorefresh = "Refresh : 10 sec";
102
}
115
}
103
?>
116
?>
104
<!DOCTYPE HTML>
117
<!DOCTYPE HTML>
105
<HTML><!-- written by Rexy -->
118
<HTML><!-- written by Rexy -->
106
<head>
119
<head>
107
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
120
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
108
<title>Auto enregistrement</title>
121
<title>Auto enregistrement</title>
109
<link rel="stylesheet" href="/css/style_intercept.css">
122
<link rel="stylesheet" href="/css/style_intercept.css">
110
<style type=text/css"></style>
123
<style type=text/css"></style>
111
<!-- DataTables CSS -->
124
<!-- DataTables CSS -->
112
<link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.css">
125
<link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.css">
113
<!-- jQuery -->
126
<!-- jQuery -->
114
<script type="text/javascript" charset="utf8" src="../js/jquery.js"></script>
127
<script type="text/javascript" charset="utf8" src="../js/jquery.js"></script>
115
<!-- DataTables -->
128
<!-- DataTables -->
116
<script type="text/javascript" charset="utf8" src="../js/jquery.dataTables.js"></script>
129
<script type="text/javascript" charset="utf8" src="../js/jquery.dataTables.js"></script>
117
<script type="text/javascript">
130
<script type="text/javascript">
-
 
131
function timedRefresh(timeoutPeriod) {
-
 
132
    var interval = setInterval(refreshPage, timeoutPeriod);
-
 
133
}
-
 
134
 
-
 
135
function refreshPage() {
-
 
136
    if ($("input[name=autoRefreshCheckboxes]").is(":checked")) {
-
 
137
        location.reload(true);
-
 
138
    }
-
 
139
}
-
 
140
 
118
$(document).ready( function () {
141
$(document).ready( function () {
119
    $('#table_id').DataTable({
142
    $('#table_id').DataTable({
120
		"language": {
143
		"language": {
121
			"paginate": {
144
			"paginate": {
122
			"sFirst": "<?php echo $l_tab_dirst; ?>",
145
			"sFirst": "<?php echo $l_tab_first; ?>",
123
			"sLast": "<?php echo $l_tab_last; ?>",
146
			"sLast": "<?php echo $l_tab_last; ?>",
124
			"sPrevious": "<?php echo $l_tab_prev; ?>",
147
			"sPrevious": "<?php echo $l_tab_prev; ?>",
125
			"sNext": "<?php echo $l_tab_next; ?>"
148
			"sNext": "<?php echo $l_tab_next; ?>"
126
			},
149
			},
127
            "lengthMenu": "<?php echo $l_tab_info; ?>",
150
            "lengthMenu": "<?php echo $l_tab_info; ?>",
128
            "zeroRecords": "<?php echo $l_tab_infoempty; ?>",
151
            "zeroRecords": "<?php echo $l_tab_infoempty; ?>",
129
            "info": "<?php echo $l_tab_pmenu; ?>",
152
            "info": "<?php echo $l_tab_pmenu; ?>",
130
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
153
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
131
			"sSearch": "<?php echo $l_tab_search; ?>"
154
			"sSearch": "<?php echo $l_tab_search; ?>"
132
        }
155
        }
133
	});
156
	});
134
} );
157
} );
135
</script>
158
</script>
136
</head>
159
</head>
137
<body>
160
<body onload="JavaScript:timedRefresh(10000);">
138
 
161
 
139
<center>
162
<center>
140
 
163
 
141
 
164
 
142
<div id="logon">
165
<div id="logon">
143
<h1><?php echo "$organisme" ?></h1>
166
<h1><?php echo "$organisme" ?></h1>
144
<h2><?php echo "$l_title" ?></h2>
167
<h2><?php echo "$l_title" ?></h2>
145
<div>
168
<div>
146
<table id="boite-info">
169
<table id="boite-info">
147
	<tr>
170
	<tr>
148
		<td rowspan="6" width="30%"><img id="logo-organ" src="/images/organisme.png"></td>
171
		<td rowspan="6" width="30%"><img id="logo-organ" src="/images/organisme.png"></td>
149
	</tr>
172
	</tr>
150
	<tr>
173
	<tr>
151
		<td><?php echo "$l_tuto_1" ?></td>
174
		<td><?php echo "$l_tuto_1" ?></td>
152
	</tr>
175
	</tr>
153
	<tr>
176
	<tr>
154
		<td><?php echo "$l_tuto_2" ?></td>
177
		<td><?php echo "$l_tuto_2" ?></td>
155
	</tr>
178
	</tr>
156
 
179
 
157
	<tr>
180
	<tr>
158
		<td align="center">
181
		<td align="center">
159
			<h3>	
182
			<h3>	
160
			<?php 	
183
			<?php 	
161
				$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
184
				$current_num='XXXXXXXXXX';
162
				echo "$current_num";  
185
				echo "$current_num";
163
			?>
186
			?>
164
			</h3>
187
			</h3>
165
		</td>
188
		</td>
166
	</tr>
189
	</tr>
167
 
190
 
168
	<tr>
191
	<tr>
169
		<td><?php echo "$l_tuto_3" ?></td>
192
		<td><?php echo "$l_tuto_3" ?></td>
170
	</tr>
193
	</tr>
171
	<tr>
194
	<tr>
172
		<td><?php echo "$l_tuto_4" ?></td>
195
		<td><?php echo "$l_tuto_4" ?></td>
173
	</tr>
196
	</tr>
174
	<tr>
197
	<tr>
175
		<td colspan="2"><?php echo "$l_tuto_5" ?></td>
198
		<td colspan="2"><?php echo "$l_tuto_5" ?></td>
176
	</tr>
199
	</tr>
177
</table>
200
</table>
178
</div>
201
</div>
179
<?php
202
<?php
180
 
203
 
181
require('/etc/freeradius-web/config.php');
204
require('/etc/freeradius-web/config.php');
182
 
205
 
183
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
206
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
184
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
207
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
185
else{
208
else{
186
	echo "<b>Could not include SQL library</b>\n";
209
	echo "<b>Could not include SQL library</b>\n";
187
	exit();
210
	exit();
188
}
211
}
189
 
212
 
190
 
213
 
191
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
214
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
192
 
215
 
193
if(mysqli_connect_errno())
216
if(mysqli_connect_errno())
194
{
217
{
195
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
218
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
196
}
219
}
197
 
220
 
198
$result = mysqli_query($con, "SELECT * 
221
$result = mysqli_query($con, "SELECT * 
199
				FROM `SMS_ban_perm` 
222
				FROM `SMS_ban_perm` 
200
				ORDER BY date_add DESC;");
223
				ORDER BY date_add DESC;");
201
?>
224
?>
202
 
-
 
-
 
225
<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' ><?php echo $l_autorefresh; ?></input>
203
<table id="table_id" class="display">
226
<table id="table_id" class="display">
204
    <thead>
227
    <thead>
205
        <tr>
228
        <tr>
206
            <th><b><?php echo $l_num_num; ?></b></th>
229
            <th><b><?php echo $l_num_num; ?></b></th>
207
			<th><b><?php echo $l_num_raison; ?></b></th>
230
			<th><b><?php echo $l_num_raison; ?></b></th>
208
			<th><b><?php echo $l_num_expiration; ?></b></th>
231
			<th><b><?php echo $l_num_expiration; ?></b></th>
209
        </tr>
232
        </tr>
210
    </thead>
233
    </thead>
211
    <tbody>
234
    <tbody>
212
<?php 
235
<?php 
213
while($row = mysqli_fetch_array($result))
236
while($row = mysqli_fetch_array($result))
214
{
237
{
215
	$start = substr($row['SenderNumber'], 0, 3);
238
	$start = substr($row['SenderNumber'], 0, 3);
216
	$end = substr($row['SenderNumber'], -5);
239
	$end = substr($row['SenderNumber'], -5);
217
	echo "	
240
	echo "	
218
		<tr>
241
		<tr>
219
		<td>".$start."****".$end."</td>";
242
		<td>".$start."****".$end."</td>";
220
	
243
	
221
	if($row['Perm']=='0')
244
	if($row['Perm']=='0')
222
	{
245
	{
223
		echo "<td>$l_num_exist</td>";
246
		echo "<td>$l_num_exist</td>";
224
	}
247
	}
225
	if($row['Perm']=='1')
248
	if($row['Perm']=='1')
226
	{
249
	{
227
		echo "<td>$l_num_flood</td>";
250
		echo "<td>$l_num_flood</td>";
228
	}
251
	}
229
	echo "	<td>" . $row['Expiration']. "</td>
252
	echo "	<td>" . $row['Expiration']. "</td>
230
		</tr>";
253
		</tr>";
231
}
254
}
232
?>
255
?>
233
    </tbody>
256
    </tbody>
234
</table>
257
</table>
235
 
258
 
236
<?php mysqli_close($con); ?>
259
<?php mysqli_close($con); ?>
237
<br />
260
<br />
238
</div>
261
</div>
239
</center>
262
</center>
240
</body>
263
</body>
241
</html>
264
</html>
242
 
265