<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if('XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH'] && true === isset($_SESSION['SessionAuth']['id']) && 0 < $_SESSION['SessionAuth']['id']) {
  if(true === isset($_POST['ping_name']) && '' != $_POST['ping_name']){
    require_once "Net/Ping.php";
    $ping = Net_Ping::factory();
    if(PEAR::isError($ping)) {
      $VarReturn = $ping->getMessage();
    } 
    else {
      $VarNumber = 3;
      if(true === isset($_POST['ping_number']) && true === is_numeric($_POST['ping_number'])){
        $VarNumber = $_POST['ping_number'];
      }
      $ping->setArgs(array('count' => $VarNumber));
      $Arr = $ping->ping($_POST['ping_name']);
      $smarty->assign('Arr', $Arr->_raw_data);
      $VarReturn = $smarty->fetch('Utils/Ping/Result.tpl');
    }
  }
  else{
    $VarReturn = $MS_SP->Sp_LangMessage['error']['ErrSettingWrong'];
  }
}
else{
  $VarReturn = $MS_SP->Sp_LangMessage['error']['ErrFuncAccessDenied'];
}
echo $VarReturn;
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>