i check my database and i do not see the data that should post. i do get the email in the php(which is below) but even that is not working right. also it adds the folder for the users like is should.
<?php
session_start();
// If user is logged in, header them away
if(isset($_SESSION["username"])){
header("location: message.php?msg=you are already a member");
exit();
}
?><?php
// Ajax calls this NAME CHECK code to execute
if(isset($_POST["checkusername"])){
include_once("php_includes/db_connect.php");
$username = preg_replace('#[^a-z0-9]#i', '', $_POST['checkusername']);
$query = "SELECT id FROM 'users' WHERE username='$username' LIMIT 1";
$result = mysql_query($query, $db_conx);
if (strlen($username) < 3 || strlen($username) > 16) {
echo '<strong style="color:#F00;">3 - 16 characters please</strong>';
exit();
}
if (is_numeric($username[0])) {
echo '<strong style="color:#F00;">Usernames must begin with a letter</strong>';
exit();
}
if ($result < 1) {
echo '<strong style="color:#009900;">' . $username . ' is OK</strong>';
exit();
} else {
echo '<strong style="color:#F00;">' . $username . ' is taken</strong>';
exit();
}
}
?><?php
// Ajax calls this REGISTRATION code to execute
if(isset($_POST["u"])){
// CONNECT TO THE DATABASE
include_once("php_includes/db_connect.php");
// GATHER THE POSTED DATA INTO LOCAL VARIABLES
$u = preg_replace('#[^a-z0-9]#i', '', $_POST['u']);
$e = $_POST['e'];
$p = $_POST['p'];
$g = preg_replace('#[^a-z]#', '', $_POST['g']);
$c = preg_replace('#[^a-z ]#i', '', $_POST['c']);
$f = preg_replace('#[^a-z ]#i', '', $_POST['f']);
$l = preg_replace('#[^a-z ]#i', '', $_POST['l']);
$s = preg_replace('#[^a-z0-9]#i', '', $_POST['s']);
$ct = preg_replace('#[^a-z ]#i', '', $_POST['ct']);
$st = preg_replace('#[^a-z ]#i', '', $_POST['st']);
$z = preg_replace('#[^0-9 ]#i', '', $_POST['z']);
// GET USER IP ADDRESS
$ip = preg_replace('#[^0-9.]#', '', getenv('REMOTE_ADDR'));
// DUPLICATE DATA CHECKS FOR USERNAME AND EMAIL
$query = "SELECT id FROM 'users' WHERE username='$u' LIMIT 1";
$result = mysql_query($query, $db_conx);
// -------------------------------------------
$query = "SELECT id FROM 'users' WHERE email='$e' LIMIT 1";
$result = mysql_query($query, $db_conx);
// FORM DATA ERROR HANDLING
if(u == "" || e == "" || p1 == "" || p2 == "" || c == "" || g == ""|| f == ""|| l == ""|| s == ""|| ct == ""|| st == ""|| z == ""){
echo "The form submission is missing values.";
exit();
} else if ($u_check > 0){
echo "The username you entered is alreay taken";
exit();
} else if ($e_check > 0){
echo "That email address is already in use in the system";
exit();
} else if (strlen($u) < 3 || strlen($u) > 16) {
echo "Username must be between 3 and 16 characters";
exit();
} else if (is_numeric($u[0])) {
echo 'Username cannot begin with a number';
exit();
} else {
// END FORM DATA ERROR HANDLING
// Begin Insertion of data into the database
// Hash the password and apply your own mysterious unique salt
$p_hash= md5($p);
// Add user info into the database table for the main site table
$query = "INSERT INTO `users` ('username', 'email', 'password','first', 'last', 'gender','street', 'city', 'state', 'zip', 'country', 'ip', 'signup', 'lastlogin', 'notescheck')
VALUES('$u','$e','$p_hash','$f','$l','$g','$s','$ct','$st','$z','$c','$ip',now(),now(),now())";
$result = mysql_query($query, $db_conx);
$uid = mysql_insert_id($db_conx);
// Establish their row in the useroptions table
$query = "INSERT INTO `useroptions`('id', 'username', 'background') VALUES ('$uid','$u','original')";
$result = mysql_query($query, $db_conx);
// Create directory(folder) to hold each user's files(pics, MP3s, etc.)
if (!file_exists("user/$u")) {
mkdir("user/$u", 0755);
}
// Email the user their activation link
$Name = "Dragon’s Den Gaming"; //senders name
$email = "info@dragonsdengamming.com "; //senders e-mail adress
$recipient = "$e"; //recipient
$message = 'Drgons Den Gamming Account Activation<br /><br /><br /><br />Hello '.$u.',<br /><br />Thank you for joining Dragons Den Gamming! We hope you find this to be a cool site you can share with your friends. Enjoy all the news about the newest games and much more. Activation must be completed before you can gain full access to the site.<br /><br />Happy Gamming<br />Dragons Den staff<br /><br />Click the link below to activate your account when ready:<br /><br /><a href"http://www.dragonsdengamming.com/activation.php?id='.$uid.'&u='.$u.'&e='.$e.'&p='.$p_hash.'">Click here to activate your account now</a><br /><br />Login after successful activation using your:<br />* E-mail Address: <b>'.$e.'</b>' ; //mail body
$subject = " Dragon’s Den Gamming Account Activation "; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
ini_set('sendmail_from', ' auto_responder@dragonsdengamming.com ');
if(mail($recipient, $email, $subject, $message, $headers)){
echo "signup_success";
exit();
}
}
exit();
}
?>