 <?php
  //just a simple script to automatically generate pages to confuse crawlers, 
  //automated exploit tools and the like.
  //could use some more fake php and sql errors

  header_remove('X-Powered-By');
  header('HTTP/1.1 500 Internal Server Error');

  //our default settings
  $page_sentences_min=15;
  $page_sentences_max=50;
  $sentence_words_min=4;
  $sentence_words_max=30;
  $words=explode("\n",file_get_contents ("dictionary"));
  $sql_words=array("and","or","\\'",";","--","=1","+","from","select","as");
  $dictionary_size=count($words) -1;
?>

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='content-type' content='text/html; charset=UTF-8'>
    <title><?php
         $word_count=3 +rand(1,3);
         for ($n=1;$n<$word_count; $n++) {
            echo $words[rand(1,$dictionary_size )]," "  ;
          }
          ?></title>
  </head>
 
  <body>
<?php 

     $sentence_count=$page_sentences_min + rand(1,$page_sentences_max-$page_sentences_min);
     
    for ($i=1;$i<$sentence_count; $i++) {
      $word_count=$sentence_words_min + rand(1,$sentence_words_max-$sentence_words_min);
      echo '     ';
      
       if(rand(1,30)==14){
          switch(rand(1,3)){
          case 1:
             echo "<br><b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>";
             for ($n=1;$n<6; $n++) {
               echo "/",$words[rand(1,$dictionary_size )];
             }
             
             echo ".php</b> on line <b>",rand(1,400),"</b><br>";
          break;
          default:
             $word=$sql_words[rand(1,count($sql_words)-1)];
             echo "<br>You have an error in your SQL syntax near '",$word,"' at line ",rand(1,5),"<br>";
          }
       }else{
         for ($n=1;$n<$word_count; $n++) {
            $choice=rand(1,50);
          
   	    switch($choice){
	        case $choice <=15:
	          $idx = rand(1,$dictionary_size);
		  echo " <font color='#",dechex($idx),"'>$words[$idx].</font> ";
	          break;
	        case $choice==16:
	           echo    "<a href='mailto:",$words[rand(1,$dictionary_size )],"@", $words[rand(1,$dictionary_size )],".com'>", $words[rand(1,$dictionary_size )],"</a> ";
	           break;
	        case $choice==17:
	          echo    "<a href='http://",$words[rand(1,$dictionary_size )],".", $words[rand(1,$dictionary_size )],".com/'>", $words[rand(1,$dictionary_size )],"</a> ";
	          break;
                case $choice==18:
                  echo    "<a href='/",$words[rand(1,$dictionary_size )], $words[rand(1,$dictionary_size )],".php'>", $words[rand(1,$dictionary_size )],"</a> ";
                 break;
	        default:
	         echo $words[rand(1,$dictionary_size )]," ";
	    }
        }
      }
      echo "<br>\n";
      
      if(rand(1,4)==2){
         echo "     <br>\n";
      }
      
    }
?>
  </body>
</html>
