function login($username, $password) { global $db; // Clear any existing session session_unset(); session_destroy(); session_start(); $stmt = $db->prepare("SELECT * FROM users WHERE username = ?"); $stmt->execute([$username]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if ($user && password_verify($password, $user['password'])) { // Regenerate session ID for security session_regenerate_id(true); $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; $_SESSION['login_time'] = time(); // Set secure session cookie params setcookie( session_name(), session_id(), [ 'lifetime' => 86400, 'path' => '/', 'domain' => $_SERVER['HTTP_HOST'], 'secure' => true, 'httponly' => true, 'samesite' => 'Strict' ] ); return true; } return false; }
Fatal error: Uncaught Error: Call to undefined function get_setting() in /home/yushxyz/public_html/yushbhardwaj.com/index.php:8 Stack trace: #0 {main} thrown in /home/yushxyz/public_html/yushbhardwaj.com/index.php on line 8