<?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['traceroute_name']) && '' != $_POST['traceroute_name']){
    require_once "Net/Traceroute.php";
    $traceroute = Net_Traceroute::factory();
    if(PEAR::isError($traceroute)) {
      $VarReturn = $traceroute->getMessage();
    } 
    else {
      $traceroute->setArgs(array('numeric' => NULL));
      $Arr = $traceroute->traceroute($_POST['traceroute_name']);
      $smarty->assign('Arr', $Arr->_raw_data);
      $VarReturn = $smarty->fetch('Utils/Traceroute/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');
?>