//insert into read_body.php //generally it can be pasted many places, but I put it after: //displayPageHeader($color, $mailbox); //formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response); //formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee); //TPH if (strlen($notph)==0) { sqgetGlobalVar('deletespam',$deletespam); //echo 'deletespam='.$deletespam.'
'; if (strlen($deletespam)>0) { //add link to spambody $fptr=fopen("spambody.txt","a"); $newstr=$deletespam.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } if (strlen($spamimage)>0) { //add part of image to spambody $fptr=fopen("spambody.txt","a"); $newstr=$spamimage.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } if (strlen($spamsubject)>0) { //add part of image to spambody $fptr=fopen("spamsubject.txt","a"); $newstr=$spamsubject.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } //add typed in spam word if (strlen($spamword)>0) { //add spamword to spambody $fptr=fopen("spambody.txt","a"); $newstr=$spamword.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } //add typed in spam subject if (strlen($spamsub)>0) { //add spamword to spamsubject $fptr=fopen("spamsubject.txt","a"); $newstr=$spamsub.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } //add typed in spam combo if (strlen($spamcombo)>0) { //add spamword to spamsubject $fptr=fopen("spamcombo.txt","a"); $newstr=$spamcombo.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } //add typed in spam email if (strlen($spamemail)>0) { //add spamword to spamsubject $fptr=fopen("spamemail.txt","a"); $newstr=$spamemail.chr(10); fwrite($fptr,$newstr,strlen($newstr)); fclose($fptr); } //link for spam image echo '
'; $mbox = imap_open("{yourwebpage.com/pop3:110/notls}INBOX", "your_main_email_account_to_process_for_spam@yourwebpage.com", "yourpassword") or die("Can't connect: " . imap_last_error()); //echo imap_num_msg($mbox).'
'; //echo $passed_id.'
'; $body=imap_body($mbox,$passed_id); //get body of this email mesg $nummsg=imap_num_msg($mbox); $header = imap_headerinfo($mbox, $passed_id, 80, 80); $subject = trim($header->fetchsubject); imap_close($mbox); //dont close? $lenbody=strlen($body); $bodypart=substr($body,rand(0,$lenbody-10),10); if ($showbody) { $newbody=ereg_replace("body=
'.$newbody.'
'; } //echo 'num messages='.$nummsg.' passed_id+1='.($passed_id+1).'
'; if ($passed_id+1>$nummsg) $next_id=$passed_id; else $next_id=$passed_id+1; echo 'spam image: '.$bodypart.'
'; echo 'show body
'; if ($showmsgbody) echo '
messagebody=
'.$messagebody.'
'; //echo 'show message body
'; echo 'spam subject: '.$subject.'
'; echo 'no TPH text
'; //list links in email //a subtle point is that ".*" does not work because this matches even quotes in between two quotes, [^"] all chatacters except a double quote must be included //ereg('href=\"[^\"]*[\"]*',$messagebody,$match); //ereg('[href]*[src]*=\"[^\"]*[\"]*',$body,$match); //ereg('href=\"[^\"]*[\"]*',$body,$match); //ereg('href=\"[^\"]*[\"]*',$messagebody,$match); //preg_match_all('/src=*\"[^\"]*[\"]*/',$messagebody,$match); //$body=ereg_replace("\=\ ","",$body); //in body "= " appears for some reason //preg_match_all('/(href=|src=)\"[^\"]*[\"]*/',$body,$match); //preg_match_all('/(href=|src=)[^\"]*\"[^\"]*[\"]*/',$body,$match); //preg_match_all('/(href=|src=|http)[^\"]*\"[^\"]*[\"]*/i',$body,$match); //preg_match_all('/(href=|src=|http:\/)[^\"]*\"*[^\"]*[^\.\/]+\.[^\.\/]+[\"]*/i',$body,$match); //preg_match_all('/(href=|src=|http:)\/+[^\/]+/i',$body,$match); preg_match_all('/(href=|src=|http:)\/+[^\/\"]+/i',$body,$match); //echo 'match[0]='.$match[0][0].'
'; //echo 'match[1]='.$match[0][1].'
'; //echo 'match[0]='.$match[0].'
'; //echo 'match[1]='.$match[1].'
'; if (strlen($match[0][0])>0) { //ignore href="download.php" //$match[0][0]=ereg_replace("/squirrelmail/src/compose.php\?send_to\=","",$match[0][0]); //remove email header to get to link for spam email address in body if (!ereg("href=\"download.php",$match[0][0])) { for($i=0;$inmatch[$i]=$nmatch[$i]
"; $nmatch[$i]=ereg_replace("\"","",$nmatch[$i]); //remove last quote //echo strlen(ereg("/",$match[$i])).'
'; if (ereg("/",$nmatch[$i])) ereg('[^/]*/',$nmatch[$i],$match2); //remove anything after first / if there is a / else $match2[0]=$nmatch[$i]; //echo "match2[0]=$match2[0]
"; ereg('[^\.]*\.[^\.]*$',$match2[0],$match3); //get only "xyz.com" of link //$match3[0]=ereg_replace("/","",$match3[0]); //remove last / //echo "match3[0]=$match3[0]
"; if (ereg("%40.*",$match3[0])) ereg("%40.*",$match3[0],$match2); //anything after @ symbol %40 for email spam in body else $match2[0]=$match3[0]; $match2[0]=ereg_replace("%40","",$match2[0]); //remove last %40 (@) $match2[0]=ereg_replace("/","",$match2[0]); //remove last / //echo "link ".($i+1).": $match2[0]
"; echo 'spam link: '.$match2[0].'
'; } //foreach }//download.php } //strlen(match[0] //email address in body //preg_match_all('/[^@]@[^\.]\.[^\.]/',$body,$match); //preg_match_all('/[^@ ]+@[^\ ]+/',$body,$match); preg_match_all('/[^@ \n]+@[^\ \n]+/',$body,$match); //echo 'match[0]='.$match[0][0].'
'; for($i=0;$ispam body email: '.$match[0][$i].'
'; } //add submit button to enter text to add to spambody.txt //echo '
'; echo ''; echo ''.$cr; echo ''.$cr; echo ''.$cr; echo ''.$cr; echo ''.$cr; echo ''.$cr; echo ' '; echo '
'; //href="?passed_id='.$next_id.'&mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage.'&show_more='.$show_more.'&&deletespam='.urlencode($match2[0]).'">spam link: '.$match2[0].'
'; //add submit button to enter text to add to spamsubject.txt //echo ''; echo ' '; echo '
'; //href="?passed_id='.$next_id.'&mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage.'&show_more='.$show_more.'&&deletespam='.urlencode($match2[0]).'">spam link: '.$match2[0].'
'; echo ' '; echo '
'; echo ' '; echo '
'; echo '
'; } //notph //end TPH