variables not being committed to database

Asked by At

i'm running a signup form on my page, and I want to obviously input this data into my database, I get my variables from a form using ajax, then ajax will send this to php, they are sanatized and then put into the database, the only problem is, that the data is never put into the database, I put an echo right before the data is committed to check if the variables actually hold a value. and sure enough they do. the part of my PHP that deals with putting information into the database is as follows...

echo "$u,$e,$p,$cid,$c,$cn";
exit();
// END FORM DATA ERROR HANDLING
   // Begin Insertion of data into the database
// Hash the password and apply your own mysterious unique salt
$cryptpass = crypt($p);
include_once ("php_includes/randStrGen.php");
$p_hash = randStrGen(SOME NUMBER)."$cryptpass".randStrGen(SOME NUMBER);
// Add user info into the database table for the main site table
$sql = "INSERT INTO users (username, email, password, compname, companyID, country, ip, signup, lastlogin, notescheck)       
       VALUES('$u','$e','$p_hash','$cn','$cid','$c','$ip',NOW(),NOW(),NOW())";
$query = mysqli_query($db_conx, $sql); 
$uid = mysqli_insert_id($db_conx);
// Establish their row in the useroptions table
$sql = "INSERT INTO useroptions (id, username, background) VALUES ('$uid','$u','original')";
$query = mysqli_query($db_conx, $sql);
// Create directory(folder) to hold each user's files(pics, MP3s, etc.)
if (!file_exists("user/$u")) {
mkdir("user/$u", 0755);
}

the SOME NUMBER in p_hash is just for security reasons.

Would be great if someone could shed some light, I get no error returned in firebug, but after the user click the link to activate their account, they get this message

activation_string_length_issues

which relates to this in my activation.php file

if($id == "" || strlen($u) < 3 || strlen($e) < 5 || $p == 0){
// Log this issue into a text file and email details to yourself
header("location: message.php?msg=activation_string_length_issues");
    exit(); 

which would lead me to assume nothing put into the e-mail sending area either. I don't know this is really frustrating me, I'm really new to web development.

Thanks in advance!

0 Answers