Comments (47)

  1. Please help Awa I am getting an error:

    Fatal error: Uncaught Error: Call to a member function bind_param() on bool in C:xampphtdocsKIIIIIIIIIIIIIIIIIIIIIcontrollersauthController.php:57 Stack trace: #0 C:xampphtdocsKIIIIIIIIIIIIIIIIIIIIIsignup.php(1): require_once() #1 {main} thrown in C:xampphtdocsKIIIIIIIIIIIIIIIIIIIIIcontrollersauthController.php on line 57

  2. please solve this problem "Fatal error: Call to undefined function random_bytes() in D:xampphtdocsUSER-VERIFICATIONcontrollersauthController.php on line 53"

  3. Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:xampphtdocsbcharityserver.php:9 Stack trace: #0 C:xampphtdocsbcharitysignup.php(1): include() #1 {main} thrown in C:xampphtdocsbcharityserver.php on line 9.

    This is the error I get anytime i run the script

  4. 58:30 "unsert". I paused the video to look it up. I thought it was a play on words: what's the opposite of insert? unsert! Haha. "Remove" is usually what is used.

  5. Awa thank you so much for this video! All the script for me works perfectly fine in my local server, however, when I upload the files to my hosting, the sign-up page and login page isn't working. It's giving HTTP error 500. To test the code I was erasing part of the code in authControllers.php to check the problem and apparently, the problem is in the db connection query:

    $emailQuery = "SELECT * FROM users WHERE email=? LIMIT 1";

    $stmt = $conn->prepare($emailQuery);

    $stmt->bind_param('s', $email);

    $stmt->execute();

    $result = $stmt->get_result();

    $userCount = $result->num_rows;

    Please if you can give me some ideas to fix this problem I would be very grateful. Thank you!

  6. Awesome tutorial, but can you help me with this error that i get? I wrote the same code as you, i analyzed the code for the last 2 hours but i didn't found anything. The problem is at the register page, when i try to enter the info's to make an account i get the error from the if-else statement: Database error: failed to register. Can you please help?

  7. please help sir.. i have followed your tutorial from start to end but when i load login and click on sign signup this is what i get: Fatal error: require_once(): Failed opening required 'controller/authController.php' (include_path='C:xamppphpPEAR') in C:xampphtdocsUSER VERIFICATIONsignup.php on line 1……………. please help

  8. great work brother but i got a question: from the log in form seems to me we only check if the fields are empty but no validation and checks of the inputs are made. so this has no threat to the security of the system?? thank you again

  9. hi!! Thank you so much for this helpful tutorial, however I'm having a problem, when I put the data in the registration form, it simply… fades(?), it doesn't saves the data in the database, but my code doesn't have any errors and neither it throws me an error when I try to create an user, can you help me find the problem?? Thanks in advance!!

  10. Can you help me with this error please??
    Fatal error: Uncaught Error: Call to a member function bind_param() on bool in C:xampphtdocsGIVE&TAKEcontrolcontrolador.php:41 Stack trace: #0 C:xampphtdocsGIVE&TAKEsignup.php(2): require_once() #1 {main} thrown in C:xampphtdocsGIVE&TAKEcontrolcontrolador.php on line 41

  11. Mine say, Fatal error: Uncaught Error: Call to undefined function sessionb_start() in C:xampphtdocsProjectcontrollersauthController.php:3 Stack trace: #0 C:xampphtdocsProjectsignup.php(1): require_once() #1 {main} thrown in C:xampphtdocsProjectcontrollersauthController.php on line 3

    help!

  12. This doesn't seem to be working, does it have to be done on local host? I have done all code correct, but I get this error on my website:
    Fatal error: Class 'mysql' not found in /home/owdevx10/public_html/config/db.php on line 6

    Link to my website: http://owdev.x10.mx/signup.php

  13. hi Awa, just a small querry, when i am logging (insertion of my credential) in the login page, it is not redirecting me to the index page.

    Where in the authController.php , the header is providing the link of index.php for the login part

  14. Apparently the line in authController.php as of php 7 you need to change the line that says: $stmt->bind_param('ssbss', $username, $email, $verified, $token, $password); to $stmt->bind_param('ssiss', $username, $email, $verified, $token, $password); Otherwise it gives a error: Incorrect integer value: '' for column `user-verification`.`users`.`verified` at row 1. This is just for your information.

  15. I'm getting Database error: failed to register and i have to finish my school project next week, would you mind look at my code ?

    <?php

    session_start();

    require 'config/db.php';

    $errors = array();

    $username = "";

    $email = "";

    // if user clicks on the sign up button

    if (isset($_POST['signup-btn'])) {

    $username = $_POST['username'];

    $email = $_POST['email'];

    $password = $_POST['password'];

    $passwordConf = $_POST['passwordConf'];

    //validation

    if (empty($username)) {

    $errors['username'] = "Username required";

    }

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

    $errors['email'] = "Email adress is invalid";

    }

    if (empty($email)) {

    $errors['email'] = "Email required";

    }

    if (empty ($password)) {

    $errors['password'] = "Password required";

    }

    if ($password !== $passwordConf) {

    $errors['password'] = "The two password do not match";

    }

    $emailQuery = "SELECT * FROM users WHERE email=? LIMIT 1";

    $stmt = $conn->prepare($emailQuery);

    $stmt->bind_param('s', $email);

    $stmt->execute();

    $result = $stmt->get_result();

    $userCount = $result->num_rows;

    if ($userCount > 0) {

    $errors['email'] = "Email already exist";

    }

    if (count($errors) === 0) {

    $password = password_hash($password, PASSWORD_DEFAULT);

    $token = bin2hex(random_bytes(50));

    $verified = false;

    $sql = "INSERT INTO users (username, email, verified, token, password) VALUES (?, ?, ?, ?, ?)";

    $stmt = $conn->prepare($sql);

    $stmt->bind_param('ssbss', $username, $email, $verified, $token, $password);

    if ($stmt->execute()) {

    // login user

    $user_id = $conn->insert_id;

    $_SESSION['id'] = $user_id;

    $_SESSION['username'] = $username;

    $_SESSION['email'] = $email;

    $_SESSION['verified'] = $verified;

    // set flash messages

    $_SESSION['message'] = "You are now logged in";

    $_SESSION['alert-class'] = "alert-success";

    header('location: index.php');

    exit();

    }else {

    $errors['db_error'] = "Database error: failed to register";

    }

    }

    }

  16. hi, first of all, your videos are great stuff!!!, but, im stucked, i ve all code exactly as yours, but im getting the error here:

    $sql ="INSERT INTO users (username, email, verified, token, password) VALUES (?, ?, ?, ?, ?)";

    $stmt = $conn->prepare($sql);

    $stmt->bind_param('ssbss', $username, $email, $verified, $token, $password);

    if ($stmt->execute()) {

    $user_id = $conn->insert_id;

    $_SESSION['id'] = $user_id;

    $_SESSION['username'] = $username;

    $_SESSION['email'] = $email;

    $_SESSION['verified'] = $verified;

    $_SESSION['message'] = "Ha ingresado correctamente.";

    $_SESSION['alert-class'] = "alert-success";

    header('location: index.php');

    exit();

    } else {

    $errors['db_error'] = "Database error.";

    }

    }

    }
    The db works ok with the constants, bcause it checks the email duplicated, the checks, and everything is ok, i dont know whats the problem… can you helpme!?
    Thank you and greetings from argentina!

  17. thank you for your tutorial. this is work on localhost but not work on live server. when i click on signup button i got a http error 500. Please suggest me any for changes.

Comments are closed.