php to ticker problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is the code (not mine) what I am trying to so is cut out all the header
info that is included in the message as shown here
http://supercool-74.com/sms/liveticker.php

The message is supposed to be terminated by the "xx" string which is defined
in config.php but it just continues and prints all the header info too.

-------------------------------------------------------------------------------------
<?php

include ("config.php");

$mbox = imap_open ("{".$pop3_server."/pop3:110}INBOX",$mailbox,$password);

$headers = imap_headers ($mbox);
$max = count($headers);

include ("head.php");

echo "<table border=\"0\" cellspacing=\"30\" cellpadding=\"0\">\n";

for ($i = $max; $i > 0; $i--)

{

 $header = imap_header ($mbox,$i);
 $from = $header->from;
 $email = $from[0]->mailbox."@".$from[0]->host;
 $date = $header->date;
 $date = split(" ",$date);
$structure = imap_fetchstructure ($mbox,$i);
$encoding = $structure->encoding;

 if ($endword)
 {
  $end = strpos(imap_body ($mbox,$i),$endword);
 }

 if ($startword)
 {
  $beginning = ereg($startword,imap_body ($mbox,$i));
  $start = strpos(imap_body ($mbox,$i),$startword);
  if ($end)
  {
   $body = substr(imap_body
($mbox,$i),$start+strlen($startword),$end-$start-strlen($endword));
  }
  else
  {
   $body = substr(imap_body ($mbox,$i),$start+strlen($startword));
  }
 }

 else
 {
  $beginning = true;

  if ($end)
  {
   $body = substr(imap_body ($mbox,$i),0,$end);
  }
  else
  {
   $body = imap_body ($mbox,$i);
  }
 }

 if (in_array ($email,$allowed_senders) && $beginning)
 {
  if ($date[1] == "1"){$date[1]="01";}
 elseif ($date[1] == "2"){$date[1]="02";}
 elseif ($date[1] == "3"){$date[1]="03";}
 elseif ($date[1] == "4"){$date[1]="04";}
 elseif ($date[1] == "5"){$date[1]="05";}
 elseif ($date[1] == "6"){$date[1]="06";}
 elseif ($date[1] == "7"){$date[1]="07";}
 elseif ($date[1] == "8"){$date[1]="08";}
 elseif ($date[1] == "9"){$date[1]="09";}

 if ($date[2] == "Jan"){$date[2]="01";}
 elseif ($date[2] == "Feb"){$date[2]="02";}
 elseif ($date[2] == "Mar"){$date[2]="03";}
 elseif ($date[2] == "Apr"){$date[2]="04";}
 elseif ($date[2] == "May"){$date[2]="05";}
 elseif ($date[2] == "Jun"){$date[2]="06";}
 elseif ($date[2] == "Jul"){$date[2]="07";}
 elseif ($date[2] == "Aug"){$date[2]="08";}
 elseif ($date[2] == "Sep"){$date[2]="09";}
 elseif ($date[2] == "Oct"){$date[2]="10";}
 elseif ($date[2] == "Nov"){$date[2]="11";}
 elseif ($date[2] == "Dec"){$date[2]="12";}

 // Decode quoted printable and base64 encoding and coding HTML special
charakters

if ($encoding == 4)
 {
  $body = htmlentities(quoted_printable_decode($body), ENT_QUOTES);
 }
 elseif ($encoding == 3)
 {
  $body = htmlentities(base64_decode($body), ENT_QUOTES);
 }
 else
 {
  $body = htmlentities($body, ENT_QUOTES);
 }

 // Line breaks

 $body = eregi_replace("\*br","\n<br>",$body);

 echo "<tr>\n";
 echo "<td nowrap valign=\"top\"><b>".$date[0]."
".$date[1].".".$date[2].".".$date[3]."<br>\n".$date[4]."</b></td>\n";
 echo "<td valign=\"top\">+++ ".$body." +++</td>\n</tr>\n";

 $beginning = false;

}
}

echo "</table>\n";



// Copyright reference must not be removed:

?>

<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

<?php

imap_close ($mbox);

// Link to admin page

echo "<p>&nbsp;</p>";
echo "<p><a href=\"admin.php\">=> Admin</a></p>";

include ("foot.htm");

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux