Subversion Repositories ALCASAR

Rev

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

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