Advertisement
phpaddict

Generate random readable email address

Jul 9th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. // create a readable email for harvesters
  2. // parts of the script taken from http://snipplr.com/view/18517/human-readable-random-string/
  3. function create_random_readable_email()
  4. {
  5.     $domains = array('gmail.com', 'hotmail.com', 'mail.com', 'yahoo.com', 'outlook.com'); // add as many domains as you want
  6.     $conso = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z');
  7.     $vocal = array('a', 'e', 'i', 'o', 'u');
  8.     $email_prefix = '';
  9.     srand ((double)microtime() * 1000000);
  10.     $str_length = rand(5, 10);
  11.     for($i = 1; $i <= $str_length / 2; $i++)
  12.     {
  13.         $email_prefix .= $conso[rand(0, 19)];
  14.         $email_prefix .= $vocal[rand(0, 4)];
  15.     }
  16.  
  17.     if (time() % 2 == 0) // add suffix numbers randomly
  18.     {
  19.         $numbers_length = rand(2, 4);
  20.         for($i = 0; $i < $numbers_length; $i++)
  21.         {
  22.             $email_prefix .= mt_rand(0, 9);
  23.         }
  24.     }
  25.  
  26.     $domain = $domains[rand(0, count($domains) - 1)];
  27.  
  28.     return $email_prefix . '@' . $domain;
  29. }
  30.  
  31. print_r(create_random_readable_email());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement