///////////////////////////////////////////////////////////////////////////////////
// //
// phpBoard -- Copyright (c) 2000 by Nathan Clemons //
// nathan@thelinuxcommunity.org //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// //
///////////////////////////////////////////////////////////////////////////////////
require "config_inc.php3";
require $inc_dir . "sql_inc.php3";
require $inc_dir . "lib_inc.php3";
require $inc_dir . $user_lib;
$title = "New Account @ $site_name";
include $inc_dir . "header.php3";
top_bar();
$db_link = SQL_connect();
$create_sub = 'create_sub' . $ext;
$j = 0;
$k = 0;
if ($signup_requires_confirmation) {
$random_pw = "";
// seed the random number generator
srand ((double) microtime() * 1000000);
for ($i = 0; $i < 8; $i++) {
if ($i % 2) {
$k++;
if ($k % 2) {
$s = rand(0,9);
list ($s1) = split("\.", $s, 1);
} else {
$s = rand(0,27);
list ($s1) = split("\.", $s, 1);
if ($s1 > 21) {
$s1 = chr($s1 + 69);
} else if ($s1 > 14) {
$s1 = chr($s1 + 44);
} else {
$s1 = chr($s1 + 33);
}
}
} else {
$j++;
$s = rand(0,26);
list ($s1) = split("\.", $s, 1);
if ($j % 2) {
$s1 = chr($s1 + 65);
} else {
$s1 = chr($s1 + 97);
}
}
$random_pw .= $s1;
}
}
print("
\n");
print("| Creating New User Account |
\n");
if ($new_user == "") {
print("| Blank username, click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
} else if (eregi($user_regex, $new_user)) {
print("| Username contains invalid characters, please click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
} else {
print("| Username | $new_user |
\n");
}
if ($new_email == "") {
print("| Blank email address, click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
} else {
if (valid_email($new_email)) {
print("| Email Address | $new_email |
\n");
} else {
print("| Invalid email address, click back and try again. Reported to $site_admin for verification in case this in error. |
\n");
include $inc_dir . "footer.php3";
$subject = "[phpBoard] New Account Invalid Email";
$xMailer = "X-Mailer: PHP3 Mailer Tool v.1.0\n";
$xLoop = "X-Loop: phpBoard $site_name\n";
$mailfrom = "From: $site_admin <$site_email>\n";
$mailbcc = "Bcc: $site_email";
$message = "Invalid email suggested:\n";
$message .= " $new_email\n";
$hdrs = $mailfrom . $xMailer . $xLoop . $mailbcc;
mail($mailto, $subject, $message, $hdrs);
exit;
}
}
if ($new_real == "") {
print("| Blank real name, click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
} else {
print("| Real Name | $new_real |
\n");
}
if (!$signup_requires_confirmation) {
if ($new_pass == "") {
print("| Blank password, click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
}
if ($new_pass != $new_pass1) {
print("| Password mismatch, click back and try again. |
\n");
include $inc_dir . "footer.php3";
exit;
}
$len = strlen($new_pass);
$str = "";
for ($i = 0; $i < $len; $i++) {
$str .= "*";
}
print("| Password | $str |
\n");
$subject = "[phpBoard] New User Notification";
$xMailer = "X-Mailer: PHP3 Mailer Tool v.1.0\n";
$xLoop = "X-Loop: phpBoard $site_name\n";
$mailfrom = "From: $site_admin <$site_email>\n";
$mailbcc = "Bcc: $site_email";
$message = "Pertinent information is as follows:\n";
$message .= "User Name : $new_user\n";
//$message .= "Password : $new_pass\n";
$message .= "Email Address : $new_email\n";
$message .= "Real Name : $new_real\n";
$message .= "\n";
$hdrs = $mailfrom . $xMailer . $xLoop . $mailbcc;
$pw_to_add = make_pw($new_pass);
} else {
$pw = $random_pw;
$pw = ereg_replace("<", "<", $pw);
$pw = ereg_replace(">", ">", $pw);
print("| Password | $pw |
\n");
$subject = "[phpBoard] New User Confirmation";
$xMailer = "X-Mailer: PHP3 Mailer Tool v.1.0\n";
$xLoop = "X-Loop: phpBoard $site_name\n";
$mailfrom = "From: $site_admin <$site_email>\n";
$mailbcc = "Bcc: $site_email, $new_email";
$message = "Welcome! Someone, possibly you, has requested an account on The Linux\n";
$message .= "Community's message board system (phpBoard).\n";
$message .= "\n";
$message .= "Pertinent information is as follows:\n";
$message .= "User Name: $new_user\n";
$message .= "Password : $random_pw\n";
$message .= "Real Name: $new_real\n";
$message .= "\n";
$message .= "You can access your account at:\n";
$message .= "$site_url/login." . $ext . "\n";
$message .= "\n";
$message .= "Please feel free to email us if you have any problems.\n";
$message .= "\n";
$hdrs = $mailfrom . $xMailer . $xLoop . $mailbcc;
$pw_to_add = make_pw($random_pw);
}
$statement = "INSERT INTO $user_table_name ($user_account_field, $passwd_field, $admin_field, $email_field, $user_name_field, $image_field) VALUES ('$new_user', '$pw_to_add', 0, '$new_email', '$new_real', '$new_img')";
$res = SQL_query($statement, $db_link);
$aff_rows = SQL_get_aff_rows($db_link, $res);
// mail is down here so emails are only send if there were no errors.
mail($mailto, $subject, $message, $hdrs);
print("\n");
include $inc_dir . "footer.php3";
?>