header ("Content-Type: text/xml");
$fpara = fopen("param.ini", "r");
$ip= fgets($fpara);
fclose($fpara);
//$ip=substr($ip,10);
if(isset($_GET['name']))
$sep= $_GET['name'];
else{
$sep="";
}
if(isset($_GET['pwd']))
$pwd=$_GET['pwd'];
else{
$pwd="";
}
if ($sep=="")
{
echo ("\r\n");
echo ("N° de ligne non indiqué\r\n");
echo ("N° de ligne non indiqué\r\n");
echo ("\r\n");
exit();
}
//--------------------------------------------------------------------------
if (file_exists("codage.tcs"))
$fp = fopen("codage.tcs", "r");
else
{
//echo "fichier n'existe pas!!!";
echo ("\r\n");
echo ("fichier n'existe pas!!!\r\n");
echo ("fichier n'existe pas!!!\r\n");
echo ("\r\n");
exit();
}
//-----------------------------------------------------------------------
if (file_exists("pwd".$sep.".txt"))
{
$fp = fopen("pwd".$sep.".txt", "r");
$ligne1=fgets($fp,255);
$ligne1=trim($ligne1);
//.................................................
if ($ligne1==$sep.",".$pwd )
{
}
else
{
echo ("\r\n");
echo ("password incorrrrrect\r\n");
echo ("password incorrect\r\n");
echo ("\r\n");
fclose($fp);
exit();
}
//.................................................
//-----------------------------------------------------------------------
$ligne1="";
$fp = fopen("codage.tcs", "a+");
while(!feof($fp))
{
$i=0;
while($i<1)
{
$ligne1=fgets($fp,255);
$ligne2=fgets($fp,255);
$ligne3=fgets($fp,255);
$ligne4=fgets($fp,255);
$ligne5=fgets($fp,255);
$cible = (string)$ligne2;
$cib=trim($cible);
$cib="C:\datawtx\b".$sep.".txt";
if (file_exists($cib))
{
if(trim($ligne1)==trim($sep))
{
if (file_exists($cib))
{
$fp2 = fopen($cib,'r');
$het=fgets($fp2,4000);
$t="Ligne : ".substr($het,0,5)."\r\n"."Budget : ".substr($het,5,10)."DT\r\n"."Consommé : ".substr($het,15,10)." DT";
$u=floatval(substr($het,5,10))-floatval(substr($het,15,10));
$v=substr($het,15,10);
//echo ($t);
//*************************************************************************************
echo ("\r\n");
///echo ("Budget du poste : ".substr($het,0,5)."\r\n");
echo ("Votre solde est : ".$u." DT\r\n");
echo ("".$t."\r\n");
//--------------
//--------------
//--------------
echo ("\r\n");
echo ("Detail\r\n");
//echo ("http://127.0.0.1/Services_Cisco/ip_detail.php?name=".$sep."&pwd=".$pwd."&vvv=".$v."\r\n");
echo ("http://".$ip."/Services_Cisco/ip_detail.php?name=".$sep."&pwd=".$pwd."\r\n");
echo ("1\r\n");
echo ("\r\n");
//--------------
echo ("\r\n");
echo ("EXIT\r\n");
echo ("SoftKey:Exit\r\n");
echo ("5\r\n");
echo ("\r\n");
//--------------
echo ("\r\n");
echo ("Stat.\r\n");
echo ("http://".$ip."/Services_Cisco/gr1.php?name=".$sep."&pwd=".$pwd."\r\n");
echo ("4\r\n");
echo ("\r\n");
//echo ("\r\n");
//--------------
echo ("\r\n");
echo ("Recap.\r\n");
echo ("http://".$ip."/Services_Cisco/gr2.php?name=".$sep."&pwd=".$pwd."\r\n");
echo ("3\r\n");
echo ("\r\n");
echo ("\r\n");
//***************************************************
fclose($fp2);
exit();
}
else
{
//"Budget non encore alloué !");
echo ("\r\n");
echo ("budget non alloue\r\n");
echo ("budget non alloue\r\n");
//--------------
//--------------
echo ("\r\n");
exit();
}
}
}
//////////////////////////////////////////////
else
$i=$i+1;
}
}
}
else
{
fclose($fp);
echo ("\r\n");
echo ("Poste non configuré\r\n");
echo ("Poste non configuré\r\n");
echo ("\r\n");
exit();
}
/////////////////////////////////////////////////
?>