Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1379 → Rev 1380

/web/acc/manager/htdocs/autoregistration.php
9,9 → 9,12
<body>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<?
#Commandes
$exec_com=exec("lsusb | grep -i huawei | cut -d ' ' -f6");
$exec_com2=exec("lsusb | grep -i d-link | cut -d ' ' -f7");
# Test présence de clé/modem
$exec_com=exec("lsusb | grep -i 067b | cut -d ' ' -f6 | cut -d ' ' -f1");
$exec_com2=exec("lsusb | grep -i 12d1 | cut -d ' ' -f6 | cut -d ' ' -f1");
 
//$exec_com2=exec("lsusb | grep -i d-link | cut -d ' ' -f7");
 
$status_key="false";
$script="/usr/local/bin/alcasar-sms.sh";
 
30,8 → 33,8
# 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)); }
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
$l_title = "Auto enregistrement (SMS)";
$l_conf = "Configuration";
38,9 → 41,9
$l_conf_actu = "Configuration actuelle";
$l_pin = "Code PIN";
$l_num_alcasar = "Le numero de téléphone de la clé 3G";
$l_ban_temp = "Nombre d'essais max avant le ban permanant";
$l_ban_temp = "Nombre d'essais avant le blocage";
$l_time_account = "Durée pour une session créée";
$l_time_perm = "Durée en jours d'un bloquage (ban)";
$l_time_perm = "Durée du blocage (en jours)";
$l_status_gammu = "Etat du service";
$l_start = "Démarrer";
$l_status_device = "Status de votre périphérique";
56,11 → 59,12
$l_error_label_empty = "Le champ est vide";
$l_error_label_num = "Ce n'est pas un PIN valide";
$l_error_label_num2 = "Ce n'est pas un nombre";
$l_error_label_num3 = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Gammu semble ne pas parvenir à discuter avec la clé (port ttyUSB0).";
$l_error_timeoutfail = "Impossible de se connecter à la clé 3G. Timeout.";
$l_error_simfail = "Un problème au niveau de la carte SIM a été détecté. Est elle présente?";
$l_error_simsecu_l = "Attention, lors du dernier démarrage, votre code PIN était erroné.<br>
La SIM doit être bloqué (code PUK). Consultez la documentation.";
La SIM doit être bloqué (code PUK). Consultez la documentation.";
$l_autorefresh = "Rafraichissement : 30 sec";
$l_days = "jours ";
74,8 → 78,10
$l_num_unlock="Effacer";
$l_service_status_img_ok="Démarré";
$l_service_status_img_ko="Arrété";
$l_conf_name="Configuration : ";
$l_current_connect = "Connexion";
 
 
}
else {
$l_title = "Auto registration (SMS)";
101,6 → 107,8
$l_error_label_empty = "Field empty";
$l_error_label_num = "It's not a valid PIN password";
$l_error_label_num2 = "It's not a number";
$l_error_label_num3 = "The phone number is not good: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Gammu semble ne pas parvenir à discuter avec la clé (port ttyUSB0).";
$l_error_writefail = "Gammu can't listen the ttyUSB0 port.";
$l_error_timeoutfail = "Timeout. Can not connect to modem.";
$l_error_simfail = "An issue with your Sim card was detected. Is it in the key?";
119,6 → 127,9
$l_num_unlock="Erase";
$l_service_status_img_ok="Running";
$l_service_status_img_ko="Stopped";
$l_conf_name="Configuration : ";
$l_current_connect = "Connection";
}
echo "
<tr>
136,15 → 147,51
<center>
<br /><br />
<table border=1 width=100%>
<tr>
<td colspan=2><h3><?php echo $l_status_device ?></h3></td>
</tr>
<tr>
<td colspan=3><h3><?php echo $l_status_device ?></h3></td>
</tr>
 
<tr>
<?php
if(!empty($exec_com) || !empty($exec_com2))
{
echo "<td>$l_key_enable</td>";
 
if(isset($_GET['config_submit'])){
switch ($_GET['config']) {
case "at":
exec("sudo $script --replace_connect ");
break;
case "9600":
exec("sudo $script --replace_connect 9600");
break;
case "19200":
exec("sudo $script --replace_connect 19200");
break;
case "115200":
exec("sudo $script --replace_connect 115200");
break;
 
}
}
 
$current_connect = exec("sudo $script --connect");
 
echo '<td width="50%">'.$l_key_enable.'</td>';
echo '<td width="20%">'.$l_current_connect.' : '.$current_connect.'</td>';
echo ' <form form="GET" action="./autoregistration.php">
<td align="right"> '.$l_conf_name.'
<select name="config">
<option value="at">at</option>
<option value="9600">at9600</option>
<option value="19200">at19200</option>
<option value="115200">at115200</option>
</select>
<input type="submit" name="config_submit"></submit>
</td>
</form>
';
 
$status_key="true";
}
else
153,7 → 200,7
$status_key="false";
}
?>
</tr>
</tr>
</table>
</center>
<br /><br />
160,8 → 207,8
 
<?php
 
#Test si gammu est lancé
$gammu_pid=exec("sudo /sbin/pidof gammu-smsd");
#Test si gammu est lancé
$gammu_pid=exec("sudo /sbin/pidof gammu-smsd");
 
 
if ($status_key=="false")
214,7 → 261,8
 
#Recuperation de la dernière ligne de TIMEOUT
$current_last_timeout = exec("sudo $script --last_timeout");
 
# Test si le service est lancé
if ($gammu_pid=="")
{
$force_signal = "-";
261,8 → 309,8
 
$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";
$gammu_log="<tr><td colspan=7>$current_log</td></tr>";
if($current_last_timeout!=""){
if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
{
289,7 → 337,7
{
if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
{
$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
}
}
$gammu_status_on="disabled";
297,7 → 345,7
}
 
 
#Lancement et arret de gammu-smsd
#Lancement et arret de gammu-smsd 3*7sec
if(isset($_GET["start"])){
$gammu_1=exec("sudo $script --start");
sleep(7);
346,7 → 394,7
$error_num_alcasar = "";
if($num !="")
{
if(is_numeric($num))
if(preg_match('#^\+#',$num))
{
exec("sudo $script --replace_numero_alcasar $num");
header('Location: autoregistration.php');
353,7 → 401,7
}
else
{
$error_num_alcasar=$l_error_label_num2;
$error_num_alcasar=$l_error_label_num3;
}
}
else
383,7 → 431,8
$error_pin=$l_error_label_empty;
}
}
 
#Edition du nombre d'essais avant le ban perm
if(isset($_GET["b_ban_temp"])){
$nb_ban_temp = $_GET["nb_essais"];
405,8 → 454,8
$error_nb_essais=$l_error_label_empty;
}
}
 
 
#Edition de la durée pour un compte créé
if(isset($_GET["b_time_account"])){
$time_account = $_GET["time_account"];
420,7 → 469,7
}
else
{
$error_time_account=$l_error_label_num2;
$error_time_account=$l_error_label_num2;
}
}
else
442,7 → 491,7
}
else
{
$error_time_perm=$l_error_label_num2;
$error_time_perm=$l_error_label_num2;
}
}
else
498,34 → 547,40
</tr>
<tr>
<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"10\"><font color=red><b>$error_num_alcasar</b></font></td>
<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
<tr>
<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"><font color=red><b>$error_pin</b></font></td>
<tr>
<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_pin</font></center></td>
</tr>
<tr>
<td> $l_time_account </td><td><input type=text name='time_account'> $l_days <font color=red><b>$error_time_account</b></font>
<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
 
<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"blue\">$current_time_account</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
<tr>
<td> $l_ban_temp </td><td><input type=text name='nb_essais'><font color=red><b>$error_nb_essais</b></font></td>
<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>
<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_try_ban</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
<tr>
<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days <font color=red><b>$error_time_perm</b></font>
<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_time_perm</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
</tr>
</table>
</form>";
569,7 → 624,7
<form action=\"autoregistration.php\" methode=\"POST\">
<tr>
<td>
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
" . $row['SenderNumber'] . "</td>";
if($row['Perm']=='0')
591,8 → 646,9
echo "</table>";
 
mysqli_close($con);
 
}
}
?>
 
</html>