Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginAuth
- {
- private static $result = null;
- public $statusUser = null, $statusPass = null;
- public function __construct()
- {
- //Create table if it doesn't exist
- if(!mysqli_query(dbConn(), "SELECT * FROM logins"))
- {
- $sql =
- "CREATE TABLE logins
- (
- id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- username VARCHAR(50) NULL,
- password VARCHAR(60) NULL,
- rank VARCHAR(50) NULL
- )";
- mysqli_query(dbConn(), $sql);
- }
- //Fragile code, but for one user, ok for now
- $this->result = mysqli_fetch_assoc(mysqli_query(dbConn(), "SELECT * FROM logins WHERE rank='primeAdmin'"));
- }
- public function processLogin($user, $pass)
- {
- $user = mysqli_real_escape_string(dbConn(),$user);
- $this->statusUser = ($user === $this->result["username"]) ? true : false;
- $this->statusPass = password_verify($pass, $this->result["password"]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement