I know there are about 3 posts just like mine, but nothing recent. I've gone as far as to copy login.php from repo, and I'm still unable to get directed to index.php after typing in credentials in login field. I tried a few things to ensure at least my side was correct. I added error checking after header location per another post, and no errors. To ensure my connection.php config was correct, I changed password in the connections file and instantly got an error. Changed it back, and all was well. Like I said this is direct from repo, but posted below is my login.php script.
<?php
Start Session:
session_start();
Database Connection:
include('../config/connection.php');
if($_POST) {
$q = "SELECT * FROM users WHERE email = '$_POST[email]' AND password = SHA1('$_POST[password]')";
$r = mysqli_query($dbc, $q);
if(mysqli_num_rows($r) == 1) {
$_SESSION['username'] = $_POST['email'];
header('Location: index.php');
}else {
echo mysqli_error($dbc).'<br>'.$q; // show any mysql errors and echo out the query to look for other errors
}
I know there are about 3 posts just like mine, but nothing recent. I've gone as far as to copy login.php from repo, and I'm still unable to get directed to index.php after typing in credentials in login field. I tried a few things to ensure at least my side was correct. I added error checking after header location per another post, and no errors. To ensure my connection.php config was correct, I changed password in the connections file and instantly got an error. Changed it back, and all was well. Like I said this is direct from repo, but posted below is my login.php script.
<?php
Start Session:
session_start();
Database Connection:
include('../config/connection.php');
if($_POST) {
}
?>
<!DOCTYPE html>
```