Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (Login::isAuthenticated()) { ?>
- <a href="/sign-out/">Sign Out</a>
- <?php } ?>
- class Login
- {
- private static $_auth;
- public function __construct($username, $rawPassword) {
- global $db;
- require('edit/users/config.php');
- $hashedPassword = sha1(SALT . $_POST['password']);
- $query = 'SELECT firstname FROM users WHERE user = "' . $db->cleanString($username) . '" AND pass = "' . $db->cleanString($hashedPassword) . '" LIMIT 1';
- $login = $db->query($query);
- if ($login) {
- $_SESSION['username'] = $username;
- self::$_auth = true;
- header('Location: ' . CONFIG_DIR_BASE);
- } else {
- ErrorHandler::addErrorToStack('Your username and/or password did not match one on our system. ');
- }
- }
- public static function isAuthenticated() {
- return self::$_auth;
- }
- }
Add Comment
Please, Sign In to add comment