public function activate() { //TODO: Implement this action. $uid = $_GET["uid"]; $hash = $_GET["hash"]; if (User::activateUser($uid, $hash)) { echo "active"; User::loginSystem(User::fromUid($uid)); } Page::redirect("/index"); }
/** * Attempts to log in the user with the given credentials * * @param string $uname * @param string $password * @param boolean $remember * @return boolean indicating whether or not the user is logged in */ public static function login($uname, $password, $remember = 0) { $stmt = Database::getDB()->prepare("\r\n\t\t\tSELECT *\r\n\t\t\tFROM users\r\n\t\t\tWHERE\r\n\t\t\t\tu_username = ? AND\r\n\t\t\t\tu_password = MD5(?)\r\n\t\t"); $stmt->bind_param('ss', $uname, $password); $stmt->execute(); $stmt->store_result(); $row = $stmt->fetch_assoc(); $stmt->close(); if ($row) { $valid_user = new User($row); return User::loginSystem($valid_user, $remember); } return false; }