skip to Main Content

Php – Login session not accessible other than redirected page

This is my login.php if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = $_POST['username']; $password = $_POST['password']; $stmt = $conn->prepare("SELECT * FROM admin WHERE username=? AND password=?"); $stmt->bind_param("ss", $username, $password); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $_SESSION['username'] = $username;…

VIEW QUESTION

Track the last activity in laravel

In laravel auth middleware i create session variable and store the the last entering time like class Authenticate extends Middleware { public function handle($request, Closure $next, ...$guards) { if (auth()->check()) { session()->put('activity_time', now()->toDateTimeString()); } return parent::handle($request, $next, ...$guards); } protected…

VIEW QUESTION

Sessions in PHP do not get destroyed and cookie is not removed

I have this function logout that gets called before the HTML is rendered and it is: function logout() { $_SESSION = []; if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } session_destroy();…

VIEW QUESTION

PHP Session Language switch

I'm using quite a simple and straightforward session switch to make my site bilingual. However it has a flaw - as soon as you switch to the other language, it throws you back on the index. I would like to…

VIEW QUESTION
Back To Top
Search