cvs: pearweb /public_html account-apply.php account-request.php index.php
| From: | Stig Bakken | Date: | Sun, 29 Jul 2001 14:46:44 +0000 |
| Subject: | cvs: pearweb /public_html account-apply.php account-request.php index.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-373@lists.php.net to get a copy of this message | ||
ssb Sun Jul 29 10:46:44 2001 EDT
Added files:
/pearweb/public_html account-request.php
Removed files:
/pearweb/public_html account-apply.php
Modified files:
/pearweb/public_html index.php
Log:
* "apply for account" sounds too stiff, call it "request account"
Index: pearweb/public_html/index.php
diff -u pearweb/public_html/index.php:1.14 pearweb/public_html/index.php:1.15
--- pearweb/public_html/index.php:1.14 Sat Jul 28 22:26:17 2001
+++ pearweb/public_html/index.php Sun Jul 29 10:46:44 2001
@@ -15,7 +15,7 @@
menu_link("Documentation", "http://php.net/manual/en/pear.php");
if ($SERVER_NAME != "pear.php.net") {
- menu_link("Apply for Account", "account-apply.php");
+ menu_link("Request a PEAR Account", "account-request.php");
menu_link("Browse Packages", "packages.php");
menu_link("Want to contribute?", "signup.php");
menu_link("Upload Release", "release-upload.php");
Index: pearweb/public_html/account-request.php
+++ pearweb/public_html/account-request.php
<?php // -*- C++ -*-
require_once "HTML/Form.php";
$display_form = true;
function display_error($msg)
{
global $errorMsg;
$errorMsg .= "<FONT COLOR=\"#CC0000\"
SIZE=\"+1\">$msg</FONT><BR>\n";
}
$jumpto = "handle";
do {
if (isset($submit)) {
$required = array("handle" => "your desired username",
"name" => "your real name",
"email" => "your email address",
"purpose" => "the purpose of your PEAR account");
foreach ($required as $field => $desc) {
if (!$$field) {
display_error("Please enter $desc!");
$jumpto = $field;
break 2;
}
}
if (!preg_match("/^[a-z][a-z0-9]+$/i", $handle)) {
display_error("Username must start with a letter and contain ".
"only letters and digits.");
break;
}
if ($password != $password2) {
display_error("Passwords did not match");
$password = $password2 = "";
$jumpto = "password";
break;
}
if (!$password) {
display_error("Empty passwords not allowed");
$jumpto = "password";
break;
}
$handle = strtolower($handle);
$obj = new PEAR_User(&$dbh, $handle);
if (isset($obj->created)) {
display_error("Sorry, that username is already taken");
$jumpto = "handle";
break;
}
$err = $obj->insert($handle);
if (DB::isError($err)) {
display_error("$handle: " . DB::errorMessage($err));
$jumpto = "handle";
break;
}
$display_form = false;
$obj->name = $name;
$obj->email = $email;
$obj->homepage = $homepage;
$obj->showemail = (bool)@$showemail;
$obj->password = md5($password);
$obj->registered = false;
$admins = $dbh->getCol("SELECT email FROM users WHERE admin = 1");
$oks = 0;
$msg = "Username: {$obj->handle}\n".
"Email: {$obj->email}".
($obj->showemail ? " (show address)" : " (hide address)") .
"\n".
"Password (MD5): {$obj->password}\n\n".
"Purpose:\n".
"$purpose\n\n".
"More info:\n".
"$moreinfo\n";
$xhdr = "From: PEAR Web Site <pear-dev@lists.php.net>";
foreach ($admins as $email) {
$oks += mail($email, "PEAR Account Request", $msg, $xhdr);
}
response_header("Account Request Submitted");
if ($oks != sizeof($admins)) {
print "<H2>Possible Problem!</H2>\n";
print "Your account request has been submitted, but there ".
"was problems mailing one or more administrators. ".
"If you don't hear anything about your account in a few ".
"days, drop a mail about it to the <i>pear-dev</i> mailing ".
"list.";
} else {
print "<H2>Account Request Submitted</H2>\n";
print "Your account request has been submitted, it will ".
"be reviewed by a human. This may take from two minutes ".
"to several days, depending on how much time people have. ".
"You will get an email when your account is open, or if ".
"your request was rejected for some reason.";
}
}
} while (0);
if ($display_form) {
response_header("Apply for Account");
print "<H1>Apply for Account</H1>
Please note that you <b>not</b> need an account for
<b>downloading</b>.<br> You only need an account if you have a package
you would like to release through PEAR.
";
if (isset($errorMsg)) {
print "<TABLE>\n";
print " <TR>\n";
print " <TD> </TD>\n";
print " <TD><B>$errorMsg</B></TD>\n";
print " </TR>\n";
print "</TABLE>\n";
}
$width = 60;
$form = new HTML_Form($PHP_SELF, "POST");
$form->addText("handle", "Username", null, 12);
$form->addText("name", "Real Name", null, $width);
$form->addPassword("password", "Password", null, 10);
$form->addText("email", "Email Address", null, $width);
$form->addCheckbox("showemail", "Show Email Address?", null);
$form->addText("homepage", "Homepage", null, $width);
$form->addTextarea("purpose",
"Purpose of your PEAR account",
null, $width, 3);
$form->addTextarea("moreinfo",
"More relevant information about you (optional)",
null, $width, 3);
$form->addSubmit("submit", "Submit Request");
$form->display();
if ($jumpto) {
print "<SCRIPT LANGUAGE=\"JavaScript\">\n<!--\n";
print "document.forms[0].$jumpto.focus();\n";
print "\n// -->\n</SCRIPT>\n";
}
}
response_footer();
?>