php - variable equals zero but is not working in count -
if (isset($_post['register_user'])) { // receive input values form $username = mysqli_real_escape_string($db, $_post['username']); $email = mysqli_real_escape_string($db, $_post['email']); $confirmemail = mysqli_real_escape_string($db, $_post['confirmemail']); $password = mysqli_real_escape_string($db, $_post['password']); $confirmpassword = mysqli_real_escape_string($db, $_post['confirmpassword']); if (empty($email)) { array_push($emailerror, "email required"); } if (empty($confirmemail)) { array_push($cemailerror, "email confirmation required"); } if (empty($username)) { array_push($usernameerror, "username required"); } if (empty($password)) { array_push($passworderror, "password required"); } if (empty($confirmpassword)) { array_push($cpassworderror, "password confirmation required"); } if ($password != $confirmpassword) { array_push($wrongpassword, "the 2 passwords not match"); } if ($email != $confirmemail) { array_push($wrongemail, "the 2 emails not match"); } $a = (count($emailerror)); $b = (count ($cemailerror)); $c = (count ($usernameerror)); $d = (count ($passworderror)); $e = (count ($cpassworderror)); $f = (count ($wrongpassword)); $g = (count ($wrongemail)); $h = (count ($reqemail)); $i = (count ($reqpass)); $j = (count ($wrongcombo)); echo $a + $b + $c + $d + $e + $f + $g + $h + $i + $j; $m= $a + $b + $c + $d + $e + $f + $g + $h + $i + $j; //right here having touble. know $m == 0, site not //continuing header index page or registering new info in //database
if (count($m) == 0) { $passwordencryption = md5($password);//encrypt password before saving in database $query = "insert arcadeusers (username, password, sign_up_date, email) values ('$username', '$passwordencryption', now(), '$email')"; mysqli_query($db, $query); $_session['username'] = $username; $_session['success'] = "you logged in"; header('location: index.php'); }
Comments
Post a Comment