cvs: php-master-web /entry subscribe.php
| From: | Gabor Hojtsy | Date: | Sun, 10 Aug 2003 11:14:08 +0000 |
| Subject: | cvs: php-master-web /entry subscribe.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-20111@lists.php.net to get a copy of this message | ||
goba Sun Aug 10 07:14:08 2003 EDT
Added files:
/php-master-web/entry subscribe.php
Log:
Add entry point for subscriptions, which will further bolden the
role of www.php.net as "just one usual mirror". Currently mailing
list subscriptions are done through www.php.net, as we have no
requirement for mirrors to have mail support.
Index: php-master-web/entry/subscribe.php
+++ php-master-web/entry/subscribe.php
<?php
include "email-validation.inc";
// Check parameters
if (empty($_POST['request']) || empty($_POST['email']) ||
empty($_POST['maillist']) || empty($_POST['remoteip']) ||
empty($_POST['referer'])) {
die("missing some parameters");
}
// Check email address
if (!is_emailable_address($_POST['email'])) {
die("Invalid email address");
}
// Check request mode
if (!in_array($_POST['request'], array("subscribe", "unsubscribe"))) {
die("Invalid request mode");
}
// Check mailing list name
if (!preg_match("!^[a-z0-9-]+$!", $_POST['maillist'])) {
die("Invalid mailing list name");
}
// Generate needed subpart of email address
$sub = str_replace("@", "=", $_POST['email']);
// Try to send the subscription mail
$mail_sent = mail(
"{$_POST['maillist']}-{$_POST['request']}-$sub@lists.php.net",
"PHP Mailing List Website Subscription",
"This was a request generated from the form at {$_POST['referer']} by
{$_POST['remoteip']}.",
"From: {$_POST['email']}\r\n"
);
// Check if we sent mail
if (!$mail_sent) {
die("Unable to send mail");
}