Subversion Repositories ALCASAR

Rev

Details | 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.";
1416 richard 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é):";
1400 richard 49
    $l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
1416 richard 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.";	
1400 richard 51
	$l_tuto_5 = "Le champ de recherche ci-dessous vous permet de rechercher votre numéro suivant les 5 derniers chiffres.";	
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
 
72
	$l_tuto_1 = "Welcome";
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) :";
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.";
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) :";
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.";
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>
1387 richard 197
	<tr>
198
		<td colspan="2"><?php echo "$l_tuto_5" ?></td>
199
	</tr>
1349 richard 200
</table>
201
</div>
202
<?php
203
 
204
require('/etc/freeradius-web/config.php');
205
 
206
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
207
	include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
208
else{
209
	echo "<b>Could not include SQL library</b>\n";
210
	exit();
211
}
212
 
213
 
214
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
215
 
216
if(mysqli_connect_errno())
217
{
218
	echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
219
}
220
 
221
$result = mysqli_query($con, "SELECT * 
222
				FROM `SMS_ban_perm` 
1387 richard 223
				ORDER BY date_add DESC;");
224
?>
1452 richard 225
<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' ><?php echo $l_autorefresh; ?></input>
1387 richard 226
<table id="table_id" class="display">
227
    <thead>
228
        <tr>
229
            <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_expiration; ?></b></th>
232
        </tr>
233
    </thead>
234
    <tbody>
235
<?php 
1349 richard 236
while($row = mysqli_fetch_array($result))
237
{
1387 richard 238
	$start = substr($row['SenderNumber'], 0, 3);
239
	$end = substr($row['SenderNumber'], -5);
1349 richard 240
	echo "	
241
		<tr>
242
		<td>".$start."****".$end."</td>";
243
 
244
	if($row['Perm']=='0')
245
	{
246
		echo "<td>$l_num_exist</td>";
247
	}
248
	if($row['Perm']=='1')
249
	{
250
		echo "<td>$l_num_flood</td>";
251
	}
252
	echo "	<td>" . $row['Expiration']. "</td>
253
		</tr>";
254
}
255
?>
1387 richard 256
    </tbody>
1349 richard 257
</table>
258
 
1387 richard 259
<?php mysqli_close($con); ?>
1349 richard 260
<br />
261
</div>
262
</center>
263
</body>
264
</html>