Subversion Repositories ALCASAR

Rev

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

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