Skip to content

Commit

Permalink
code format in user.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Bel Olivier (OBE) committed Jun 8, 2020
1 parent 8484b52 commit 15de62d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions classes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

class User
{
private $_db;
private $_db;
private $_ignoreCase;

function __construct($db)
{
$this->_db = $db;
function __construct($db)
{
$this->_db = $db;
$this->_ignoreCase = false;
}
}

public function setIgnoreCase($sensitive) {
$this->_ignoreCase = $sensitive;
}
$this->_ignoreCase = $sensitive;
}

public function getIgnoreCase() {
return $this->_ignoreCase;
}
public function getIgnoreCase() {
return $this->_ignoreCase;
}

private function get_user_hash($username)
{
try {
if ($this->_ignoreCase) {
$stmt = $this->_db->prepare('SELECT password, username, memberID FROM members WHERE LOWER(username) = LOWER(:username) AND active="Yes" ');
$stmt = $this->_db->prepare('SELECT password, username, memberID FROM members WHERE LOWER(username) = LOWER(:username) AND active="Yes" ');
} else {
$stmt = $this->_db->prepare('SELECT password, username, memberID FROM members WHERE username = :username AND active="Yes" ');
}
Expand All @@ -32,7 +32,7 @@ private function get_user_hash($username)
return $stmt->fetch();

} catch(PDOException $e) {
echo '<p class="bg-danger">'.$e->getMessage().'</p>';
echo '<p class="bg-danger">'.$e->getMessage().'</p>';
}
}

Expand Down Expand Up @@ -67,11 +67,11 @@ public function login($username, $password)

if (password_verify($password, $row['password'])) {

$_SESSION['loggedin'] = true;
$_SESSION['username'] = $row['username'];
$_SESSION['memberID'] = $row['memberID'];
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $row['username'];
$_SESSION['memberID'] = $row['memberID'];

return true;
return true;
}
return false;
}
Expand Down

0 comments on commit 15de62d

Please sign in to comment.