Subversion Repositories ALCASAR

Rev

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

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