Location: PHPKode > scripts > Anti Spam Bot Email by ASCII > anti-spam-bot-email-by-ascii/antiSpamEmail-IFLashLord-php4.php
<?php
/**
 +-------------------------------------------------------------------------
 +---------------------->> In The Name Of Allah <<-------------------------
 +-------------------------------------------------------------------------
 | Class AntiIFLSpamBotEmail version 0.0.1 (for php 4)
 | Security Email Print 100% Protected For Spam Bot
 | Anti Span Bot Email by ASCII
 | Author  Behrouz Pooladrag  (IFLashLord) <Me [at] IFLashLord [dot] Com>
 | Email bugs/suggestions to  Me [at] iflashlord.com
 | Copyright (c) 2008 By Behrouz Pooladrag ,IFLashLord Co.
 +-------------------------------------------------------------------------
 | This script has been created and released under
 | the GNU GPL and is free to use and redistribute
 | only if this copyright statement is not removed
 +-------------------------------------------------------------------------
 +--------------| Contact 2 Behrouz Pooladrag |----------------------------
 | Email : Me [ at ] IFLashLord [dot] Com
 | WebSite : http://www.IFLashLord.Com
 | Yahoo : BehrouzPC [at] yahoo.Com
 | G-Mail : FLashLordX [at] gmail.Com
 | Mobile : +98 913 12 777 14
 +-------------------------------------------------------------------------
 | (Zakate Elame Nasher Aan Ast )
 +-------------------------------------------------------------------------
**/
/*
 +--------------| arguments |----------------------------------------------
 |*new AntiIFLSpamBotEmail (string [Email Address for AntiSpam]);
 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 |*AntiIFLSpamBotEmail->antispambot([integer Number]);
 | Number 0  ---> For Show Email text Print
 | Number 1  ---> For Set Email to Link (mailto:..)
 | Number 2  ---> Return Randomly Part Of Eamil in Hexadecimal
 +-------------------------------------------------------------------------
*/



/* Full Exampel of This Class

$antiSpambotBehrouzpc=new AntiIFLSpamBotEmail("hide@address.com"); //start class
$EmailForShow=$antiSpambotBehrouzpc->antispambot(0);  // for show mode return
$EmailForLink=$antiSpambotBehrouzpc->antispambot(1);  // for link mode return
print "<a href='mailto:".$EmailForLink."'>".$EmailForShow."</a>"; //and Print

*/

/* Result is this Type

<a href='mailto:&#98;&#101;h&#114;%6f%75zpc&#64;y&#97;%68o&#111;%2e&#99;%6f%6d'>
&#98;eh&#114;&#111;&#117;&#122;pc&#64;&#121;aho&#111;.&#99;om</a>

*/

/////////////////////////////////////////////////////


//Start Class
class AntiIFLSpamBotEmail {

var $VERSION = '0.0.1';
var $emailaddy;

	//construct
	function AntiIFLSpamBotEmail ($emailaddy) {
	   $this->emailaddy=$emailaddy;
	}//end function construct

	//function to add leading zeros when necessary
	function zeroise($number,$threshold) {
		return sprintf('%0'.$threshold.'s', $number);
	}//end function

    //function to change words To ASCII Random
	function antispambot($mailto=0) {
		$emailNOSPAMaddy = '';
		srand ((float) microtime() * 1000000);
		for ($i = 0; $i < strlen($this->emailaddy); $i = $i + 1) {
			$j = floor(rand(0, 1+$mailto));
			if ($j==0) {
				$emailNOSPAMaddy .= '&#'.ord(substr($this->emailaddy,$i,1)).';';
			} elseif ($j==1) {
				$emailNOSPAMaddy .= substr($this->emailaddy,$i,1);
			} elseif ($j==2) {
				$emailNOSPAMaddy .= '%'.$this->zeroise(dechex(ord(substr($this->emailaddy, $i, 1))), 2);
			}
		}
		$emailNOSPAMaddy = str_replace('@','&#64;',$emailNOSPAMaddy);
		return $emailNOSPAMaddy;
	}//end function

}//end Class

?>
Return current item: Anti Spam Bot Email by ASCII