Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Commit

Permalink
Add minor bug fixes
Browse files Browse the repository at this point in the history
- Bug Fixes
	- Add missing semicolon in config.php
	- Add empty variable declaration for error messages on login
	page
  • Loading branch information
Timur-O committed May 8, 2020
1 parent 437cbb9 commit e66b8c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -24,6 +24,8 @@
<h5>Login</h5>

<?php
$passwordError = $emailError = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
include 'config.php';

Expand Down
3 changes: 2 additions & 1 deletion loginCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
if (isset($_SESSION['adminUser'])) {
$adminUser = $_SESSION['adminUser'];
$sql = "SELECT `{$emailColumn}` FROM `{$adminTableName}` WHERE `{$primaryKeyColumn}` = '{$adminUser}'";
$result = $conn->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 {
Expand Down

0 comments on commit e66b8c8

Please sign in to comment.