Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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