Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1348 → Rev 1349

/web/autoregistrationinfo.php
0,0 → 1,195
<?php
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
 
$ouvre=fopen(CONF_FILE,"r");
if($ouvre){
while(!feof ($ouvre))
{
$tampon = fgets($ouvre, 4096);
if(strpos($tampon,"=")!=false)
{
$tmp = explode("=",$tampon);
$conf[$tmp[0]] = $tmp[1];
}
}
} else {
exit("Erreur d'ouverture du fichier".CONF_FILE);
}
fclose($ouvre);
$organisme = trim($conf["ORGANISM"]);
 
?>
<!DOCTYPE HTML>
<HTML><!-- written by Rexy -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Auto enregistrement</title>
<link rel="stylesheet" href="/css/style_intercept.css">
<style type=text/css"></style>
</head>
<body>
<?
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
$l_title = "Page d'auto enregistrement";
$l_num_exist = "Compte actif";
$l_num_flood = "Numéro bloqué: nombre d'essai dépassé.";
 
$l_num_num = "Numero de téléphone";
$l_num_raison = "Etat de votre numéro";
$l_num_expiration = "Expiration du bloquage";
$l_num_inconnu = "Le numero renseigné n'est dans la base de donnée";
$l_num_empty = "Le champ de recherche est vide.";
$l_num_recherche = "Rechercher votre numéro:";
 
$l_recherche = "Rechercher";
 
$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
$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é):";
$l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
$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.";
}
else {
 
}
?>
<center>
 
 
<div id="logon">
<h1><?php echo "$organisme" ?></h1>
<h2><?php echo "$l_title" ?></h2>
<div>
<table id="boite-info">
<tr>
<td rowspan="6" width="20%"><img id="logo-organ" src="/images/organisme.png"></td>
</tr>
<tr>
<td><?php echo "$l_tuto_1" ?></td>
</tr>
<tr>
<td><?php echo "$l_tuto_2" ?></td>
</tr>
 
<tr>
<td align="center">
<h3>
<?php
$current_num = exec("sudo /usr/local/bin/alcasar-sms.sh --numero_alcasar");
echo "$current_num";
?>
</h3>
</td>
</tr>
 
<tr>
<td><?php echo "$l_tuto_3" ?></td>
</tr>
<tr>
<td><?php echo "$l_tuto_4" ?></td>
</tr>
</table>
</div>
<?php
 
require('/etc/freeradius-web/config.php');
 
if (is_file("./pass/sql/drivers/$config[sql_type]/functions.php"))
include_once("./pass/sql/drivers/$config[sql_type]/functions.php");
else{
echo "<b>Could not include SQL library</b>\n";
exit();
}
 
 
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
 
if(mysqli_connect_errno())
{
echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
}
 
$result = mysqli_query($con, "SELECT *
FROM `SMS_ban_perm`
ORDER BY date_add DESC
LIMIT 0,30;");
 
echo " <br />
<table id=\"boite-info\" border=\"1\">
<tr>
<td><b>$l_num_num</b></td>
<td><b>$l_num_raison</b></td>
<td><b>$l_num_expiration</b></td>
</tr>";
 
while($row = mysqli_fetch_array($result))
{
$start = substr($row['SenderNumber'], 0, 3);
$end = substr($row['SenderNumber'], -3);
echo "
<tr>
<td>".$start."****".$end."</td>";
if($row['Perm']=='0')
{
echo "<td>$l_num_exist</td>";
}
if($row['Perm']=='1')
{
echo "<td>$l_num_flood</td>";
}
echo " <td>" . $row['Expiration']. "</td>
</tr>";
}
 
if (isset($_POST['number']))
{
$num = mysqli_real_escape_string($con, $_POST['number']);
echo "<tr>";
if($num!=""){
echo "<td><b>$num</b></td>";
$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm WHERE SenderNumber='$num';");
$row = mysqli_fetch_array($result);
if($row['Perm']=="")
{
echo "<td colspan=\"2\"><b><font color=\"red\">$l_num_inconnu</font></b></td>";
} else {
if($row['Perm']==0)
{
echo "<td><b><font color=\"red\">$l_num_exist</font></b></td>";
}
if($row['Perm']==1)
{
echo "<td><b><font color=\"red\">$l_num_flood</font></b></td>";
}
echo " <td><b>" . $row['Expiration']. "</b></td>";
}
} else {
echo "<td colspan=\"3\"><b><font color=\"red\">$l_num_empty</font></b></td>";
}
echo "</tr>";
}
 
 
echo "</table>";
mysqli_close($con);
?>
<table id="boite-info">
<tr>
<form action="autoregistrationinfo.php" method="POST">
<td><?php echo "$l_num_recherche"; ?> <input type="text" name="number" maxlength="10" size="10"> <input type="submit" value="<?php echo "$l_recherche" ?>"></td>
</form>
</tr>
</table>
 
 
<br />
</div>
</center>
</body>
</html>