Skip to content

Commit

Permalink
PHPSESSID instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ketertitus committed Mar 31, 2024
1 parent b094801 commit d6c77bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
include "redisconnect.php";
if (isset($_COOKIE['user_id'])) {
$me = $_COOKIE['user_id'];
if (isset($_COOKIE['PHPSESSID'])) {
$me = $_COOKIE['PHPSESSID'];
$logged = $redis->hgetall("user:$me");
}
// Start session
Expand All @@ -26,7 +26,7 @@
<h1>
<?php
session_start();
if (isset($_COOKIE['user_id'])) {
if (isset($_COOKIE['PHPSESSID'])) {
echo $logged['merchantname'];
} else {
// echo '<script>window.location.href = "login.php"</script>';
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$hashedPassword = $row['password'];
$me = $row['user_id'];
$me = $_COOKIE['PHPSESSID'];
if (password_verify($userEnteredPassword, $hashedPassword)) {
// Store session data in Redis
$sessionData = [
Expand Down

0 comments on commit d6c77bc

Please sign in to comment.