diff --git a/config.php b/config.php index d2ccaf5..f2b6c7d 100644 --- a/config.php +++ b/config.php @@ -22,7 +22,7 @@ $clientTableName = "yourtable"; // Name of table containing client login info $emailColumn = "email"; // Name of column containing emails $hashPasswordColumn = "password"; // Name of column containing passwords - $primaryKeyColumn = "id" // Name of column containing the primary key/unique identifier for each row + $primaryKeyColumn = "id"; // Name of column containing the primary key/unique identifier for each row $conn = new mysqli($servername, $username, $password, $dbname); diff --git a/index.php b/index.php index be512cf..60dafb9 100644 --- a/index.php +++ b/index.php @@ -4,8 +4,8 @@ if (isset($_SESSION['adminUser'])) { $adminUser = $_SESSION['adminUser']; $sql = "SELECT `{$emailColumn}` FROM `{$adminTableName}` WHERE `{$primaryKeyColumn}` = '{$adminUser}'"; - $result = $conn->query($sql)->fetch_assoc(); - if ($result->num_rows == 1) { + $result = $conn->query($sql); + if ($result->num_rows === 1) { //Redirect to overview header("Location: overview.php"); die(); } @@ -24,6 +24,8 @@
Login
query($sql)->fetch_assoc(); + $result = $conn->query($sql); if ($result->num_rows == 1) { + $result = $conn->query($sql)->fetch_assoc(); $email = $result[$emailColumn]; $_SESSION['email'] = $email; } else {