[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/www/se3/tests/ -> test_gateway.php (source)

   1  <?php
   2  
   3     /**
   4     
   5     * Test la connexion a internet
   6     * @Version $Id: test_gateway.php 4764 2009-11-08 17:31:37Z crob $ 
   7     * @Projet LCS / SambaEdu 
   8     * @auteurs Philippe Chadefaux  MrT
   9     * @Licence Distribue selon les termes de la licence GPL
  10     * @note
  11     * Modifications proposées par Sébastien Tack (MrT)
  12     * Optimisation du lancement des scripts bash par la technologie asynchrone Ajax.
  13   
  14     
  15     */
  16  
  17     /**
  18  
  19     * @Repertoire: /tests/
  20     * file: test_gateway.php
  21     */
  22  
  23  
  24  
  25  require_once ('entete_ajax.inc.php');
  26  /********** Test de la conf du serveur **********************/
  27  $phpv2=preg_replace("/[^0-9\.]+/","",phpversion());
  28  $phpv=$phpv2-0;
  29  
  30  
  31  /*
  32  // Verifie la connexion a internet si ligne_internet = 0% alors on a internet
  33  $PING_INTERNET="72.14.207.99";
  34  if ($phpv>=4.2) {
  35      $PING="ping -c 1 -w 1 $PING_INTERNET | awk '/packet/ {print $6}'";
  36  } else {
  37      $PING="ping -c 1 $PING_INTERNET | awk '/packet/ {print $7}'";
  38  }
  39  */
  40  
  41  // Ping passerelle
  42  //$PING_ROUTEUR=`cat /etc/network/interfaces | grep gateway | grep -v broadcast | cut -d" " -f 2`;
  43  //$PING_ROUTEUR=trim($PING_ROUTEUR);
  44  $PING_DNS_EXT = "193.49.64.5";
  45  if ($phpv>=4.2) {
  46      $PING="ping -c 1 -w 1 $PING_DNS_EXT | awk '/packet/ {print $6}'";
  47  } else {
  48      $PING="ping -c 1 $PING_DNS_EXT | awk '/packet/ {print $7}'";
  49  }
  50  $ligne=exec("$PING",$test,$testretour);
  51  //$ok="0";
  52  /*
  53  if (($_POST['ligne_internet'] == "0%") && ($ligne == "0%")) {
  54      $ok="1";
  55  } elseif (($_POST['ligne_internet'] != "0%") && ($ligne != "0%")) {
  56      $ok="1";
  57  } elseif (($_POST['ligne_internet'] != "0%") && ($ligne == "0%")) {
  58      $ok="1";
  59  } elseif (($_POST['ligne_internet'] == "0%") && ($ligne != "0%")) {
  60      $ok="0";
  61  }
  62  */
  63  
  64  if ($ligne == "0%")
  65      echo "1";
  66  else 
  67      echo "0";
  68  ?>


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1