New Member Registration"; $mainpage=null; $username=null; $pass2=null; $first = null; $last = null; $email = null; $emailc = null; $city = null; $zip = null; $phone = null;; $confirm = null; $content=null; $overlays_content=null; $message_div=null; ////////////////////////////////////////// // Display form input and process form // ////////////////////////////////////////// $ip = $_SERVER['REMOTE_ADDR']; //setup form data for use in original form and also in case of errors $formdata = <<

Join the Community!

@
Please choose a unique and valid username.
Your username must be 6-15 characters long and may be displayed publicly.
Your password must be at least 8 characters long and include at least 1 number or special character.
Please provide a valid email.
Please confirm your email.
By clicking here you agree to our Terms of Use and acknowledge our Privacy policy.
Already a member?
Sign in to your account.
EOT; /*Get form results*/ $meta_insert = 'Free Software Applications from experienced programmers '; //closes
0 || strlen($honey_pot2) > 0) { $content .= "It appears you are trying to register using an automated service or bot. This is not allowed."; } else if (isset($username, $pass2)) { //echo "We got here 2"; $spchar = array(".", "=", "/", "?", "<", ">", "::", "`"); $user_tmp = str_replace($spchar, "", $username); $containsDigit = preg_match('/\d/', $pass2); $containsSpecial = preg_match('/[^a-zA-Z\d]/', $pass2); if (strlen($username) == strlen($user_tmp)) { //session_regenerate_id(); $username_tmp = mysqli_real_escape_string($dbi, $username); $query = "SELECT * FROM `members` where `user_name`='$username_tmp'"; $result = $dbi->query($query); $exists = $result->num_rows; $email_tmp = mysqli_real_escape_string($dbi, $email); $query2 = "SELECT * FROM `members` where `email`='$email_tmp'"; $result2 = $dbi->query($query2); $exists2 = $result2->num_rows; if ($exists > 0) { $content .= "

Already a Member?

This username is already in use.

If you already have an account with DFSsheets, please login or request a password reset here.

Otherwise, please choose another online ID and attempt registration again.

"; $content .= ''; } else if ($exists2 > 0) { $content .= "

Already a Member?

The email address you've entered is already linked to an account.

If you already have an account with DFSsheets, please login or reset your password here.

Otherwise, please enter your correct email address and attempt registering again.

"; $content .= ''; } else if ($userlength < 6 || $userlength > 16) { $formdata = str_replace("", "

Username must be between 6 and 15 characters in length!

Please try a new username:

", $formdata); //add back into the form any data that might still be useful if ($first && $last) { $first = 'value="' . $first . '"'; $last = 'value="' . $last . '"'; $formdata = str_replace('value="" placeholder="First Name"', $first, $formdata); $formdata = str_replace('value="" placeholder="Last Name"', $last, $formdata); } if ($email && $emailc) { $email = 'value="' . $email . '"'; $emailc = 'value="' . $emailc . '"'; $formdata = str_replace('value="" placeholder="Email"', $email, $formdata); $formdata = str_replace('value="" placeholder="Confirm Email"', $emailc, $formdata); } if ($phone) { $phone = 'value="' . $phone . '"'; $formdata = str_replace('value="" placeholder="Phone"', $phone, $formdata); } if ($city && $zip) { $city = 'value="' . $city . '"'; $formdata = str_replace('value="" placeholder="City"', $city, $formdata); $zip = 'value="' . $zip . '"'; $formdata = str_replace('value="" placeholder="Zip"', $zip, $formdata); } $content .= $formdata; } else if (($containsDigit == 0 && $containsSpecial == 0) || $passlength < 7) { $formdata = str_replace("", "

Your password is not the required length or does not contain any numbers or special characters

Please try a different password and submit your information again:

", $formdata); //add back into the form any data that might still be useful if ($username) { $thisuser = 'value="' . $username . '"'; $formdata = str_replace('value="" placeholder="Username"', $thisuser, $formdata); } if ($first && $last) { $first = 'value="' . $first . '"'; $last = 'value="' . $last . '"'; $formdata = str_replace('value="" placeholder="First Name"', $first, $formdata); $formdata = str_replace('value="" placeholder="Last Name"', $last, $formdata); } if ($email && $emailc) { $email = 'value="' . $email . '"'; $emailc = 'value="' . $emailc . '"'; $formdata = str_replace('value="" placeholder="Email"', $email, $formdata); $formdata = str_replace('value="" placeholder="Confirm Email"', $emailc, $formdata); } if ($phone) { $phone = 'value="' . $phone . '"'; $formdata = str_replace('value="" placeholder="Phone"', $phone, $formdata); } if ($city && $zip) { $city = 'value="' . $city . '"'; $formdata = str_replace('value="" placeholder="City"', $city, $formdata); $zip = 'value="' . $zip . '"'; $formdata = str_replace('value="" placeholder="Zip"', $zip, $formdata); } $content .= $formdata; } else if ($email != $emailc) { //var_dump($email); //var_dump($emailc); $formdata = str_replace("", "

Your email confirmation does not match your email address; or the address you entered is not valid.
Please enter your email address and confirmation again:

", $formdata); //add back into the form any data that might still be useful if ($username) { $thisuser = 'value="' . $username . '"'; $formdata = str_replace('value="" placeholder="Username"', $thisuser, $formdata); } if ($first && $last) { $first = 'value="' . $first . '"'; $last = 'value="' . $last . '"'; $formdata = str_replace('value="" placeholder="First Name"', $first, $formdata); $formdata = str_replace('value="" placeholder="Last Name"', $last, $formdata); } if ($phone) { $phone = 'value="' . $phone . '"'; $formdata = str_replace('value="" placeholder="Phone"', $phone, $formdata); } if ($city && $zip) { $city = 'value="' . $city . '"'; $formdata = str_replace('value="" placeholder="City"', $city, $formdata); $zip = 'value="' . $zip . '"'; $formdata = str_replace('value="" placeholder="Zip"', $zip, $formdata); } $content .= $formdata; } else if (!$first || !$last || !$confirm) { $formdata = str_replace("", "

Confirm all required fields have been entered and \"I Agree\" is checked to confirm your acknowledgement of our site terms of use.

Please try again:

", $formdata); //add back into the form any data that might still be useful if ($username) { $thisuser = 'value="' . $username . '"'; $formdata = str_replace('value="" placeholder="Username"', $thisuser, $formdata); } if ($first && $last) { $first = 'value="' . $first . '"'; $last = 'value="' . $last . '"'; $formdata = str_replace('value="" placeholder="First Name"', $first, $formdata); $formdata = str_replace('value="" placeholder="Last Name"', $last, $formdata); } if ($email && $emailc) { $email = 'value="' . $email . '"'; $emailc = 'value="' . $emailc . '"'; $formdata = str_replace('value="" placeholder="Email"', $email, $formdata); $formdata = str_replace('value="" placeholder="Confirm Email"', $emailc, $formdata); } if ($phone) { $phone = 'value="' . $phone . '"'; $formdata = str_replace('value="" placeholder="Phone"', $phone, $formdata); } if ($city && $zip) { $city = 'value="' . $city . '"'; $formdata = str_replace('value="" placeholder="City"', $city, $formdata); $zip = 'value="' . $zip . '"'; $formdata = str_replace('value="" placeholder="Zip"', $zip, $formdata); } $content .= $formdata; } //if everything passes checks, begin setting up the user account else { //hash the password for the database and the email for the confirmation $hash = password_hash($pass2, PASSWORD_DEFAULT); $hash2 = password_hash($email, PASSWORD_DEFAULT); $name = $first . " " . $last; $username = mysqli_real_escape_string($dbi, $username); $first = mysqli_real_escape_string($dbi, $first); $last = mysqli_real_escape_string($dbi, $last); $phone = mysqli_real_escape_string($dbi, $phone); //create the new account in members $a = 1; $b = 1; $c = "000"; $d = "000"; $stmt = $dbi->prepare("INSERT INTO `members` (`user_name`,`reputation`,`market`,`password`,`first_name`,`last_name`,`email`,`email_at_signup`,`ip_address`,`phone_number`,`current_membership`,`user_groups`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); $stmt->bind_param("siisssssssis", $username, $a, $b, $hash, $first, $last, $email, $email, $ip, $phone, $c, $d); if (!$stmt->execute()) { echo "Database Error: (" . $stmt->errno . ")" . $stmt->error; echo $stmt->queryString; } else { $new_id = $dbi->insert_id; if ($new_id) { //$success = "

Item number $new_id added succesfully!

Add another item"; $user_id = mysqli_insert_id($dbi); $qq = "INSERT INTO `member_reputation`(`user_id`, `sport`, `reputation`,`last_updated`) VALUES ('$user_id','1', '1', '$today')"; $rr = $dbi->query($qq); } } $stmt->close(); $username = ucwords($name); $hash2 = strrev($hash2); $to = $email; $subject = 'Welcome to the Free Software Center Community!'; $email_message = $first . ', thanks for registering for your membership at TheFreeSoftwareCenter.com. ' . "\r\n\r\n" . 'Please open this link in your web browser to confirm your email address and activate your account: ' . "\r\n" . 'https://www.thefreesoftwarecenter.com/activate.html?email=' . $email . '&activate=' . $hash2 . "\r\n\r\n" . 'Thanks and we look forward to hearing from you in the community.' . "\r\n" . 'TheFreeSoftwareCenter Staff' . "\r\n"; $headers = 'From: TheFreeSoftwareCenter ' . "\r\n" . 'Reply-To: memberships@thefreesoftwarecenter.com' . "\r\n"; //.'X-Mailer: PHP/' . phpversion() //mail($to, $subject, $email_message, $headers); if (mail($to, $subject, $email_message, $headers)) { $content .= "

Welcome to the Community!


A confirmation email has been sent to your email address.
Please click the link in that email to activate your membership.

Keep in mind many spam filters may attempt to filter automated registration emails.

"; $content .= '


Already verified your email? Sign in to your account by clicking the Login button on the main navigation bar.
'; //^this would look a lot better bottom aligned } else { $content .= "

Confirmation Error!


There was an error processing your confirmation email. Please contact support directly to activate your account!
"; } } } else { $content .= "Please enter a username that does not include non-alphanumeric characters:"; $content .= $formdata; } } } else { //echo "We got here 3"; $content .= $formdata; } $content .= "
"; $_POST = array(); $header = get_header(); $footer = get_footer(); $mainpage =$header.$content.$message_div.$footer.$scripts; echo $mainpage; save_session($today); ?>