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 |
?>
|
|
|
23 |
<!DOCTYPE HTML>
|
|
|
24 |
<HTML><!-- written by Rexy -->
|
|
|
25 |
<head>
|
|
|
26 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
27 |
<title>Auto enregistrement</title>
|
|
|
28 |
<link rel="stylesheet" href="/css/style_intercept.css">
|
|
|
29 |
<style type=text/css"></style>
|
|
|
30 |
</head>
|
|
|
31 |
<body>
|
|
|
32 |
<?
|
|
|
33 |
# Choice of language
|
|
|
34 |
$Language = 'en';
|
|
|
35 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
|
|
36 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
37 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
|
|
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 |
$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
|
|
|
47 |
$l_num_empty = "Le champ de recherche est vide.";
|
|
|
48 |
$l_num_recherche = "Rechercher votre numéro:";
|
|
|
49 |
|
|
|
50 |
$l_recherche = "Rechercher";
|
|
|
51 |
|
|
|
52 |
$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
|
|
|
53 |
$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é):";
|
|
|
54 |
$l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
|
|
|
55 |
$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. Seul les 30 dernier numéros peuvent être affichés. Un champ de recherche est néanmoins disponible.";
|
|
|
56 |
}
|
|
|
57 |
else {
|
|
|
58 |
|
|
|
59 |
}
|
|
|
60 |
?>
|
|
|
61 |
<center>
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
<div id="logon">
|
|
|
65 |
<h1><?php echo "$organisme" ?></h1>
|
|
|
66 |
<h2><?php echo "$l_title" ?></h2>
|
|
|
67 |
<div>
|
|
|
68 |
<table id="boite-info">
|
|
|
69 |
<tr>
|
|
|
70 |
<td rowspan="6" width="20%"><img id="logo-organ" src="/images/organisme.png"></td>
|
|
|
71 |
</tr>
|
|
|
72 |
<tr>
|
|
|
73 |
<td><?php echo "$l_tuto_1" ?></td>
|
|
|
74 |
</tr>
|
|
|
75 |
<tr>
|
|
|
76 |
<td><?php echo "$l_tuto_2" ?></td>
|
|
|
77 |
</tr>
|
|
|
78 |
|
|
|
79 |
<tr>
|
|
|
80 |
<td align="center">
|
|
|
81 |
<h3>
|
|
|
82 |
<?php
|
|
|
83 |
$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
|
|
|
84 |
echo "$current_num";
|
|
|
85 |
?>
|
|
|
86 |
</h3>
|
|
|
87 |
</td>
|
|
|
88 |
</tr>
|
|
|
89 |
|
|
|
90 |
<tr>
|
|
|
91 |
<td><?php echo "$l_tuto_3" ?></td>
|
|
|
92 |
</tr>
|
|
|
93 |
<tr>
|
|
|
94 |
<td><?php echo "$l_tuto_4" ?></td>
|
|
|
95 |
</tr>
|
|
|
96 |
</table>
|
|
|
97 |
</div>
|
|
|
98 |
<?php
|
|
|
99 |
|
|
|
100 |
require('/etc/freeradius-web/config.php');
|
|
|
101 |
|
|
|
102 |
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
|
|
|
103 |
include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
|
|
|
104 |
else{
|
|
|
105 |
echo "<b>Could not include SQL library</b>\n";
|
|
|
106 |
exit();
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
|
|
|
111 |
|
|
|
112 |
if(mysqli_connect_errno())
|
|
|
113 |
{
|
|
|
114 |
echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
$result = mysqli_query($con, "SELECT *
|
|
|
118 |
FROM `SMS_ban_perm`
|
|
|
119 |
ORDER BY date_add DESC
|
|
|
120 |
LIMIT 0,30;");
|
|
|
121 |
|
|
|
122 |
echo " <br />
|
|
|
123 |
<table id=\"boite-info\" border=\"1\">
|
|
|
124 |
<tr>
|
|
|
125 |
<td><b>$l_num_num</b></td>
|
|
|
126 |
<td><b>$l_num_raison</b></td>
|
|
|
127 |
<td><b>$l_num_expiration</b></td>
|
|
|
128 |
</tr>";
|
|
|
129 |
|
|
|
130 |
while($row = mysqli_fetch_array($result))
|
|
|
131 |
{
|
|
|
132 |
$start = substr($row['SenderNumber'], 0, 3);
|
|
|
133 |
$end = substr($row['SenderNumber'], -3);
|
|
|
134 |
echo "
|
|
|
135 |
<tr>
|
|
|
136 |
<td>".$start."****".$end."</td>";
|
|
|
137 |
|
|
|
138 |
if($row['Perm']=='0')
|
|
|
139 |
{
|
|
|
140 |
echo "<td>$l_num_exist</td>";
|
|
|
141 |
}
|
|
|
142 |
if($row['Perm']=='1')
|
|
|
143 |
{
|
|
|
144 |
echo "<td>$l_num_flood</td>";
|
|
|
145 |
}
|
|
|
146 |
echo " <td>" . $row['Expiration']. "</td>
|
|
|
147 |
</tr>";
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
if (isset($_POST['number']))
|
|
|
151 |
{
|
|
|
152 |
$num = mysqli_real_escape_string($con, $_POST['number']);
|
|
|
153 |
echo "<tr>";
|
|
|
154 |
if($num!=""){
|
|
|
155 |
echo "<td><b>$num</b></td>";
|
|
|
156 |
$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm WHERE SenderNumber='$num';");
|
|
|
157 |
$row = mysqli_fetch_array($result);
|
|
|
158 |
if($row['Perm']=="")
|
|
|
159 |
{
|
|
|
160 |
echo "<td colspan=\"2\"><b><font color=\"red\">$l_num_inconnu</font></b></td>";
|
|
|
161 |
} else {
|
|
|
162 |
if($row['Perm']==0)
|
|
|
163 |
{
|
|
|
164 |
echo "<td><b><font color=\"red\">$l_num_exist</font></b></td>";
|
|
|
165 |
}
|
|
|
166 |
if($row['Perm']==1)
|
|
|
167 |
{
|
|
|
168 |
echo "<td><b><font color=\"red\">$l_num_flood</font></b></td>";
|
|
|
169 |
}
|
|
|
170 |
echo " <td><b>" . $row['Expiration']. "</b></td>";
|
|
|
171 |
}
|
|
|
172 |
} else {
|
|
|
173 |
echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_empty</font></b></td>";
|
|
|
174 |
}
|
|
|
175 |
echo "</tr>";
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
|
|
|
179 |
echo "</table>";
|
|
|
180 |
mysqli_close($con);
|
|
|
181 |
?>
|
|
|
182 |
<table id="boite-info">
|
|
|
183 |
<tr>
|
|
|
184 |
<form action="autoregistrationinfo.php" method="POST">
|
|
|
185 |
<td><?php echo "$l_num_recherche"; ?> <input type="text" name="number" maxlength="10" size="10"> <input type="submit" value="<?php echo "$l_recherche" ?>"></td>
|
|
|
186 |
</form>
|
|
|
187 |
</tr>
|
|
|
188 |
</table>
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
<br />
|
|
|
192 |
</div>
|
|
|
193 |
</center>
|
|
|
194 |
</body>
|
|
|
195 |
</html>
|