davids_media Posted September 11, 2013 Share Posted September 11, 2013 Hello I am having trouble at the moment with my "login.inc.php" file. Below is the code for it; <?php $login_errors = array(); if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($dbc, $_POST['email']); } else { $login_errors['email'] = 'Please enter a valid email address!'; } if (!empty($_POST['password'])) { $p = mysqli_real_escape_string ($dbc, $_POST['password']); } else { $login_errors['password'] = 'Please enter your password!'; } if (empty($login_errors)) { $q = "SELECT userid, username, usertype, IF(date_expires >= NOW(), true, false) FROM user WHERE(email='$e' AND password='" . get_password_hash($p) . "')"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { $row = mysqli_fetch_array ($r, MYSQLI_NUM); if ($row[2] == 'Admin') { session_regenerate_id(true); $_SESSION['user_admin'] = true; } $_SESSION['userID'] = $row[0]; $_SESSION['username'] = $row[1]; if ($row[3] == 1) $_SESSION['user_not_expired'] = true; } else { $login_errors['login'] = 'The email address and password do not match those on file.'; } } // End of $login_errors IF. I have underlined the piece of code which is giving me issues. When I try to run it I get this; Notice: Undefined index: email in C:\Users\David\Desktop\swapsite_new\site\includes\login.inc.php on line 6 How do I solves this please? Link to comment Share on other sites More sharing options...
Larry Posted September 13, 2013 Share Posted September 13, 2013 The problem is probably in your login form, which gets submitted to this script. Link to comment Share on other sites More sharing options...
Recommended Posts