Marie Posted August 16, 2019 Share Posted August 16, 2019 This part of the login code does not seem to be working. I know the information is in the database and the activation field says NULL. I believe that the browser - Firefox on a Mac - is accepting cookies. I have tried this with several users and they all have the same password. I am getting the error message that indicates that the Email and Password does not match those on file. I am set up to use PHP 7. // Query the database: $q = "SELECT user_id, first_name, user_level, pass FROM users WHERE email='$e' AND active IS NULL"; $r = mysqli_query($dbc, $q) or trigger_error("Query: $q\n<br>MySQL Error: " . mysqli_error($dbc)); if (@mysqli_num_rows($r) == 1) { // A match was made. // Fetch the values: list($user_id, $first_name, $user_level, $pass) = mysqli_fetch_array($r, MYSQLI_NUM); mysqli_free_result($r); Link to comment Share on other sites More sharing options...
Marie Posted August 17, 2019 Author Share Posted August 17, 2019 Where does the code sit that actually prevents someone from logging in if they are not set to accept cookies? I would like to remove that and see if that is the differece? I have been using your code for years and have older sites with the login.inc.php coding in the includes folder. They always worked. i guess I could go back to that but I would like to use the most updated coding available. Link to comment Share on other sites More sharing options...
Larry Posted August 17, 2019 Share Posted August 17, 2019 You should debug the query itself to start. See if the query is returning exactly one row or not. If not, then you need to debug it backwards to see if the problem is: The value of $e in the PHP script The value of email in the database If active has a null value in the database (not an empty value) Link to comment Share on other sites More sharing options...
Marie Posted September 11, 2019 Author Share Posted September 11, 2019 I believe it is working now. It was a database problem. I changed the way the website handled passwords but forgot to change the structure of the database column. So it was truncating the password. Thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts