Robson » Code Viewer

<?
 
// ==================================================== //
// Multiple E-Mail Address Generator V1.4               //
// Created by Icey (http://iceyboard.no-ip.org)         //
// ---------------------------------------------------- //
// Purpose: To generate a random set of e-mail          //
// addressess to confuse spammer robots.                //
// http://iceyboard.no-ip.org/projects/spamgenerator/   //
// ---------------------------------------------------- //
// If you modify this, there is less chance spam robots //
// will work out they are generated, so go right ahead! //
// ==================================================== //
 
// start of code from php.net
function make_seed_spam()
{
  list($usec, $sec) = explode(' ', microtime());
  return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed_spam());
// end of code from php.net
 
// this function generates a random e-mail address and sends it back
function CreateAddress()
{
   // create the name part
   for ($i = 0; $i <= mt_rand(2, 12); $i++)
   {
       // small chance to add an underscore
       if ($i > 1 && mt_rand(1, 10) == 1)
           // add underscore to the address
           $user .= '_';
       else
           // add a random letter to the address
           $user .= chr(mt_rand(ord('a'), ord('z')));
   }
 
   // half the time...
   if (mt_rand(0,1))
       // ...add a random number to the name
       $number .= mt_rand(1, 200);
 
   // create a random domain name
   for ($i = 0; $i <= mt_rand(5, 9); $i++)
       // add a random letter of the alphabet to the string
       $domain .= chr(mt_rand(ord('a'), ord('z')));
 
   // short list of domain names
   // this should be done using array(), not explode(), but it's easier to read and modify this way
   $suffix = explode(' ', 'com org net gov edu');
 
   // return the user, an optional user number, the at symbol, the domain and a domain suffix
   return $user . $number . '@' . $domain . '.' . $suffix[array_rand($suffix)];
}
 
// a random amount
$amount = mt_rand(100, 250);
 
// output type
$output = mt_rand(0, 7);
// start the list if necessary
if ($output >= 4)
   echo '<ul>';
   
// echo out addressess a random number of times
for ($i = 0; $i <= $amount; $i++)
{
   // make up an address
   $address = CreateAddress();
   // get output type
   switch ($output)
   {
       case 0: // link
           echo '<a href="mailto:' . $address . '">' . $address . '</a> ';
       break;
       case 1: // text
           echo $address . ' ';
       break;
       case 2: // link + new lines
           echo '<a href="mailto:' . $address . '">' . $address . '</a> ' . "\n";
       break;
       case 3: // text + new lines
           echo $address . "\n";
       break;        
       case 4: // link + list item
           echo '<li><a href="mailto:' . $address . '">' . $address . '</a></li>';
       break;
       case 5: // show as text (list item)
           echo '<li>' . $address . '</li>';
       break;
       case 6: // link + list item + new lines
           echo '<li><a href="mailto:' . $address . '">' . $address . '</a></li>' . "\r\n";
       break;
       case 7: // text + list item + new lines
           echo '<li>' . $address . '</li>' . "\n";
       break;        
   }
}
 
// finish the list if necessary
if ($output >= 4)
   echo '</ul>';
 
?>