| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /software/smsc smpp installer/software/Services/EmailPenpalAfrica/php/ |
Upload File : |
<?PHP
//$contents = '<Node>IMEI<Tariff>OfferConnectedDedicatedAccounts<Offer ID="203000"><DA ID="203000" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff><Tariff>OfferConnectedDedicatedAccounts<Offer ID="203001"><DA ID="203001" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff></Node><Node>ME2U<Tariff>OfferConnectedDedicatedAccounts<Comment>Me2U_24Hrs_100Rwf</Comment><Offer ID="206000"><DA ID="206000" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff><Tariff>OfferConnectedDedicatedAccounts<Comment>Me2U_24Hrs_200Rwf</Comment><Offer ID="206004"><DA ID="206004" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff><Tariff>OfferConnectedDedicatedAccounts<Comment>Me2U_24Hrs_1000Rwf</Comment><Offer ID="206001"><DA ID="206001" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff><Tariff>OfferConnectedDedicatedAccounts<Offer ID="206002"><DA ID="206002" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff><Tariff>OfferConnectedDedicatedAccounts<Offer ID="206003"><DA ID="206003" Priority="1"/><DedicatedAccountSelectionRule>1</DedicatedAccountSelectionRule><IncludeMainAccount>0</IncludeMainAccount></Offer></Tariff></Node>';
$filename = "DA_89.xml";
$fp = fopen($filename, "r");//open file in read mode
//var_dump($fp);
$contents = fread($fp, filesize($filename));//read file
//echo $contents;
//exit();
$cnt=1;
$cnt1=0;
$tdf_id_start =1;
while ($cnt ==1){
$tdf_id_first = strpos($contents,'<Tariff>OfferConnectedDedicatedAccounts<Offer ID="',$tdf_id_start);
$tdf_id_second = strpos($contents,'"><',$tdf_id_first);
$offer = substr($contents,$tdf_id_first+50,$tdf_id_second-($tdf_id_first+50));
$replac_str1= "<Node>offer $offer<Condition>ActiveOffer<ActiveOffer>$offer</ActiveOffer></Condition>";
$replac_str2= "</Node>";
//first insert
if($tdf_id_first>0){
$contents =substr_replace($contents, $replac_str1, $tdf_id_first, 0);
$tdf_id_third = strpos($contents,'</Offer></Tariff>',$tdf_id_first);
$contents =substr_replace($contents, $replac_str2, $tdf_id_third+17, 0);
}
$tdf_id_start= $tdf_id_third+17;
$tdf_id_second=0;
//$cnt= $tdf_id_start;
if($tdf_id_first>0)
$cnt=1;
else
$cnt=0;
//echo $cnt1++;
// echo "first".$tdf_id_first."offer".$offer;
//if($cnt1>40)
// die();
}
// look for those with comments
$cnt=1;
$tdf_id_start =1;
while ($cnt ==1){
$tdf_id_first = strpos($contents,'<Tariff>OfferConnectedDedicatedAccounts<Comment>',$tdf_id_start);
$tdf_id_fourth = strpos($contents,'<Offer ID="',$tdf_id_first);
$tdf_id_second = strpos($contents,'"><DA ID="',$tdf_id_first);
$offer = substr($contents,$tdf_id_fourth+11,$tdf_id_second-($tdf_id_fourth+11));
$replac_str1= "<Node>offer $offer<Condition>ActiveOffer<ActiveOffer>$offer</ActiveOffer></Condition>";
$replac_str2= "</Node>";
//first insert
if($tdf_id_first>0){
$contents =substr_replace($contents, $replac_str1, $tdf_id_first, 0);
$tdf_id_third = strpos($contents,'</Offer></Tariff>',$tdf_id_first);
$contents =substr_replace($contents, $replac_str2, $tdf_id_third+17, 0);
}
$tdf_id_start= $tdf_id_third+17;
$tdf_id_second=0;
//$cnt= $tdf_id_start;
if($tdf_id_first>0)
$cnt=1;
else
$cnt=0;
}
$fp = fopen('da_output.txt', 'a');
fwrite($fp,$contents);
echo "Done";
exit();
$filename = "tariff_tdf.xml";
$fp = fopen($filename, "r");//open file in read mode
$contents = fread($fp, filesize($filename));//read file
$cnt=0;
$tdf_id_start =1;
while ($cnt <621){
//$tdf_id_first = strpos($contents,'</Tariff></Node></Node></Node><Node>',$tdf_id_start);
//$tdf_id_second = strpos($contents,'<Node id="UC/UT">',$tdf_id_first);
$tdf_id_first = strpos($contents,'<Tariff>OfferConnectedDedicatedAccounts<Offer ID="',$tdf_id_start);
$tdf_id_second = strpos($contents,'"><DA ID="',$tdf_id_first);
$tdf_id_third = strpos($contents,'</Offer></Tariff>',$tdf_id_first);
//echo "<pre>$tdf_id_first</pre>";//printing data of file
//echo "<pre>$tdf_id_second</pre>";//printing data of file
$offer = substr($contents,$tdf_id_first+50,$tdf_id_second-($tdf_id_first+50));
if($tdf_id_second>1){
$replac_str1= "<Node>offer $offer<Condition>ActiveOffer<ActiveOffer>$offer</ActiveOffer></Condition>";
$replac_str2= "</Node>";
//first insert
substr_replace($str, $substr, 9, 0);
}
$tdf_id_start= $tdf_id_second;
$tdf_id_second=0;
$cnt++;
}
fclose($fp);//close file
?>