Subversion Repositories ALCASAR

Rev

Rev 2992 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2992 Rev 3076
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
3
#Define
2
#Define
4
$gammu_wrong_port = "";
3
$gammu_wrong_port = "";
5
$gammu_puk = "";
4
$gammu_puk = "";
6
$gammu_simfail = "";
5
$gammu_simfail = "";
7
$gammu_simsecu = "";
6
$gammu_simsecu = "";
Line 20... Line 19...
20
$model='';
19
$model='';
21
$gammu_smsd_port='';
20
$gammu_smsd_port='';
22
 
21
 
23
# Test if a modem is plugged on serial-usb port
22
# Test if a modem is plugged on serial-usb port
24
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
23
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
25
if (!empty($open_port))
24
if (!empty($open_port)) {
26
{
-
 
27
	$find_key="true";
25
	$find_key="true";
28
	$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2"); 
26
	$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2"); 
29
	$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
27
	$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
30
	$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port 
28
	$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port 
31
	while ( list(,$row) = each($openned_ports))
29
	foreach($openned_ports as $row) {
32
	{
-
 
33
		if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
30
		if ( "$row" == "$gammu_smsd_port" ) { // is gammu listen on an openned port ?
34
		{
-
 
35
			$listen_on_right_port="true";
31
			$listen_on_right_port="true";
36
		}
32
		}
37
	}
33
	}
38
}	
34
}	
39
$gammu_pid=exec("sudo $script --pidof");
35
$gammu_pid=exec("sudo $script --pidof");
40
if ($find_key == "false")
-
 
41
{	# close gammu if it's started
36
if ($find_key == "false") {	# close gammu if it's started
42
	if ($gammu_pid!="")
37
	if ($gammu_pid!="")	{
43
	{
-
 
44
		exec("sudo $script --stop");
38
		exec("sudo $script --stop");
45
		sleep(8);
39
		sleep(8);
46
		header('Location: user_by_sms.php');
40
		header('Location: user_by_sms.php');
47
		exit();
41
		exit();
48
	}
42
	}
Line 276... Line 270...
276
        location.reload(true);
270
        location.reload(true);
277
    }
271
    }
278
}
272
}
279
 
273
 
280
$(document).ready( function () {
274
$(document).ready( function () {
281
 
-
 
282
    	$('#table_id').DataTable({
275
    	$('#table_id').DataTable({
283
		"language": {
276
		"language": {
284
			"paginate": {
277
			"paginate": {
285
			"sFirst": "<?php echo $l_tab_first; ?>",
278
			"sFirst": "<?php echo $l_tab_first; ?>",
286
			"sLast": "<?php echo $l_tab_last; ?>",
279
			"sLast": "<?php echo $l_tab_last; ?>",
Line 292... Line 285...
292
            "info": "<?php echo $l_tab_pmenu; ?>",
285
            "info": "<?php echo $l_tab_pmenu; ?>",
293
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
286
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
294
			"sSearch": "<?php echo $l_tab_search; ?>"
287
			"sSearch": "<?php echo $l_tab_search; ?>"
295
        }
288
        }
296
	});
289
	});
297
 
-
 
298
	$('#table_country').DataTable({
290
	$('#table_country').DataTable({
299
		"language": {
291
		"language": {
300
			"paginate": {
292
			"paginate": {
301
			"sFirst": "<?php echo $l_tab_first; ?>",
293
			"sFirst": "<?php echo $l_tab_first; ?>",
302
			"sLast": "<?php echo $l_tab_last; ?>",
294
			"sLast": "<?php echo $l_tab_last; ?>",
Line 346... Line 338...
346
<tr>
338
<tr>
347
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
339
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
348
</tr>
340
</tr>
349
<tr>
341
<tr>
350
<?php
342
<?php
351
if($find_key=="true")
343
if($find_key=="true") {
352
{
-
 
353
	# Start / stop of gammu-smsd (3*7sec) --> to be improve with  systemd unit (see tarball in contrib/init folder) 
344
	# Start / stop of gammu-smsd (3*7sec) --> to be improve with  systemd unit (see tarball in contrib/init folder) 
354
	if(isset($_POST["start"])){
345
	if(isset($_POST["start"])){
355
		$gammu_1=exec("sudo $script --start");
346
		$gammu_1=exec("sudo $script --start");
356
		sleep(7);
347
		sleep(7);
357
		if($current_last_secu!="")
348
		if($current_last_secu!="") {
358
		{
-
 
359
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
349
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) {
360
			{
-
 
361
				exec("sudo $script --stop");
350
				exec("sudo $script --stop");
362
			}
351
			}
363
		}
352
		}
364
		sleep(7);
353
		sleep(7);
365
		if($current_last_secu!="")
354
		if($current_last_secu!="") {
366
		{
-
 
367
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
355
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) {
368
			{
-
 
369
				exec("sudo $script --stop");
356
				exec("sudo $script --stop");
370
			}
357
			}
371
		}
358
		}
372
		sleep(7);	
359
		sleep(7);	
373
		if($current_last_secu!="")
360
		if($current_last_secu!="") {
374
		{
-
 
375
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
361
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) {
376
			{
-
 
377
				exec("sudo $script --stop");
362
				exec("sudo $script --stop");
378
			}
363
			}
379
		}
364
		}
380
		header('Location: user_by_sms.php');
365
		header('Location: user_by_sms.php');
381
		exit();
366
		exit();
Line 419... Line 404...
419
	# Set the SIM phone number
404
	# Set the SIM phone number
420
	if(isset($_POST["b_num_alcasar"])){
405
	if(isset($_POST["b_num_alcasar"])){
421
		echo "speed = ".$_POST['num_alcasar'];
406
		echo "speed = ".$_POST['num_alcasar'];
422
		$num = $_POST["num_alcasar"];
407
		$num = $_POST["num_alcasar"];
423
		$error_num_alcasar = "";
408
		$error_num_alcasar = "";
424
		if($num !="")
409
		if($num !="") {
425
		{
-
 
426
			if(preg_match('#^\+#',$num))
410
			if(preg_match('#^\+#',$num)) {
427
			{
-
 
428
				exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
411
				exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
429
				header('Location: user_by_sms.php');
412
				header('Location: user_by_sms.php');
430
				exit();
413
				exit();
431
			}
414
			}
432
			else
415
			else {
433
			{
-
 
434
				$error_num_alcasar=$l_error_label_num3;
416
				$error_num_alcasar=$l_error_label_num3;
435
			}
417
			}
436
		}
418
		}
437
		else
419
		else {
438
		{
-
 
439
			$error_num_alcasar=$l_error_label_empty;
420
			$error_num_alcasar=$l_error_label_empty;
440
		}
421
		}
441
	}
422
	}
442
	
423
	
443
	# Set the SIM card PIN number
424
	# Set the SIM card PIN number
444
	if(isset($_POST["b_pin"])){
425
	if(isset($_POST["b_pin"])){
445
		$pin = $_POST["pin"];
426
		$pin = $_POST["pin"];
446
		$error_pin = "";
427
		$error_pin = "";
447
		if($pin !="")
428
		if($pin !="") {
448
		{
-
 
449
			if(is_numeric($pin))
429
			if(is_numeric($pin)) {
450
			{
-
 
451
				exec("sudo $script --replace_pin ".escapeshellarg($pin));
430
				exec("sudo $script --replace_pin ".escapeshellarg($pin));
452
				header('Location: user_by_sms.php');
431
				header('Location: user_by_sms.php');
453
				exit();
432
				exit();
454
			}
433
			}
455
			else
434
			else {
456
			{
-
 
457
				$error_pin=$l_error_label_num;			
435
				$error_pin=$l_error_label_num;			
458
			}
436
			}
459
		}
437
		}
460
		else
438
		else {
461
		{
-
 
462
			$error_pin=$l_error_label_empty;
439
			$error_pin=$l_error_label_empty;
463
		}
440
		}
464
	}
441
	}
465
 
442
 
466
	# Set the session timeout for each new account
443
	# Set the session timeout for each new account
467
	if(isset($_POST["b_time_account"])){
444
	if(isset($_POST["b_time_account"])){
468
		$time_account = $_POST["time_account"];
445
		$time_account = $_POST["time_account"];
469
		$error_time_account = "";
446
		$error_time_account = "";
470
		if($time_account !="")
447
		if($time_account !="") {
471
		{
-
 
472
			if(is_numeric($time_account))
448
			if(is_numeric($time_account)) {
473
			{
-
 
474
				exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
449
				exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
475
				header('Location: user_by_sms.php');
450
				header('Location: user_by_sms.php');
476
				exit();
451
				exit();
477
			}
452
			}
478
			else
453
			else {
479
			{
-
 
480
				$error_time_account=$l_error_label_num2;
454
				$error_time_account=$l_error_label_num2;
481
			}
455
			}
482
		}
456
		}
483
		else
457
		else {
484
		{
-
 
485
			$error_time_account=$l_error_label_empty;
458
			$error_time_account=$l_error_label_empty;
486
		}
459
		}
487
	}
460
	}
488
 
461
 
489
	# Set the number of tries before ban
462
	# Set the number of tries before ban
490
	if(isset($_POST["b_ban_temp"])){
463
	if(isset($_POST["b_ban_temp"])){
491
		$nb_ban_temp = $_POST["nb_essais"];
464
		$nb_ban_temp = $_POST["nb_essais"];
492
		$error_nb_essais = "";
465
		$error_nb_essais = "";
493
		if($nb_ban_temp !="")
466
		if($nb_ban_temp !="") {
494
		{
-
 
495
			if(is_numeric($nb_ban_temp))
467
			if(is_numeric($nb_ban_temp)) {
496
			{
-
 
497
				exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
468
				exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
498
				header('Location: user_by_sms.php');
469
				header('Location: user_by_sms.php');
499
				exit();
470
				exit();
500
			}
471
			}
501
			else
472
			else {
502
			{
-
 
503
				$error_nb_essais=$l_error_label_num2;			
473
				$error_nb_essais=$l_error_label_num2;			
504
			}
474
			}
505
		}
475
		}
506
		else
476
		else {
507
		{
-
 
508
			$error_nb_essais=$l_error_label_empty;
477
			$error_nb_essais=$l_error_label_empty;
509
		}
478
		}
510
	}
479
	}
511
 
480
 
512
	# Set the ban timeout
481
	# Set the ban timeout
513
	if(isset($_POST["b_time_perm"])){
482
	if(isset($_POST["b_time_perm"])){
514
		$time_perm = $_POST["time_perm"];
483
		$time_perm = $_POST["time_perm"];
515
		$error_time_perm = "";
484
		$error_time_perm = "";
516
		if($time_perm !="")
485
		if($time_perm !="") {
517
		{
-
 
518
			if(is_numeric($time_perm))
486
			if(is_numeric($time_perm)) {
519
			{
-
 
520
				exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
487
				exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
521
				header('Location: user_by_sms.php');
488
				header('Location: user_by_sms.php');
522
				exit();
489
				exit();
523
			}
490
			}
524
			else
491
			else {
525
			{
-
 
526
				$error_time_perm=$l_error_label_num2;
492
				$error_time_perm=$l_error_label_num2;
527
			}
493
			}
528
		}
494
		}
529
		else
495
		else {
530
		{
-
 
531
			$error_time_perm=$l_error_label_empty;
496
			$error_time_perm=$l_error_label_empty;
532
		}
497
		}
533
	}
498
	}
534
	
499
	
535
	# removing a banned phone number
500
	# removing a banned phone number
536
	if(isset($_POST['num_select'])){
501
	if(isset($_POST['num_select'])) {
537
		$numero=$_POST['num_select'];
502
		$numero=$_POST['num_select'];
538
 
-
 
539
		$add_mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg($numero)." | cut -d ' ' -f1");
503
		$add_mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg($numero)." | cut -d ' ' -f1");
540
		if (!empty($add_mac)) {
504
		if (!empty($add_mac)) {
541
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
505
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
542
		}
506
		}
543
		exec("sudo $script --unlock_num $numero");
507
		exec("sudo $script --unlock_num $numero");
544
		header('Location: user_by_sms.php');
508
		header('Location: user_by_sms.php');
545
		exit();
509
		exit();
546
	}
510
	}
547
 
511
 
548
	# Edition etat pays
512
	# Edition etat pays
549
	if(isset($_POST['country_select'])){
513
	if(isset($_POST['country_select'])) {
550
		$country=utf8_decode($_POST['country_select']);
514
		$country=utf8_decode($_POST['country_select']);
551
		exec("sudo $script --change_country ".escapeshellarg($country));
515
		exec("sudo $script --change_country ".escapeshellarg($country));
552
		exec("sudo $script --change_country_filter advance");
516
		exec("sudo $script --change_country_filter advance");
553
		header('Location: user_by_sms.php');
517
		header('Location: user_by_sms.php');
554
		exit();
518
		exit();
555
	}
519
	}
556
	if(isset($_POST['b_france_enable'])){
520
	if(isset($_POST['b_france_enable'])) {
557
		exec("sudo $script --change_country_dis_all");
521
		exec("sudo $script --change_country_dis_all");
558
		exec("sudo $script --change_country France");
522
		exec("sudo $script --change_country France");
559
		exec("sudo $script --change_country_filter fr");
523
		exec("sudo $script --change_country_filter fr");
560
		header('Location: user_by_sms.php');
524
		header('Location: user_by_sms.php');
561
		exit();
525
		exit();
562
	}
526
	}
563
	if(isset($_POST['b_ue_enable'])){
527
	if(isset($_POST['b_ue_enable'])) {
564
		exec("sudo $script --change_country_dis_all");
528
		exec("sudo $script --change_country_dis_all");
565
		$array_ue = array("Allemagne","Autriche","Belgique","Bulgarie","Chypre","Croatie","Danemark","Espagne","Estonie","Finlande","France","Grece","Hongrie","Irlande","Italie","Lettonie","Lituanie","Luxembourg","Malte","Pays-Bas"," Pologne","Portugal","Republique Tcheque","Roumanie","Angleterre","Slovaquie","Slovenie","Suede");
529
		$array_ue = array("Allemagne","Autriche","Belgique","Bulgarie","Chypre","Croatie","Danemark","Espagne","Estonie","Finlande","France","Grece","Hongrie","Irlande","Italie","Lettonie","Lituanie","Luxembourg","Malte","Pays-Bas"," Pologne","Portugal","Republique Tcheque","Roumanie","Angleterre","Slovaquie","Slovenie","Suede");
566
		foreach ($array_ue as $pays){
530
		foreach ($array_ue as $pays){
567
			exec("sudo $script --change_country ".escapeshellarg($pays));
531
			exec("sudo $script --change_country ".escapeshellarg($pays));
568
		}
532
		}
569
		
-
 
570
		exec("sudo $script --change_country_filter ue");
533
		exec("sudo $script --change_country_filter ue");
571
		header('Location: user_by_sms.php');
534
		header('Location: user_by_sms.php');
572
		exit();
535
		exit();
573
	}
536
	}
574
	if(isset($_POST["b_country_enable"])){
537
	if(isset($_POST["b_country_enable"])) {
575
		exec("sudo $script --change_country_ena_all");		
538
		exec("sudo $script --change_country_ena_all");		
576
		exec("sudo $script --change_country_filter all");
539
		exec("sudo $script --change_country_filter all");
577
		header('Location: user_by_sms.php');
540
		header('Location: user_by_sms.php');
578
		exit();
541
		exit();
579
	}
542
	}
580
	if(isset($_POST["b_country_disable"])){
543
	if(isset($_POST["b_country_disable"])) {
581
		exec("sudo $script --change_country_dis_all");
544
		exec("sudo $script --change_country_dis_all");
582
		header('Location: user_by_sms.php');
545
		header('Location: user_by_sms.php');
583
		exit();
546
		exit();
584
	}
547
	}
585
 
-
 
586
	echo '	<td>'.$l_key_enable_1;
548
	echo '	<td>'.$l_key_enable_1;
587
	echo '<br>'.$l_key_enable_2.'<b>';
549
	echo '<br>'.$l_key_enable_2.'<b>';
588
	reset ($openned_ports);
550
	reset ($openned_ports);
589
	while ( list(,$row) = each($openned_ports))
551
	foreach ($openned_ports as $row) {
590
	{
-
 
591
		echo $row." ";
552
		echo $row." ";
592
	}
553
	}
593
	echo '</b></td>';
554
	echo '</b></td>';
594
}
555
}
595
else
556
else {
596
{
-
 
597
	echo "<td>$l_key_diseable</td>";
557
	echo "<td>$l_key_diseable</td>";
598
}
558
}
599
?>
559
?>
600
</tr>
560
</tr>
601
</table>
561
</table>
602
</center>
562
</center>
603
<br>
563
<br>
604
<?php
564
<?php
605
 
565
 
606
if ($find_key=="true")
566
if ($find_key=="true") {
607
{
-
 
608
	#Nom du fichier de log lorsque gammu est démarré
567
	#Nom du fichier de log lorsque gammu est démarré
609
	#$file_log = "gammu-smsd.log";
568
	#$file_log = "gammu-smsd.log";
610
 
569
 
611
	#Recuperation de la vitesse de connexion
570
	#Recuperation de la vitesse de connexion
612
	$current_speed = exec("sudo $script --connect");
571
	$current_speed = exec("sudo $script --connect");
Line 643... Line 602...
643
 
602
 
644
	#Recuperation de la dernière ligne de TIMEOUT
603
	#Recuperation de la dernière ligne de TIMEOUT
645
	$current_last_timeout = exec("sudo $script --last_timeout");
604
	$current_last_timeout = exec("sudo $script --last_timeout");
646
	
605
	
647
	# Test si le service est lancé
606
	# Test si le service est lancé
648
	if ($gammu_pid=="")
607
	if ($gammu_pid=="") {
649
	{
-
 
650
		$force_signal = "-";
608
		$force_signal = "-";
651
		$imei_device = "-";
609
		$imei_device = "-";
652
		$sms_received = "-";
610
		$sms_received = "-";
653
 
-
 
654
		$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";	
611
		$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";	
655
		$gammu_status_on="";
612
		$gammu_status_on="";
656
		$gammu_status_off="disabled";
613
		$gammu_status_off="disabled";
657
 
-
 
658
		if($current_last_secu!="")
614
		if($current_last_secu!="") {
659
		{
-
 
660
			if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
615
			if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop)) {
661
			{
-
 
662
				$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";	
616
				$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";	
663
			}
617
			}
664
		}
618
		}
665
	} else {
619
	} else {
666
		# Recuperation de la force du signal et IMEI et nombre de sms reçu
620
		# Recuperation de la force du signal et IMEI et nombre de sms reçu
667
		$val_force_signal = exec("sudo $script --signal_device");
621
		$val_force_signal = exec("sudo $script --signal_device");
668
		$imei_device = exec("sudo $script --imei_device");
622
		$imei_device = exec("sudo $script --imei_device");
669
		$sms_received = exec("sudo $script --sms_received");
623
		$sms_received = exec("sudo $script --sms_received");
670
 
-
 
671
		if ($val_force_signal < 21) {
624
		if ($val_force_signal < 21) {
672
			$force_signal = "<img src=\"/images/signal_0.png\">  --  ".$val_force_signal." %";
625
			$force_signal = "<img src=\"/images/signal_0.png\">  --  ".$val_force_signal." %";
673
		} elseif ($val_force_signal < 41) {
626
		} elseif ($val_force_signal < 41) {
674
			$force_signal = "<img src=\"/images/signal_20.png\">  --  ".$val_force_signal." %";
627
			$force_signal = "<img src=\"/images/signal_20.png\">  --  ".$val_force_signal." %";
675
 
-
 
676
		} elseif ($val_force_signal < 61) {
628
		} elseif ($val_force_signal < 61) {
677
			$force_signal = "<img src=\"/images/signal_40.png\">  --  ".$val_force_signal." %";
629
			$force_signal = "<img src=\"/images/signal_40.png\">  --  ".$val_force_signal." %";
678
 
-
 
679
		} elseif ($val_force_signal < 81) {
630
		} elseif ($val_force_signal < 81) {
680
			$force_signal = "<img src=\"/images/signal_60.png\">  --  ".$val_force_signal." %";
631
			$force_signal = "<img src=\"/images/signal_60.png\">  --  ".$val_force_signal." %";
681
 
-
 
682
		} elseif ($val_force_signal < 101) {
632
		} elseif ($val_force_signal < 101) {
683
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
633
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
684
 
-
 
685
		}
634
		}
686
		
-
 
687
		$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";	
635
		$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";	
688
		if ($listen_on_right_port != "true"){
636
		if ($listen_on_right_port != "true") {
689
			$gammu_wrong_port="<tr><td colspan=7><font color=red>$l_error_wrong_port</font></td></tr>";
637
			$gammu_wrong_port="<tr><td colspan=7><font color=red>$l_error_wrong_port</font></td></tr>";
690
		}	
638
		}	
691
	
-
 
692
		if($current_last_timeout!=""){
639
		if($current_last_timeout!="") {
693
			if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
640
			if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop)) {
694
			{
-
 
695
				$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
641
				$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
696
			}
642
			}
697
		}
643
		}
698
		
-
 
699
		if($current_last_secu!="")
644
		if($current_last_secu!="") {
700
		{
-
 
701
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
645
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) {
702
			{
-
 
703
				exec("sudo $script --stop");
646
				exec("sudo $script --stop");
704
			}
647
			}
705
		}
648
		}
706
		
-
 
707
		if($current_last_write!=""){
649
		if($current_last_write!="") {
708
			if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
650
			if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop)) {
709
			{
-
 
710
				$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";	
651
				$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";	
711
			}
652
			}
712
		}
653
		}
713
		
-
 
714
		if($current_simfail!="")
654
		if($current_simfail!="") {
715
		{
-
 
716
			if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
655
			if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop)) {
717
			{
-
 
718
				$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
656
				$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
719
			}
657
			}
720
		}
658
		}
721
		$gammu_status_on="disabled";
659
		$gammu_status_on="disabled";
722
		$gammu_status_off="";
660
		$gammu_status_off="";
723
	}
661
	}
724
 
-
 
725
	echo "<form action=\"user_by_sms.php\" method=\"post\">
662
	echo "<form action=\"user_by_sms.php\" method=\"post\">
726
		<table border=1>
663
		<table border=1>
727
		<tr>
664
		<tr>
728
		<td colspan=3><b>$l_conf</b></td>
665
		<td colspan=3><b>$l_conf</b></td>
729
		<td><b>$l_conf_actu</b></td>
666
		<td><b>$l_conf_actu</b></td>
730
		</tr>
667
		</tr>
731
		<tr>
668
		<tr>
732
		<td> $l_connect_port </td><td><select name=\"port\">'";
669
		<td> $l_connect_port </td><td><select name=\"port\">'";
733
		reset ($openned_ports);
670
		reset ($openned_ports);
734
		while ( list(,$row) = each($openned_ports))
671
		foreach ($openned_ports as $row) {
735
		{
-
 
736
			echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>';
672
			echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>';
737
			echo $row." ";
673
			echo $row." ";
738
		}
674
		}
739
	echo "</select></td>
675
	echo "</select></td>
740
		<td><button type=\"submit\" name=\"b_port\" $gammu_status_on>$l_edit</button></td>
676
		<td><button type=\"submit\" name=\"b_port\" $gammu_status_on>$l_edit</button></td>
Line 803... Line 739...
803
		$gammu_simsecu
739
		$gammu_simsecu
804
		$gammu_timeout
740
		$gammu_timeout
805
		$gammu_writeerror
741
		$gammu_writeerror
806
		</table>
742
		</table>
807
		</form>";
743
		</form>";
808
	
-
 
809
	require('/etc/freeradius-web/config.php');
744
	require('/etc/freeradius-web/config.php');
810
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
745
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
811
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
746
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
812
	else{
747
	else {
813
		echo "<b>Could not include SQL library</b>\n";
748
		echo "<b>Could not include SQL library</b>\n";
814
		exit();
749
		exit();
815
	}
750
	}
816
	$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
751
	$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
817
	if(mysqli_connect_errno())
752
	if(mysqli_connect_errno()) {
818
	{
-
 
819
		echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
753
		echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
820
	}
754
	}
821
 
-
 
822
	# Country table
755
	# Country table
823
?>
756
?>
824
 
-
 
825
	<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
757
	<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
826
		 <span class="showhide-but_country"><?php echo "<strong>$l_country_filtering</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
758
		 <span class="showhide-but_country"><?php echo "<strong>$l_country_filtering</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
827
 
-
 
828
		<div class="showhide-div_country">
759
		<div class="showhide-div_country">
829
		<br />
760
		<br />
830
			<table width=100% style="background: #BDBDBD;">
761
			<table width=100% style="background: #BDBDBD;">
831
			<tr>
762
			<tr>
832
				<?php 
763
				<?php 
Line 866... Line 797...
866
							<th><b><font color="black">Etat</font></b></th>
797
							<th><b><font color="black">Etat</font></b></th>
867
						</tr>
798
						</tr>
868
					</thead>
799
					</thead>
869
					<tbody>
800
					<tbody>
870
						<?php 
801
						<?php 
871
 
-
 
872
						$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
802
						$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
873
						while($row = mysqli_fetch_array($result_country))
803
						while($row = mysqli_fetch_array($result_country)) {
874
						{
-
 
875
						echo "	
804
							echo "	
876
						<tr>
805
							<tr>
877
						<form action=\"user_by_sms.php\" method=\"post\">
806
							<form action=\"user_by_sms.php\" method=\"post\">
878
						<td>
807
							<td>
879
							<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">	
808
								<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">	
880
							".$row['name']."
809
								".$row['name']."
881
						</td>
810
							</td>
882
						<td>".$row['id']."</td>
811
							<td>".$row['id']."</td>
883
						";
812
							";
884
			
-
 
885
						if($row['status']=='0')
813
						if($row['status']=='0') {
886
						{
-
 
887
							echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
814
							echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
888
						}
815
						}
889
						if($row['status']=='1')
816
						if($row['status']=='1') {
890
						{
-
 
891
							echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
817
							echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
892
						}
818
						}
893
						echo "	</form>
819
						echo "	</form>
894
							</tr>
820
							</tr>
895
							";
821
							";
Line 901... Line 827...
901
			</div>
827
			</div>
902
		</div>	
828
		</div>	
903
	</div>
829
	</div>
904
<?php 
830
<?php 
905
	$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
831
	$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
906
 
-
 
907
?>
832
?>
908
 
-
 
909
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
833
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
910
		<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
834
		<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
911
 
-
 
912
		<div class="showhide-div_ban">
835
		<div class="showhide-div_ban">
913
	
-
 
914
			<table id="table_id" class="display">
836
			<table id="table_id" class="display">
915
				<thead>
837
				<thead>
916
					<tr>
838
					<tr>
917
						<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
839
						<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
918
						<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
840
						<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
Line 920... Line 842...
920
						<th><b><font color="black">Action</font></b></th>
842
						<th><b><font color="black">Action</font></b></th>
921
					</tr>
843
					</tr>
922
				</thead>
844
				</thead>
923
				<tbody>
845
				<tbody>
924
					<?php 
846
					<?php 
925
					while($row = mysqli_fetch_array($result))
847
					while($row = mysqli_fetch_array($result)) {
926
					{
-
 
927
					echo "	
848
						echo "	
928
						<tr>
849
						<tr>
929
						<form action=\"user_by_sms.php\" method=\"post\">
850
							<form action=\"user_by_sms.php\" method=\"post\">
930
						<td>
851
							<td>
931
							<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">	
852
								<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">	
932
							".$row['SenderNumber']."
853
								".$row['SenderNumber']."
933
						</td>";
854
							</td>";
934
		
-
 
935
					if($row['Perm']=='0')
855
						if($row['Perm']=='0') {
936
					{
-
 
937
						echo "<td>$l_num_exist</td>";
856
							echo "<td>$l_num_exist</td>";
938
					}
857
						}
939
					if($row['Perm']=='1')
858
						if($row['Perm']=='1') {
940
					{
-
 
941
						echo "<td>$l_num_flood</td>";
859
							echo "<td>$l_num_flood</td>";
942
					}
860
						}
943
					echo "	<td>" . $row['Expiration']. "</td>
861
						echo "	<td>" . $row['Expiration']. "</td>
944
							<td>
862
							<td>
945
								<input type='submit' value='".$l_num_unlock."'>
863
								<input type='submit' value='".$l_num_unlock."'>
946
							</td>
864
							</td>
947
							</form>
865
							</form>
948
						</tr>
866
						</tr>