Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2991 → Rev 2992

/scripts/patch/alcasar-freeradius-up.sh
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
Deleted: svn:executable
-*
\ No newline at end of property
/scripts/alcasar-mail-install-V2.sh
1,15 → 1,13
#!/bin/bash
 
##############################################################################################################################
##
## ALCASAR SERVICE MAIL INSTALL
##
## Script by joss_p
## V 1.0 Dec 2021.
## This script configure the mail conf file and execute the fonfiguration from the acc.
##
##
##############################################################################################################################
###########################################################################################
##
## ALCASAR SERVICE MAIL INSTALL
##
## Script by joss_p
## This script configure the mail conf file and execute the configuration from the acc.
##
###########################################################################################
 
#. /usr/local/etc/alcasar-mail.conf
 
63,8 → 61,6
done
fi
 
 
 
if [[ $TYPE_MAIL -eq 2 ]]; then
echo "relayhost = [${smtp}]:${port}" >> /etc/postfix/main.cf
elif [[ $TYPE_MAIL -eq 3 ]]; then
79,7 → 75,6
echo "Erreur ! Aucun type de messagerie sélectionné !"
exit 0
fi
 
old_smtpIP=`grep "SMTP_IP=" /usr/local/etc/alcasar-iptables-local.sh | cut -d "'" -f2`
old_port=`grep "SMTP_PORT=" /usr/local/etc/alcasar-iptables-local.sh | cut -d "=" -f2 | cut -f1`
sed -ie "/SMTP_IP=/ s@${old_smtpIP}@${smtpIP}@" /usr/local/etc/alcasar-iptables-local.sh
89,5 → 84,4
#chmod 740 /usr/local/etc/alcasar-iptables-local.sh
#chmod 700 /usr/local/bin/alcasar-iptables.sh
bash /usr/local/bin/alcasar-iptables.sh
 
exit 0
/web/autoregistrationinfo.php
File deleted
Property changes:
Deleted: svn:keywords
-Id
\ No newline at end of property
/web/acc/manager/htdocs/user_by_email_v2.php
File deleted
/web/acc/manager/htdocs/user_by_email.php
1,102 → 1,28
<?php
/* written by K@M3L & joss_p & Rexy */
# $Id: mail.php 2853 2020-07-19 21:50:07Z joss_p $
 
// partie $_POST du service mail
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
if(!empty($_POST)){
var_dump($_POST);
// contient les options et les arguments au configurateur
$optArg = "";
if(!empty($_POST['testConf'])){
$optArg .= " -".trim($_POST['testConf']);
}
if(!empty($_POST['smtp'])){
$optArg .= " -s \"".trim($_POST['smtp'])."\"";
}
if(!empty($_POST['port'])){
$optArg .= " -p \"".trim($_POST['port'])."\"";
}
if(!empty($_POST['smtpPort'])){
$smtpPort = explode(" ", $_POST['smtpPort']);
$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
}
if(!empty($_POST['smtpIP'])){
$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
}
if(!empty($_POST['mailAddr'])){
$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
}
if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
} else {
echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
}
}
if(!empty($_POST['adminMail'])){
$optArg .= " -a \"".$_POST['adminMail']."\"";
}
if(!empty($_POST['wld'])){
$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
}
/* written by Joss_p & Rexy */
/****************************************************************
* GLOBAL FILE PATHS *
*****************************************************************/
define('CONF_FILE', '/usr/local/etc/alcasar-mail.conf');
 
// Supprimer la WLD ou l'email de l'admin
if(!empty($_POST['unset'])){
exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
/****************************************************************
* FILE reading test *
*****************************************************************/
$conf_files = array(CONF_FILE);
foreach ($conf_files as $file) {
if (!file_exists($file)) {
exit("Fichier $file non présent");
}
 
// Supprimer toute la configuration actuelle
if(!empty($_POST['uninstall'])){
// echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
if (!is_readable($file)) {
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
}
if(!empty($optArg)){
echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
}
// à décommenté une fois tests et debugs réalisé pour recharger la page sans le $_POST
// header("Location:services.php");
 
}// Fin de la partie $_POST du service mail
 
 
# 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_reboot = "Relancer le système";
} else if($Language == 'es') {
$l_reboot = "Reiniciar el sistema";
} else {
$l_reboot = "Restart the system";
}
 
/****************************************************************
* CONST *
* Read CONF_FILE *
*****************************************************************/
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
 
/********************************************************
* CONF FILE test *
*********************************************************/
if (!file_exists(CONF_FILE)){
exit("Fichier de configuration ".CONF_FILE." non présent");
}
if (!is_readable(CONF_FILE)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
}
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
110,398 → 36,372
}
fclose($file_conf);
 
/****************
* MAIN *
*****************/
/****************************************
* 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_mail_title = "Authentification externe : Adresse mail";
$l_mail_auth_enable_label = "Activer l'authentification par mail :";
$l_mail_YES = "OUI";
$l_mail_NO = "NON";
} else {
$l_mail_title = "External authentication : Address mail";
$l_mail_auth_enable_label = "Enable email authentication :";
$l_mail_YES = "YES";
$l_mail_NO = "NO";
}
 
?><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $l_services_title; ?></title>
<link rel="stylesheet" href="/css/acc.css" type="text/css">
<script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
<?php
// Mail configuration params
$mail_status = $conf['MAIL'];
$mail_type = $conf['TYPE_MAIL'];
$mail_address_mail = $conf['mailAddr'];
$mail_smtp = $conf['smtp'];
$mail_port = $conf['port'];
$mail_address_ip = $conf['mailIP'];
$mail_server = "";
$mail_password_mail = "";
$mail_password_mail_2 = "";
$admin_address = $conf['adminMail'];
$mail_whitelist = $conf['whiteDomain'];
 
echo <<<EOT
 
<div class="panel">
<div class="panel-header">POSTFIX actuelle Configuration</div>
<div class="panel-row">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
if(isset($_POST['submit'])){
if($_POST['auth_enable'] === '1')
{
exec("systemctl start postfix");
 
EOT;
$mail_status = $_POST['auth_enable'];
$mail_type = $_POST['mail_type'];
$mail_address = $_POST['mail_address'];
$mail_ip = $_POST['mail_ip'];
$mail_server = $_POST['mail_server'];
$mail_mdp = $_POST['mail_mdp'];
$mail_mdp2 = $_POST['mail_mdp2'];
$admin_enable = $_POST['admin_enable'];
$admin_address = $_POST['admin_address'];
$mail_whitelist = $_POST['mail_whitelist'];
// exec("cp /var/www/mail/header.php /var/www/html");
// exec("cp /var/www/mail/inscription.php /var/www/html");
// exec("cp /var/www/mail/inscription_traitement.php /var/www/html");
// exec("cp /var/www/html/acc/admin/services.php /var/www/html/acc/admin/services.php.origin");
// exec("cp /var/www/mail/services.php /var/www/html/acc/admin");
 
// la conf actuelle, si le fichier alcasar-mail.conf est présent
$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
if (is_file ($alcasarMailConf)){
 
$tab=file($alcasarMailConf);
 
if ($tab){
foreach ($tab as $line) {
 
$field=explode("=", $line);
 
switch ($field[0]) {
case 'smtp':
$smtp = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP : </b>$smtp</td>
</tr>
EOT;
break;
case 'port':
$port = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Port : </b>$port</td>
</tr>
EOT;
break;
case 'smtpIP':
$smtpIP = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP ip : </b>$smtpIP</td>
</tr>
EOT;
break;
case 'mailAddr':
$mailAddr = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Email Addr : </b>$mailAddr</td>
</tr>
EOT;
break;
case 'adminMail':
$adminMail = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Admin email : </b>$adminMail</td>
</tr>
EOT;
break;
case 'whiteDomain':
$whiteDomain = explode(" ", trim($field[1]));
break;
}
if ($mail_mdp == $mail_mdp2) {
switch ($mail_server) {
case '1':
$mail_smtp = "smtp.orange.fr";
$mail_port = 465;
break;
case '2':
$mail_smtp = "smtp.live.com";
$mail_port = 587;
break;
case '3':
$mail_smtp = "smtp.office365.com";
$mail_port = 587;
break;
case '4':
$mail_smtp = "smtp.sfr.fr";
$mail_port = 465;
break;
case '5':
$mail_smtp = "smtp.free.fr";
$mail_port = 465;
break;
case '6':
$mail_smtp = "smtp.gmail.com";
$mail_port = 587;
break;
case '7':
$mail_smtp = "smtp.laposte.net";
$mail_port = 465;
break;
case '8':
$mail_smtp = "smtp.bbox.fr";
$mail_port = 587;
break;
default:
echo "Erreur dans la saisie !";
break;
}
file_put_contents(CONF_FILE, str_replace('MAIL='.$conf['MAIL'],'MAIL='.$mail_status,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('TYPE_MAIL='.$conf['TYPE_MAIL'],'TYPE_MAIL='.$mail_type,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailAddr='.$conf['mailAddr'],'mailAddr='.$mail_address,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailIP='.$conf['mailIP'],'mailIP='.$mail_ip,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('smtp='.$conf['smtp'],'smtp='.$mail_smtp,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('whiteDomain='.$conf['mail_whitelist'],'whiteDomain='.$mail_whitelist,file_get_contents(CONF_FILE)));
if (isset($admin_address)) {
file_put_contents(CONF_FILE, str_replace('adminMail='.$conf['admin_address'],'adminMail='.$admin_address,file_get_contents(CONF_FILE)));
}
switch ($mail_type) {
case '1':
$mail_port = 25;
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -a $admin_address -w $mail_whitelist");
}
}
echo <<<EOT
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="uninstall" value="uninstall">
<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
</td>
</tr>
</form>
<tr align="center">
<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
 
</td>
</tr>
EOT;
// si le fichier alcasar-mail.conf n'existe pas
} else {
 
echo <<<EOT
<tr align="center">
<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
</tr>
EOT;
 
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -w $mail_whitelist");
}
break;
case '2':
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -w $mail_whitelist");
}
break;
case '3':
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
}
break;
default:
echo "Erreur dans la saisie !";
break;
}
 
// Partie de paramétrage de la configuration
 
// Configuration de l'adresse email de l'administrateur
echo <<<EOT
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">POSTFIX Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
</tr>
</table><br>
</div>
<div class="myDiv hide" id="showOne">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><b>Serveur mail est autonome :</b></td>
</tr>
<tr align="center">
<td>
<form action="$php_self" method="post">
<input type="hidden" name="testConf" value="1">
<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
</form>
</td>
</tr>
</table>
</div>
 
<div class="myDiv hide" id="showTwo">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>SMTP Relais :</b></td>
</tr>
<tr align="center">
<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
</tr>
<tr>
<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
</tr>
<tr>
<td><label>Enterez le port SMTP</label></td>
<td><input type="text" name="port" placeholder="port" required/></td>
</tr>
<tr>
<td><label>Enterez l'IP du serveur SMTP relais (0.0.0.0/0 si c'est dynamique/par défaut si vide)</label></td>
<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="hidden" name="testConf" value="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
</table><br>
</div>
 
<div class="myDiv hide" id="showThree">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form method="post" action="$php_self">
<tr colspan="2" align="center">
<td><b>Configuration de serveur mail via un compte email :</b></td>
</tr>
<tr align="center">
<td>
<table class="table table-striped">
<tr>
<td><label>Entez votre email</label></td>
<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
</tr>
<tr>
<td><label>Entez le mot de passe</label></td>
<td><input type="password" id="pswd1" name="pswd1" required/></td>
</tr>
<tr>
<td><label>Confirmer le mot de passe</label></td>
<td><input type="password" id="pswd2" name="pswd2" required/></td>
</tr>
 
</table>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">compte de messagerie</th>
<th scope="col">adresse de messagerie</th>
<th scope="col">serveur sortant</th>
<th scope="col">port sortant</th>
</tr>
</thead>
<tbody>
EOT;
$smtpsConf = [
["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
["Free", "Free", "free.fr", "smtp.free.fr", 465],
["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
];
 
foreach( $smtpsConf as $smtpConf ) {
echo <<< EOT
<tr>
<th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
 
<td>$smtpConf[1]</td>
<td>$smtpConf[2]</td>
<td>$smtpConf[3]</td>
<td align="center">$smtpConf[4]</td>
</tr>
EOT;
}
echo<<<EOT
<tr>
<th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
<td>Personalisez votre smtp</td>
<td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
<td>Personalisez le port</td>
<td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="center">
<td class="testConf3">
</td>
</tr>
<tr align="center">
<td>
<input type="hidden" name="testConf" value="3">
<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">Mail admin</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>Mail admin</b></td>
</tr>
<tr align="center">
<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
</tr>
<tr>
EOT;
if (empty($adminMail)){
echo "<td><label>Enterez l'adresse email</label></td>";
} else {
echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
}
echo <<<EOT
<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
</tr>
 
<tr align="center">
<td colspan="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="adminMail">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">WhiteList Domains Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
</tr>
<form method="post" action="$php_self">
<tr align="center">
<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
</tr>
<tr align="center">
<td>
<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
EOT;
if(!empty($whiteDomain)){
foreach ($whiteDomain as $domain){
echo "$domain\n";
}
else {
echo "Erreur";
}
}
else {
exec("cp -f /etc/postfix/main.cf.origin /etc/postfix/main.cf");
exec("rm -rf /etc/postfix/sasl/");
exec("cp -f /var/www/mail/alcasar-mail.conf /usr/local/etc/");
exec("systemctl restart postfix");
exec("systemctl stop postfix");
exec("sed -i '/SMTP_IP=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
exec("sed -i '/SMTP_PORT=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
exec("rm -f /var/www/html/header.php");
exec("rm -f /var/www/html/inscription.php");
exec("rm -f /var/www/html/inscription_traitement.php");
exec("cp -f /var/www/html/acc/admin/services.php.origin /var/www/html/acc/admin/services.php");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-iptables.sh");
}
header("Refresh:0");
exit;
}
echo<<<EOT
</textarea>
</td>
</tr>
<tr align="center">
<td colspan="2">
<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="whiteDomain">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
 
EOT;
 
?>
 
<script>
$(document).ready(function(){
$("div.hide").hide();
 
$('#conf input[type="radio"]').click(function(){
var value = $(this).val();
$("div.myDiv").hide();
$("#show"+value).show();
});
 
//On vérifie si le mot de passe est ok
$("#pswd2").keyup(function(){
if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
$(".testConf3").html("<br>Les deux mots de passe sont différents");
$("#testConf3").attr("disabled", true);
} else {
$("#testConf3").attr("disabled", false);
$(".testConf3").fadeOut(800);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?= $l_mail_title ?></title>
<link type="text/css" href="/css/acc.css" rel="stylesheet">
<link type="text/css" href="/css/mail.css" rel="stylesheet">
<script>
function onMailStatusChange() {
var listToDisables1 = ['mail_type','admin_enable','admin_address','mail_whitelist'];
var listToDisables2 = ['mail_server','mail_type','admin_enable','admin_address','mail_whitelist','mail_ip'];
var listToDisables3 = ['mail_server','mail_mdp2','mail_mdp','mail_address','mail_type','admin_enable','admin_address','mail_whitelist'];
var formSubmit = document.querySelector('form input[type="submit"]');
var btn_checkConf = document.getElementById('btn-checkconf');
var isChecked = false;
if (document.getElementById('auth_enable').value === '1') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables1[i]).disabled = true;
}
})
});
 
$('#perso').click(function(){
 
$(".perso").attr("disabled", false);
});
 
$('.blur').click(function(){
 
$(".perso").attr("disabled", true);
});
 
function valPerso(){
var valSmtpPerso = document.getElementById("smtpPerso").value;
var valPortPerso = document.getElementById("portPerso").value;
document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
};
 
function hideShow(x){
$("div." + x).toggle();
var value = $("input." + x).val();
var elem = document.getElementById("btn-" + x);
if (elem.value=="Configurer"){
elem.value = "Annuler";
} else{
elem.value = "Configurer";
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables2[i]).disabled = true;
}
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables3[i]).disabled = true;
}
document.getElementById('mail_type').style.backgroundColor = null;
document.getElementById('mail_type').disabled = false;
if (document.getElementById('mail_type').value === '1') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
document.getElementById(listToDisables1[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
else if (document.getElementById('mail_type').value === '2') {
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = null;
document.getElementById(listToDisables2[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
else if (document.getElementById('mail_type').value === '3') {
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = null;
document.getElementById(listToDisables3[i]).disabled = false;
}
if (document.getElementById('admin_enable').value === '0') {
document.getElementById('admin_address').style.backgroundColor = '#c0c0c0';
document.getElementById('admin_address').disabled = true;
}
}
formSubmit.style.display = null;
btn_checkConf.style.display = 'none';
} else {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables1[i]).disabled = true;
}
for (var i=0; i<listToDisables2.length; i++) {
document.getElementById(listToDisables2[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables2[i]).disabled = true;
}
for (var i=0; i<listToDisables3.length; i++) {
document.getElementById(listToDisables3[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables3[i]).disabled = true;
}
formSubmit.style.display = null;
btn_checkConf.style.display = 'none';
}
};
 
</script>
}
</script>
</head>
<body onLoad="onMailStatusChange();">
<div class="panel">
<div class="panel-header"><?= "Authentication Mail" ?></div>
<div class="panel-body">
<form id="form-config_mail" name="config_mail" method="POST" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
<fieldset>
<legend>
<br>
<div style="text-align: center">
</div>
</legend>
<dl>
<dt>
<label for="auth_enable"><?= "Activer l'authentification par mail :" ?></label>
</dt>
<dd>
<select id="auth_enable" name="auth_enable" onchange="onMailStatusChange();">
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_type"><?= "Type Messagerie" ?></label><br>
<?= "Choississez le type de messagerie a utiliser" ?><br>
</dt>
<dd>
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
<option value=1>Nom de domaine</option>
<option value=2>Serveur mail ou serveur SMTP</option>
<option value=3>Adresse de messagerie</option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_address"><?= "Adresse Messagerie"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address_mail ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_mdp"><?= "Mot de passe Messagerie"?></label><br>
<?= "Mot de passe de la messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_mdp2"><?= "Confirmer Mot de passe Messagerie"?></label><br>
<?= "Confirmer le mot de passe de la messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_server"><?= "CHoix Serveur SMTP" ?></label><br>
<?= "Choissisiez le serveur SMTP correspondant à l'adress de messagerie" ?><br>
</dt>
<dd>
<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
<option value=1>Orange/Wanadoo</option>
<option value=2>Hotmail</option>
<option value=3>Outlook</option>
<option value=4>SFR</option>
<option value=5>Free</option>
<option value=6>Gmail</option>
<option value=7>Laposte</option>
<option value=8>Bouygues</option>
<option value=9>Personnalisé</option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_ip"><?= "IP du serveur SMTP"?></label><br>
<?= "Adresse IP du serveur SMTP utilisé" ?>
</dt>
<dd>
<input type="text" id="mail_ip" size="40" name="mail_ip" value="<?= $mail_address_ip ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="admin_enable"><?= "Activer l'adresse admin :" ?></label>
</dt>
<dd>
<select id="admin_enable" name="admin_enable" onchange="onMailStatusChange();">
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="admin_address"><?= "Adresse Messagerie admin"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="admin_address" size="40" name="admin_address" value="<?= $admin_address ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<dl>
<dt>
<label for="mail_whitelist"><?= "whitelist domaine"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
</dt>
<dd>
<input type="text" id="mail_whitelist" size="40" name="mail_whitelist" value="<?= $mail_whitelist ?>" oninput="onMailStatusChange();">
</dd>
</dl>
<p>
<!--<button id="btn-checkconf" onclick="checkConfig(); return false;"><?= $l_check ?></button>-->
<input id="submit" type="submit" value="<?= $l_mail_submit ?>" name="submit">
</p>
</fieldset>
</form>
</div>
</div>
</body>
</html>
/web/acc/manager/htdocs/user_by_email_v0.php
0,0 → 1,507
<?php
/* written by K@M3L & joss_p & Rexy */
 
// partie $_POST du service mail
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
if(!empty($_POST)){
var_dump($_POST);
// contient les options et les arguments au configurateur
$optArg = "";
if(!empty($_POST['testConf'])){
$optArg .= " -".trim($_POST['testConf']);
}
if(!empty($_POST['smtp'])){
$optArg .= " -s \"".trim($_POST['smtp'])."\"";
}
if(!empty($_POST['port'])){
$optArg .= " -p \"".trim($_POST['port'])."\"";
}
if(!empty($_POST['smtpPort'])){
$smtpPort = explode(" ", $_POST['smtpPort']);
$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
}
if(!empty($_POST['smtpIP'])){
$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
}
if(!empty($_POST['mailAddr'])){
$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
}
if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
} else {
echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
}
}
if(!empty($_POST['adminMail'])){
$optArg .= " -a \"".$_POST['adminMail']."\"";
}
if(!empty($_POST['wld'])){
$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
}
 
// Supprimer la WLD ou l'email de l'admin
if(!empty($_POST['unset'])){
exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
 
// Supprimer toute la configuration actuelle
if(!empty($_POST['uninstall'])){
// echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
 
var_dump($output);
echo "<br>\$retval : " . $retval;
}
if(!empty($optArg)){
echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
var_dump($output);
echo "<br>\$retval : " . $retval;
}
// à décommenté une fois tests et debugs réalisé pour recharger la page sans le $_POST
// header("Location:services.php");
 
}// Fin de la partie $_POST du service mail
 
 
# 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_reboot = "Relancer le système";
} else if($Language == 'es') {
$l_reboot = "Reiniciar el sistema";
} else {
$l_reboot = "Restart the system";
}
 
/****************************************************************
* CONST *
*****************************************************************/
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
 
/********************************************************
* CONF FILE test *
*********************************************************/
if (!file_exists(CONF_FILE)){
exit("Fichier de configuration ".CONF_FILE." non présent");
}
if (!is_readable(CONF_FILE)){
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
}
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
/****************
* MAIN *
*****************/
 
?><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $l_services_title; ?></title>
<link rel="stylesheet" href="/css/acc.css" type="text/css">
<script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
<?php
 
echo <<<EOT
 
<div class="panel">
<div class="panel-header">POSTFIX actuelle Configuration</div>
<div class="panel-row">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
 
EOT;
 
// la conf actuelle, si le fichier alcasar-mail.conf est présent
$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
if (is_file ($alcasarMailConf)){
 
$tab=file($alcasarMailConf);
 
if ($tab){
foreach ($tab as $line) {
 
$field=explode("=", $line);
 
switch ($field[0]) {
case 'smtp':
$smtp = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP : </b>$smtp</td>
</tr>
EOT;
break;
case 'port':
$port = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Port : </b>$port</td>
</tr>
EOT;
break;
case 'smtpIP':
$smtpIP = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>SMTP ip : </b>$smtpIP</td>
</tr>
EOT;
break;
case 'mailAddr':
$mailAddr = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Email Addr : </b>$mailAddr</td>
</tr>
EOT;
break;
case 'adminMail':
$adminMail = trim($field[1]);
echo <<<EOT
<tr align="center">
<td><b>Admin email : </b>$adminMail</td>
</tr>
EOT;
break;
case 'whiteDomain':
$whiteDomain = explode(" ", trim($field[1]));
break;
}
}
}
echo <<<EOT
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="uninstall" value="uninstall">
<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
</td>
</tr>
</form>
<tr align="center">
<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
 
</td>
</tr>
EOT;
// si le fichier alcasar-mail.conf n'existe pas
} else {
 
echo <<<EOT
<tr align="center">
<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
</tr>
EOT;
 
}
 
// Partie de paramétrage de la configuration
 
// Configuration de l'adresse email de l'administrateur
echo <<<EOT
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">POSTFIX Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
</tr>
</table><br>
</div>
<div class="myDiv hide" id="showOne">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td><b>Serveur mail est autonome :</b></td>
</tr>
<tr align="center">
<td>
<form action="$php_self" method="post">
<input type="hidden" name="testConf" value="1">
<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
</form>
</td>
</tr>
</table>
</div>
 
<div class="myDiv hide" id="showTwo">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>SMTP Relais :</b></td>
</tr>
<tr align="center">
<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
</tr>
<tr>
<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
</tr>
<tr>
<td><label>Enterez le port SMTP</label></td>
<td><input type="text" name="port" placeholder="port" required/></td>
</tr>
<tr>
<td><label>Enterez l'IP du serveur SMTP relais (0.0.0.0/0 si c'est dynamique/par défaut si vide)</label></td>
<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="hidden" name="testConf" value="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
</table><br>
</div>
 
<div class="myDiv hide" id="showThree">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form method="post" action="$php_self">
<tr colspan="2" align="center">
<td><b>Configuration de serveur mail via un compte email :</b></td>
</tr>
<tr align="center">
<td>
<table class="table table-striped">
<tr>
<td><label>Entez votre email</label></td>
<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
</tr>
<tr>
<td><label>Entez le mot de passe</label></td>
<td><input type="password" id="pswd1" name="pswd1" required/></td>
</tr>
<tr>
<td><label>Confirmer le mot de passe</label></td>
<td><input type="password" id="pswd2" name="pswd2" required/></td>
</tr>
 
</table>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">compte de messagerie</th>
<th scope="col">adresse de messagerie</th>
<th scope="col">serveur sortant</th>
<th scope="col">port sortant</th>
</tr>
</thead>
<tbody>
EOT;
$smtpsConf = [
["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
["Free", "Free", "free.fr", "smtp.free.fr", 465],
["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
];
 
foreach( $smtpsConf as $smtpConf ) {
echo <<< EOT
<tr>
<th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
 
<td>$smtpConf[1]</td>
<td>$smtpConf[2]</td>
<td>$smtpConf[3]</td>
<td align="center">$smtpConf[4]</td>
</tr>
EOT;
}
echo<<<EOT
<tr>
<th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
<td>Personalisez votre smtp</td>
<td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
<td>Personalisez le port</td>
<td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="center">
<td class="testConf3">
</td>
</tr>
<tr align="center">
<td>
<input type="hidden" name="testConf" value="3">
<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">Mail admin</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2"><b>Mail admin</b></td>
</tr>
<tr align="center">
<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
</tr>
<tr>
EOT;
if (empty($adminMail)){
echo "<td><label>Enterez l'adresse email</label></td>";
} else {
echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
}
echo <<<EOT
<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
</tr>
 
<tr align="center">
<td colspan="2">
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="adminMail">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
<div class="panel">
<div class="panel-header">WhiteList Domains Configuration</div>
<div class="panel-row conf" id="conf">
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
<tr align="center">
<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
</tr>
<form method="post" action="$php_self">
<tr align="center">
<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
</tr>
<tr align="center">
<td>
<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
EOT;
if(!empty($whiteDomain)){
foreach ($whiteDomain as $domain){
echo "$domain\n";
}
}
echo<<<EOT
</textarea>
</td>
</tr>
<tr align="center">
<td colspan="2">
<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
</td>
</tr>
</form>
<form action="$php_self" method="post">
<tr align="center">
<td colspan="2">
<input type="hidden" name="unset" value="whiteDomain">
<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
</td>
</tr>
</form>
</table><br>
</div>
</div><br>
 
EOT;
 
?>
 
<script>
$(document).ready(function(){
$("div.hide").hide();
 
$('#conf input[type="radio"]').click(function(){
var value = $(this).val();
$("div.myDiv").hide();
$("#show"+value).show();
});
 
//On vérifie si le mot de passe est ok
$("#pswd2").keyup(function(){
if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
$(".testConf3").html("<br>Les deux mots de passe sont différents");
$("#testConf3").attr("disabled", true);
} else {
$("#testConf3").attr("disabled", false);
$(".testConf3").fadeOut(800);
}
})
});
 
$('#perso').click(function(){
 
$(".perso").attr("disabled", false);
});
 
$('.blur').click(function(){
 
$(".perso").attr("disabled", true);
});
 
function valPerso(){
var valSmtpPerso = document.getElementById("smtpPerso").value;
var valPortPerso = document.getElementById("portPerso").value;
document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
};
 
function hideShow(x){
$("div." + x).toggle();
var value = $("input." + x).val();
var elem = document.getElementById("btn-" + x);
if (elem.value=="Configurer"){
elem.value = "Annuler";
} else{
elem.value = "Configurer";
}
};
 
</script>
</body>
</html>
/web/acc/manager/htdocs/user_by_sms.php
1,5 → 1,4
<?php
# $Id: autoregistration.php 2915 2021-02-07 22:59:23Z rexy $
 
#Define
$gammu_wrong_port = "";
44,7 → 43,7
{
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
}
55,7 → 54,7
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
$l_title = "Auto enregistrement (SMS)";
$l_title = "Inscription par SMS";
$l_conf = "Configuration";
$l_conf_actu = "Configuration actuelle";
$l_speed = "Vitesse de connexion au MODEM";
121,7 → 120,7
$l_country_advanced_ena = "Autorisation personnalisée";
$l_advance = "Avancé";
} else if($Language == 'es') {
$l_title = "Auto-registro (SMS)";
$l_title = "Registro por SMS";
$l_conf = "Configuración";
$l_conf_actu = "Configuración actual";
$l_speed = "Velocidad de conexión al MODEM";
187,7 → 186,7
$l_country_advanced_ena = "Autorización avanzada";
$l_advance = "Avanzado";
} else {
$l_title = "Auto registration (SMS)";
$l_title = "SMS registration";
$l_conf = "Configuration";
$l_conf_actu = "Current configuration";
$l_speed = "Connection speed to the MODEM";
378,13 → 377,13
exec("sudo $script --stop");
}
}
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST["stop"])){
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
403,7 → 402,7
case "115200":
exec("sudo $script --replace_speed 115200");
break;
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
}
413,7 → 412,7
echo "speed = ".$_POST['port'];
$port = $_POST['port'];
exec("sudo $script --replace_port ".escapeshellarg($port));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
 
427,7 → 426,7
if(preg_match('#^\+#',$num))
{
exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
else
450,7 → 449,7
if(is_numeric($pin))
{
exec("sudo $script --replace_pin ".escapeshellarg($pin));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
else
473,7 → 472,7
if(is_numeric($time_account))
{
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
else
496,7 → 495,7
if(is_numeric($nb_ban_temp))
{
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
else
519,7 → 518,7
if(is_numeric($time_perm))
{
exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
else
542,7 → 541,7
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
}
exec("sudo $script --unlock_num $numero");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
 
551,7 → 550,7
$country=utf8_decode($_POST['country_select']);
exec("sudo $script --change_country ".escapeshellarg($country));
exec("sudo $script --change_country_filter advance");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST['b_france_enable'])){
558,7 → 557,7
exec("sudo $script --change_country_dis_all");
exec("sudo $script --change_country France");
exec("sudo $script --change_country_filter fr");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST['b_ue_enable'])){
569,18 → 568,18
}
exec("sudo $script --change_country_filter ue");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST["b_country_enable"])){
exec("sudo $script --change_country_ena_all");
exec("sudo $script --change_country_filter all");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST["b_country_disable"])){
exec("sudo $script --change_country_dis_all");
header('Location: autoregistration.php');
header('Location: user_by_sms.php');
exit();
}
 
723,7 → 722,7
$gammu_status_off="";
}
 
echo "<form action=\"autoregistration.php\" method=\"post\">
echo "<form action=\"user_by_sms.php\" method=\"post\">
<table border=1>
<tr>
<td colspan=3><b>$l_conf</b></td>
849,7 → 848,7
<td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td>
</tr>
<tr>
<form action="autoregistration.php" method="post">
<form action="user_by_sms.php" method="post">
<td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td>
<td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td>
<td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td>
875,7 → 874,7
{
echo "
<tr>
<form action=\"autoregistration.php\" method=\"post\">
<form action=\"user_by_sms.php\" method=\"post\">
<td>
<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">
".$row['name']."
927,7 → 926,7
{
echo "
<tr>
<form action=\"autoregistration.php\" method=\"post\">
<form action=\"user_by_sms.php\" method=\"post\">
<td>
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
".$row['SenderNumber']."
/web/acc/menu.php
87,8 → 87,8
$l_stat_detail_network = "Trafic détaillé";
$l_security = "Sécurité";
$l_menu = "Menu";
$l_sms = "Utilisateurs par SMS";
$l_mail = "Utilisateurs par e-mail";
$l_sms = "Inscription par SMS";
$l_mail = "Inscription par E-mail";
$l_backup_archive = "Archives";
$l_accountability_logs = "Journaux d'imputabilité";
$l_since = "depuis le :";
119,8 → 119,8
$l_stat_detail_network = "Tráfico detallado";
$l_security = "Seguridad";
$l_menu = "Principal";
$l_sms = "usuarios por sms";
$l_mail = "usuarios por e-mail";
$l_sms = "Registro por sms";
$l_mail = "Registro por E-mail";
$l_backup_archive = "Archivos";
$l_accountability_logs = "registros de responsabilidad";
$l_since = "desde: ";
152,8 → 152,8
$l_stat_detail_network = "Detailed traffic";
$l_security = "Security";
$l_menu = "Main";
$l_sms = "Users by SMS";
$l_mail = "Users by e-mail";
$l_sms = "SMS registration";
$l_mail = "E-mail registration";
$l_backup_archive = "Archives";
$l_accountability_logs = "accountability logs";
$l_since = "since:";
220,7 → 220,7
<li><div class="caret"></div><a href="manager/auth_exceptions.php" target="REXY2">Exceptions</a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_sms.php" target="REXY2"><?= $l_sms ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email.php" target="REXY2"><?= $l_mail ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email_V2.php" target="REXY2"> mail-V2 </a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email_V0.php" target="REXY2"> mail-old </a></li>
 
</ul>
</li>
/web/css/intercept.css
91,7 → 91,7
margin-bottom: 5px;
}
 
.autoregistration_sms {
.sms_registration {
text-align: center;
font-size: calc(10px + 0.3vw);
margin-bottom: 20px;
/web/index.php
153,7 → 153,7
$l_explain_net_pb = "Votre portail détecte que l'accès à Internet est indisponible.";
$l_contact_access_deny = "Contactez le responsable de la séurité (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
$l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">Créer votre compte par SMS</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">Créer votre compte par SMS</a>";
$l_install_certif = "Installer le certificat racine";
$l_category = "catégorie :";
if (!$user->connected) {
192,7 → 192,7
$l_explain_net_pb = "O sistema detectou que o acesso é de risco, não será permitido o acesso";
$l_contact_access_deny = "Entre em contato com o administrador do sistema de segurança se acha que essa filtragem é abusiva.";
$l_contact_net_pb = "Entre em contato com a empresa fornecedora de Internet para mais informações";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">Crie a conta por SMS</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">Crie a conta por SMS</a>";
$l_install_certif = "Instalar Certificado Alcasar AC";
$l_category = "categoria :";
if (!$user->connected) {
231,7 → 231,7
$l_explain_net_pb = "您的门户检测因特网不可用。";
$l_contact_access_deny = "如果您认为该过滤不当,请联系安全负责人(OSSI/RSSI)。";
$l_contact_net_pb = "请联系IT负责人或网络服务商来了解更多信息。";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">通過短信創建您的帳戶</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">通過短信創建您的帳戶</a>";
$l_install_certif = "安装根证书";
$l_category = "类别 :";
if (!$user->connected) {
271,7 → 271,7
$l_contact_access_deny = "المرجو الاتصال بضابط أمن (OSS / RSS) إذا اعتقدت ان هذه التصفية غير قانونية";
$l_contact_net_pb = "المرجو الاتصال بمدير المعلومات أو مورد الأنترنت للمزيد من المعلومات";
$auto_save_sms_text = "تسجيل ذاتي على";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">إنشاء حسابك لا SMS</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">إنشاء حسابك لا SMS</a>";
$l_install_certif = "ركب جذر الشهادة";
$l_category = "فئة :";
if (!$user->connected) {
326,7 → 326,7
$l_explain_net_pb = "Offenbar funktioniert ihr Internetzugriff nicht.";
$l_contact_access_deny = "Kontaktieren Sie ihren Sicherheitsbeauftragten wenn Sie denken dass diese Filterung unangemessen ist.";
$l_contact_net_pb = "Kontaktieren Sie Ihren Netzwerkbeauftragten oder Ihren Internetanbieter für weitere Informationen.";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">Einen Account per SMS erstellen</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">Einen Account per SMS erstellen</a>";
$l_install_certif = "Das ALCASAR AC Zertifikat installieren";
$l_category = "Kategorie:";
if (!$user->connected) {
365,7 → 365,7
$l_explain_net_pb = "El sistema informa que el acceso a Internet no esta disponible.";
$l_contact_access_deny = "Por favor póngase en contacto con el administrador de la red si cree que este filtrado es abusivo";
$l_contact_net_pb = "Póngase en contacto con el responsable de la red o con su proveedor de Internet para obtener más información.";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">Alta de cuenta por SMS</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">Alta de cuenta por SMS</a>";
$l_install_certif = "Instalar certificado ALCASAR AC";
$l_category = "categoría:";
if (!$user->connected) {
404,7 → 404,7
$l_explain_net_pb = "Your portal has just detected that the Internet access is down";
$l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
$l_contact_net_pb = "Contact your network responsive or your Internet provider for further information.";
$l_sms_access = "<a href=\"//$hostname/autoregistrationinfo.php\">Create your account by SMS</a>";
$l_sms_access = "<a href=\"//$hostname/sms_registration.php\">Create your account by SMS</a>";
$l_install_certif = "Install ALCASAR AC Certificate";
$l_category = "category:";
if (!$user->connected) {
/web/intercept.php
112,7 → 112,7
$l_online_time = "Tiempo en linea";
$l_remaining_time = "Tiempo restante";
$l_uam_domain = "Sitios de libre acceso : ";
$l_autoregistration = "Registo autom&aacute;tico";
$l_sms_registration = "Registo autom&aacute;tico";
} else if ($Language === 'pt') { // Portuguese
$l_ChilliError = "A autenticação precisa ser bem sucedida através do portal.";
$l_login = "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
146,7 → 146,7
$l_online_time = "Tempo Online";
$l_remaining_time = "Tempo restante";
$l_uam_domain = "Sítios de acesso livre : ";
$l_autoregistration = "Registo autom&aacute;tico";
$l_sms_registration = "Registo autom&aacute;tico";
} else if ($Language === 'zh') { // Chinese
$l_ChilliError = "验证必须通过强制门户服务";
$l_login = "验证成功<HR>关闭此窗口中断连接";
180,7 → 180,7
$l_online_time = "在线时间";
$l_remaining_time = "剩余时间";
$l_uam_domain = " : ";
$l_autoregistration = "短信注册";
$l_sms_registration = "短信注册";
} else if ($Language === 'ar') { // Arabic
$l_ChilliError = "يجب نجاح المصادقة على البوابة الأسيرة";
$l_login = "إغلاق هذه النافذة يقطع دورة عملك";
214,7 → 214,7
$l_online_time = "مذة الإتصال";
$l_remaining_time = "الوقت المتبق";
$l_uam_domain = "مواقع الوصول المجاني";
$l_autoregistration = "تسجيل ذاتي (SMS)";
$l_sms_registration = "تسجيل ذاتي (SMS)";
} else if ($Language === 'de') { // German
$l_ChilliError = "Sie wurden erfolgreich durch das Portal authentifiziert.";
$l_login = "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die Sitzung";
248,7 → 248,7
$l_online_time = "Online-Zeit";
$l_remaining_time = "Verbleibende Zeit";
$l_uam_domain = "Offen zugängliche Seiten : ";
$l_autoregistration = "Automatische Registrierung";
$l_sms_registration = "Automatische Registrierung";
} else if ($Language === 'nl') { // Dutch
$l_ChilliError = "De authenticatie moet een succes worden via de captive portal dienst.";
$l_login = "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
282,7 → 282,7
$l_online_time = "Online tijd";
$l_remaining_time = "Reterende tijd";
$l_uam_domain = "Sites met open toegang : ";
$l_autoregistration = "Automatische registratie";
$l_sms_registration = "Automatische registratie";
} else if ($Language === 'fr') { // French
$l_ChilliError = "L'authentification doit être réussie sur le portail captif.";
$l_login = "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
316,7 → 316,7
$l_online_time = "Temps de connexion";
$l_remaining_time = "Temps restant";
$l_uam_domain = "Sites en accès libre : ";
$l_autoregistration = "Auto enregistrement (sms)";
$l_sms_registration = "Auto enregistrement (sms)";
} else { // English
$l_ChilliError = "The authentication must be successful through the captive portal service.";
$l_login = "Successful authentication.<HR>Closing this window interrupts your session";
350,7 → 350,7
$l_online_time = "Online time";
$l_remaining_time = "Remaining time";
$l_uam_domain = "Open access websites : ";
$l_autoregistration = "Auto registration (sms)";
$l_sms_registration = "Auto registration (sms)";
}
 
# If HTTPS not use, tell it's wrong
641,8 → 641,8
</div>
</div>
<?php if ($service_SMS_status): ?>
<div class= "row autoregistration_sms">
<a href="autoregistrationinfo.php"><?= $l_autoregistration ?></a>
<div class= "row sms_registration">
<a href="sms_registration.php"><?= $l_sms_registration ?></a>
</div>
<?php endif; ?>
</form>
/web/mail_registration_front.php
45,14 → 45,11
<a href="index.php?url=www.euronews.com">Login</a>
</li>
<li>
<a href="inscription.php">Inscription</a>
<a href="mail_registration_front.php">Inscription</a>
</li>
<li>
<a href="password.php">Changement de mot de passe</a>
</li>
<li>
<a href="reset.php">Réinitialisation de mot de passe</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<a href="contact.php" class="navbar-brand">Contact</a>
123,7 → 120,7
 
$.ajax({
type: "post",
url: "inscription_traitement.php",
url: "mail_registration_back.php",
data: {
'Fmail' : Fmail,
},
/web/sms_registration.php
0,0 → 1,253
<?php
#
# SMS Autoregistration
# By Rexy
 
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
 
// Read CONF_FILE
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
// Check if the SMS service is enable
if ($conf['SMS'] !== 'on') {
header('Location: /');
exit();
}
$organisme = $conf['ORGANISM'];
$current_num = $conf['SMS_NUM'];
 
 
// 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') { // French
$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 = "Numéro de GSM / identifiant de compte";
$l_num_raison = "État de votre numéro de GSM / compte";
$l_num_expiration = "Expiration";
$l_tuto_1 = "Bienvenue sur la page d'auto enregistrement.";
$l_tuto_2 = "Ce portail peut créer un compte dont l'identifiant sera votre numéro de GSM. Pour cela, envoyez le mot de passe de votre choix par SMS au numéro suivant : <b>$current_num</b>";
$l_tuto_3 = "Votre SMS ne doit contenir qu'un seul mot.";
$l_tuto_4 = "Votre inscription sera activée lorsque vous retrouverez votre numéro de GSM dans le tableau ci-dessous.";
$l_tuto_5 = "Le champ de recherche ci-dessous vous permet de retrouver votre numéro suivant les 5 derniers chiffres.";
$l_tab_first = "premier";
$l_tab_last = "dernier";
$l_tab_next = "suivant";
$l_tab_prev = "précédent";
$l_tab_search = "Recherche :";
$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
$l_tab_info = "Montrer _MENU_ résultats par page";
$l_tab_infoempty = "Aucun résultat";
$l_autorefresh = "Rafraichissement : 10 sec";
} else if ($Language === 'es') { // Spanish
$l_title = "Auto-Registro";
$l_num_exist = "Cuenta existente";
$l_num_flood = "Número de teléfono bloqueado: se superó el número de intentos.";
$l_num_num = "Número GSM / identificador de cuenta";
$l_num_raison = "Estado de su número GSM / cuenta";
$l_num_expiration = "Vencimiento";
$l_tuto_1 = "Bienvenido a la página de auto-registro";
$l_tuto_2 = "Este portal puede crear una cuenta cuyo identificador será su número de teléfono móvil. Para ello, envíe la contraseña que elija por SMS al siguiente número: <b>$current_num</b> ";
$l_tuto_3 = "Simplemente envíe 1 palabra en su SMS.";
$l_tuto_4 = "Su registro se activará cuando encuentre su número GSM en la siguiente tabla.";
$l_tuto_5 = "Puede buscar su número de teléfono de acuerdo con los últimos 5 dígitos de su número de teléfono.";
$l_tab_first = "primero";
$l_tab_last = "último";
$l_tab_next = "siguiente";
$l_tab_prev = "anterior";
$l_tab_search = "Buscar :";
$l_tab_pmenu = "Mostrando _PAGE_ a _PAGE_ de _PAGE_ entradas :";
$l_tab_info = "Mostrar _MENU_ entradas";
$l_tab_infoempty = "No se encontraron registros coincidencias";
$l_autorefresh = "Actualizar: 10 seg";
} else if ($Language === 'de') { // German
$l_title = "Seite zur Selbstregistrierung";
$l_num_exist = "Aktives Konto";
$l_num_flood = "Blockierte Nummer: Anzahl der Versuche überschritten.";
$l_num_num = "GSM-Nummer / Konto-Kennung";
$l_num_raison = "Status Ihrer Handynummer / Ihres Kontos";
$l_num_expiration = "Ablauf";
$l_tuto_1 = "Willkommen auf der Seite für die Selbstregistrierung.";
$l_tuto_2 = "Dieses Portal kann ein Konto erstellen, dessen Kennung Ihre Mobiltelefonnummer ist. Senden Sie dazu das Passwort Ihrer Wahl per SMS an die folgende Nummer: <b>$current_num</b> ";
$l_tuto_3 = "Ihre Textnachricht darf nur ein Wort enthalten.";
$l_tuto_4 = "Ihre Registrierung wird aktiviert, wenn Sie Ihre Handynummer in der Tabelle unten finden.";
$l_tuto_5 = "Mit dem Suchfeld unten können Sie Ihre Nummer nach den letzten 5 Ziffern suchen.";
$l_tab_first = "erste";
$l_tab_last = "aktuellste";
$l_tab_next = "unter";
$l_tab_prev = "vorherige";
$l_tab_search = "Forschung :";
$l_tab_pmenu = "Zeigt die Seite _PAGE_ auf _PAGES_ an";
$l_tab_info = "_MENU_ Ergebnisse pro Seite anzeigen";
$l_tab_infoempty = "Keine Ergebnisse";
$l_autorefresh = "Kühlung: 10 sec";
} else { // English
$l_title = "Autoregistration";
$l_num_exist = "Account enabled";
$l_num_flood = "Phone number banned: Number of trial exceeded.";
$l_num_num = "Mobile phone number / account identifier";
$l_num_raison = "Status of your phone number / account";
$l_num_expiration = "Expiration";
$l_tuto_1 = "Welcome to the auto-enrollment page";
$l_tuto_2 = "This portal can create an account whose identifier will be your mobile phone number. To do so, send the password of your choice by SMS to the following number: <b>$current_num</b>";
$l_tuto_3 = "Just send 1 word in your SMS.";
$l_tuto_4 = "Your registration will be activated when you'll find your phone number in the following table.";
$l_tuto_5 = "You can search your phone number according to the 5 last digits in your phone number.";
$l_tab_first = "first";
$l_tab_last = "last";
$l_tab_next = "next";
$l_tab_prev = "previous";
$l_tab_search = "Search :";
$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
$l_tab_info = "Show _MENU_ entries";
$l_tab_infoempty = "No matching records found";
$l_autorefresh = "Refresh: 10 sec";
}
 
// Get SMS from database
require('/etc/freeradius-web/config.php');
$img_rep = '/images/';
$img_sms = 'sms.png';
 
$con = mysqli_connect($config['sql_server'], $config['sql_username'], $config['sql_password'], 'gammu');
 
if (mysqli_connect_errno()) {
exit('Failed to connect to ' . $config['sql_type']/* . ': ' . mysqli_connect_error()*/);
}
 
$result = mysqli_query($con, 'SELECT * FROM `SMS_ban_perm` ORDER BY date_add DESC;');
 
$smsBanPerms = [];
while ($row = mysqli_fetch_array($result)) {
$smsBanPerms[] = (object) [
'numberHidden' => substr($row['SenderNumber'], 0, 3) . '****' . substr($row['SenderNumber'], -5),
'expiration' => $row['Expiration'],
'perm' => $row['Perm']
];
}
mysqli_close($con);
 
?>
<!DOCTYPE html>
<html><!-- written by Rexy -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ALCASAR - <?= $l_title ?></title>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/css/index.css">
<link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.css">
<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery.dataTables.js"></script>
<script>
function timedRefresh(timeoutPeriod) {
var interval = setInterval(refreshPage, timeoutPeriod);
}
 
function refreshPage() {
if ($('input[name=autoRefreshCheckboxes]').is(':checked')) {
location.reload(true);
}
}
 
$(document).ready( function () {
$('#table_id').DataTable({
"order": [[ 2, "desc" ]],
"language": {
"paginate": {
"sFirst": "<?= $l_tab_first ?>",
"sLast": "<?= $l_tab_last ?>",
"sPrevious": "<?= $l_tab_prev ?>",
"sNext": "<?= $l_tab_next ?>"
},
"lengthMenu": "<?= $l_tab_info ?>",
"zeroRecords": "<?= $l_tab_infoempty ?>",
"info": "<?= $l_tab_pmenu ?>",
"infoEmpty": "<?= $l_tab_infoempty ?>",
"sSearch": "<?= $l_tab_search ?>"
}
});
});
</script>
</head>
<body onload="timedRefresh(10000);">
<div class="col-xs-12 col-md-10 col-md-offset-1">
<!-- HeaderBox -->
<div class="row banner">
<!-- Logo box -->
<div class="img_banner hidden-xs col-sm-3 col-md-2 col-lg-2">
<img class="img-responsive img-organisme" src="images/organisme.png">
</div>
<!-- Title -->
<div id="cadre_titre" class="titre_banner col-xs-12 col-sm-8">
<p id="acces_controle" class="titre_controle"><?= $l_title ?></p>
</div>
<!-- Logo box -->
<div class="img_banner hidden-xs col-sm-3 col-md-2 col-lg-2">
<img class="img-responsive img-organisme" src="images/logo-alcasar_70.png">
</div>
</div>
<!-- Main content box -->
<div class="row">
<div id="contenu_acces" class="col-xs-12 col-lg-offset-1 col-lg-10">
<h3><?= $l_tuto_2 ?></h3>
<div class="menu-container container col_xs_12 col-sm-7">
<div class="box_menu_right box_menu">
<span><?= $l_tuto_3 ?></span>
<div class="menu-image">
<img class="img-responsive" src="<?= $img_rep.$img_sms ?>">
</div>
</div>
</div>
</div>
</div>
<p>
<div class="row">
<div id="contenu_acces" class="col-xs-12 col-lg-offset-1 col-lg-10">
<h4><?= $l_tuto_4 ?></h4>
<h4><?= $l_tuto_5 ?></h4>
<label><input type="checkbox" checked="checked" name="autoRefreshCheckboxes"><?= $l_autorefresh ?></label>
<table id="table_id" class="display">
<thead>
<tr>
<th><b><?= $l_num_num ?></b></th>
<th><b><?= $l_num_raison ?></b></th>
<th><b><?= $l_num_expiration ?></b></th>
</tr>
</thead>
<tbody>
<?php foreach ($smsBanPerms as $smsBanPerm): ?>
<tr>
<td><?= $smsBanPerm->numberHidden ?></td>
<?php if ($smsBanPerm->perm == '0'): ?>
<td><?= $l_num_exist ?></td>
<?php elseif ($smsBanPerm->perm == '1'): ?>
<td><?= $l_num_flood ?></td>
<?php endif ?>
<td><?= $smsBanPerm->expiration ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>