Location: PHPKode > scripts > Anti-Spam > anti-spam/anti-spam.class.php
<?

/*

Script by Stanga Razvan (hide@address.com)
* uses Crypt class by Michael Dransfield <hide@address.com> for Advanced Anti-Spam

*/

class AntiSpam {

   var $antispamemail;

   function email ( $email, $name='' ) {
       global $crypt;
       
       $random = mt_rand (1,5);
       
       if ($random == 1) { // Simple Anti-Spam

             $a = explode ('@', $email);

             $buildA = $a[0];
           
             $buildB = "'". $a[1] . "'";

             if ($name == '') {$Name = "'". $buildA ."' + '@' + ". $buildB;} else {$Name = "'". $name ."'";}
           
             $this->ASmail ($buildA, $buildB, $Name);

           } elseif ($random == 2) { // Medium Anti-Spam

             $a = explode ('@', $email);

             $buildA = $a[0];

             $b = explode ('.', $a[1]);

             foreach ($b as $c) {
                 $buildB .= "'".$c."' + '.' +";
                 }

             $buildB = substr ($buildB, 0, -7);

             if ($name == '') {$Name = "'". $buildA ."' + '@' + ". $buildB;} else {$Name = "'". $name ."'";}

             $this->ASmail ($buildA, $buildB, $Name);

           } elseif ($random == 3) { // Medium Anti-Spam

             $a = explode ('@', $email);

             $buildA = $a[0];

             $buildB = "'REMOVE.". $a[1] ."'";

             if ($name == '') {$Name = "'". $buildA ."' + '@' + ". $buildB;} else {$Name = "'". $name ."'";}

             $this->ASmail ($buildA, $buildB, $Name);

           } elseif ($random == 4) { // Advanced Anti-Spam

             $a = explode ('@', $email);

             $buildA = ($a[0]);

             $buildB = ("'". $a[1] ."'");

             if ($name == '') {$Name = "'". $buildA ."' + '@' + ". $buildB;} else {$Name = "'". $name ."'";}
             
             $this->ASmail ($buildA, $buildB, $Name);
             
             //return $this->antispamemail;
             $crypt->HTML_Crypt($this->antispamemail, 1);
             return $crypt->output();

           } elseif ($random == 5) { // Advanced Anti-Spam

             $a = explode ('@', $email);

             for ( $i=0; $i < strlen ( $a[0] ); $i++ ) {

             $buildA .= "&#". ord( substr($a[0], $i) ) .";";
             
             }
             
             for ( $i=0; $i < strlen ( $a[1] ); $i++ ) {

             $buildB .= "&#". ord( substr($a[1], $i) ) .";";

             }
             
             $buildB = "'". $buildB ."'";
             
             if ($name != '') {

             for ( $i=0; $i < strlen ( $name ); $i++ ) {

             $Name .= "&#". ord( substr($name, $i) ) .";";

             }
             
             $Name = "'". $Name ."'";

             } else {$Name = "'". $buildA ."' + '@' + ". $buildB;}
             
             $this->ASmail ($buildA, $buildB, $Name);

           }
           
   return $this->antispamemail;
           
   }
   
   function ASmail ($buildA, $buildB, $Name) {

   $this->antispamemail = "<SCRIPT LANGUAGE=\"JavaScript\">\r\ndocument.write('<a href=\"' + 'mailto:' + '". $buildA ."' + '@' + ".$buildB." + '\">' + ". $Name ." + '</a>');\r\n</script>";

   }


}

?>
Return current item: Anti-Spam