#web2mail2news.php copyright 9/2000 shaun@shat.net http://shat.net/php
#This script may be FREELY DISTRIBUTED with all headers intact.
#Until I rewrite my scripts, this will suffice for bg-compatibility;
if(phpversion() >= "4.2.0"){
extract($_POST);
extract($_SERVER);
extract($_ENV);
}
function post_it(){
global $subject, $message, $from, $newsgroups;
if (! ($from && $newsgroups && $subject && $message) ){
echo "You didn't fill out all the fields. Try again.
";
exit;
}
#Un-escape any quotes/apostrophes in the input
$subject = str_replace("\\\"", "\"", $subject);
$subject = str_replace("\\'", "'", $subject);
$message = str_replace("\\\"", "\"", $message);
$message = str_replace("\\'", "'", $message);
#If you don't want random Message-IDs, comment out the next
#five lines of code.
srand ((double) microtime() * 1000000);
for ($c=1;$c<16;$c++){
$randnum = rand(1,9);
$id .= $randnum;
}
$to = "mail2news@dizum.com";
$senddate = (date("d M Y h:m:s -0500"));
$headers = "From: $from\nDate: $senddate\nNewsgroups: $newsgroups\n";
if ($id)
$headers .= "Message-ID: <$id.Post@ithinknot.net>\n";
$headers .= "X-No-Archive: Yes";
if(!(mail($to, $subject, $message, $headers)))
echo "Unable to send mail, your post was not made.
";
else
echo "Your message will appear in Usenet shortly.
";
}
print <<
Web2News
EOT;
if($posted)
post_it();
print <<