Login($_POST['txtUsername'], md5($_POST['txtPassword'])); if ($user->LoggedIn == 0) $_SESSION["error"] = "

Invalid username/password

"; else { $ref = $_GET['ref']; if ($ref == '') $ref = "/"; header("location: " . $ref); } } else { // Register if ($_POST['txtNewPwd'] != $_POST['txtConfNewPwd']) { $_SESSION["error"] = "

Passwords do not match

"; } else if (strlen($_POST['txtNewPwd']) < 6) { $_SESSION["error"] = "

Password must be at least 6 characters long

"; } else { // Check email $sql = "SELECT COUNT(ID) FROM users WHERE email='" . $_POST['txtNewAddress'] . "'"; $cnt = dbSelSingleValue($sql); if ($cnt == "1") { $_SESSION["error"] = "

Email address is already registered

"; } else { // Check username $sql = "SELECT COUNT(ID) FROM users WHERE username='" . $_POST['txtNewUser'] . "'"; $cnt = dbSelSingleValue($sql); if ($cnt == "1") { $_SESSION["error"] = "

Username is already registered

"; } else { $img = ""; $code = genRand2(15); $updates = '0'; $pms = '0'; $joined = date('Ymd'); $sql = "INSERT INTO users(email,password,confirmation_number,username,get_updates,allow_pms,join_date,profile_img) VALUE('" . $_POST['txtNewAddress'] . "','" . md5($_POST['txtNewPwd']) . "','" . $code . "','" . $_POST['txtNewUser'] . "','" . $updates . "','" . $pms . "','" . $joined . "','" . $img . "')"; mysql_query($sql) or die(mysql_error()); $body = 'Membership Confirmation

You are receiving this message because you, or someone else, requesed a membership from Skewworks with this email address.

To confirm your membership please click here.

If you have not requested this email, there is no need to do anything. Additional emails will not be sent.

Sincerely,
Thomas W. Holtquist
www.skewworks.com

Skewworks
'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: ' . $_POST['txtEmail'] . "\r\n"; $headers .= 'From: Skewworks ' . "\r\n"; // Mail it mail($_POST['txtEmail'], "Membership Confirmation", $body, $headers); $_SESSION["error"] = "

A confirmation email has been sent to you

"; } } } } } else $_SESSION["error"] = ""; if ($_GET['code'] != "") { if (confirmMembership($_GET['code']) == 0) $_SESSION["error"] = '

Invalid confirmation code!

Please check your email again for the proper activation link.

'; else $_SESSION["error"] = '

Membership confirmed; you may now login!

'; } include('inc/header.inc'); WriteHeader('', $user); ?>

Register or Sign in