'') { $receivedtext=$_REQUEST["submittedtext"]; file_put_contents("$basedir/received.txt",$receivedtext); } else { $receivedtext=""; } ?> Word Eater

Welcome to the Word Eater

at

= 100) { $to = "recipient@example.com"; $subject = "Wordeater submission ".date("dMY H:i:s"); $message = "PHP received ".date("dMY H:i:s")."
\n".htmlentities($receivedtext).""; $from = "sender@example.com"; $headers = "From: " . $from . "\r\n"; $headers .= "Reply-To: ". $from . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($to,$subject,$message,$headers); print "
Mail Sent
\n"; $newname="ready.".date("dMY.H.i.s"); rename("$basedir/received.txt","$basedir/".$newname); print "
Thanks for your submission. It has been saved and will count towards words in your bank.
\n"; $fh=fopen("$basedir/banked_word_count.txt","w"); $receivedtext=$_SERVER['REMOTE_ADDR']." submitted at ".date("dMY H:i:s")."\n".$receivedtext; fwrite($fh,(str_word_count($receivedtext)+$bankedwordcount)); fclose($fh); $receivedtext=""; } else { print "
Waiting for submission of 100 words or more.
\n"; } if ($receivedtext<>"") { print "
Thanks, I received ".(str_word_count($receivedtext))." words.
\n"; } $bwc=0; if ($handle = opendir("$basedir/")) { $bwc=0; while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && strstr($entry,"ready.")) { $savedtext=file_get_contents("$basedir/".$entry); $bwc=$bwc+(str_word_count($savedtext)); print "\n"; } } print "\n"; if ($bwc >= 100) { print "
You currently have ".($bwc - 100)." words in the bank.
\n"; }else { print "
You need 100 words to reactivate the Internet.
\n"; } if ( $bwc > 100 ) { $minutesremain=($bwc - 100)* 10; print "
Time will run out around ".date("g:i A, l, F d, Y",strtotime("+$minutesremain minutes"))."
\n"; } ?>

I require words every day in order to provide a connection to the Internet. Fill in the blank below with an email to be sent to the administrator. So long as you have words in the bank, internet access is turned on. When you run out, internet access is turned off. I will only take your submission when you send me 100 words or more. But beware! If the administrator dislikes your submission, you may find that you suddenly have less words in your bank. Submissions are sent immediately but it make take up to 10 minutes to reactivate an inactive connection.


Hungry!
"; } elseif ($bwc < 200) { print "hungry.jpg\">
Kinda hungry"; } else { print "nothungry.jpg\">
Not hungry"; } print "\n"; $fh=fopen("$basedir/banked_word_count.txt","w"); fwrite($fh,($bwc)); fclose($fh); closedir($handle); } if (file_exists("$basedir/status.txt")) { print "
Current Internet Status:
\n"; print str_replace("\n","
\n",htmlentities(file_get_contents("$basedir/status.txt"))); print "
\n"; } if (file_exists("$basedir/note.txt")) { print "
Notes:
\n"; print htmlentities(file_get_contents("$basedir/note.txt")); print "
\n"; } ?>

words to go before your submission might go through.