Advertisement
somdcomputerguy

Z:\xampp\htdocs\Rebates\file52.php

Dec 16th, 2023
945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | Source Code | 0 0
  1. <?
  2. $Day  = date("l");
  3. $Hour = date("G");
  4. if($Day != 'Sunday' && $Hour >= 6 && $Hour <= 18){
  5.     $HTML = array(
  6.             array("<a title='' target='_blank' href='https://productimageserver.com/rebates/",".pdf'>","</a>"),
  7.             array("<a href='index.php?rebates=","'>","</a>"),
  8.             array("<br><span class='rebates'>","</span><br><span class='rebatedate'>the rebate period is ","</span><br><br>"));
  9.     $MFG  = array("ACR","Blue Sea","FLIR Systems","Furuno","Garmin","KVH","Lowrance","Spot","Standard Horizon","Vesper");
  10.     $MFGlist = 'xlist.txt';
  11.  
  12.     copy("xlist.txt", "xlist.bak");
  13.  
  14.     for($i = 0; $i <= count($MFG) - 1; $i++){
  15.         if(file_exists($MFG[$i] . ".reb")){copy($MFG[$i] . ".reb", $MFG[$i] . ".reb.bak");}
  16.         $CWRfile  = $MFG[$i] . '.tab';
  17.         $Rebfile  = $MFG[$i] . '.reb';
  18.         $CWRArray = file($CWRfile);
  19.         $Rebfilehandle = fopen($Rebfile, 'w');
  20.         foreach($CWRArray as $line){
  21.             $CWRresultArray = explode("\t", $line);
  22.             if ($CWRresultArray[3] == 1){
  23.                 fwrite($Rebfilehandle, $HTML[0][0] . $CWRresultArray[0] . $HTML[0][1] . $CWRresultArray[2] . $HTML[0][2] . $HTML[2][0] . $CWRresultArray[4] . $HTML[2][1] . $CWRresultArray[5] . " to " . $CWRresultArray[6] . $HTML[2][2]);
  24.             }} fclose($Rebfilehandle);
  25.                 $OldReb = file_get_contents($MFG[$i] . ".reb.bak");
  26.                 $NewReb = file_get_contents($Rebfile);
  27.                 if($OldReb != $NewReb){
  28.                     mail("webmaster@somdcomputerguy.com", $MFG[$i] . " Change", "http://somdcomputerguy.com/Rebates/rebates.php?page=$MFG[$i]");
  29.                 }
  30.     }
  31.         $MFGlisthandle = fopen($MFGlist, 'w');
  32.         foreach(glob("*.reb") as $RebFilename){
  33.             $RebArray  = file($RebFilename);
  34.             $RebPieces = explode(".", $RebFilename);
  35.             if(filesize($RebFilename) != 0){ fwrite($MFGlisthandle, $HTML[1][0] . $RebPieces[0] . $HTML[1][1] . $RebPieces[0] . "<span class='noofrebs'> " . (count($RebArray) - 1) . '</span>' . $HTML[1][2]);
  36.              }} fclose($MFGlisthandle); }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement