0

let say i create session in login page. here session is on id and username.

$_SESSION["id"] = $id;
$_SESSION["username"] = $username_p;

now to see who loged in i can do this

$user_name_s = $_SESSION['username'];  //has the name of who is loged in

now how do i do this with cookies? how can i get the name of user who is loged in here. (not using sessions)

setcookie("id", $id, time()+172800); 
setcookie("username", $username_p, time()+172800); //seconds - 2 days 
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by LastMitch
6

@hwoarang69

now how do i do this with cookies? how can i get the name of user who is loged in here. (not using sessions)

Instead of this:

setcookie("id", $id, time()+172800);
setcookie("username", $username_p, time()+172800); //seconds - 2 days 

Try this:

setcookie("id", $_POST['id'], time()+172800);
setcookie("username", $_POST['username'], time()+172800); //seconds - 2 days 
Votes + Comments
To Rectify what some retard did to LastMitch
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.