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 
Member Avatar for LastMitch

@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 
commented: To Rectify what some retard did to LastMitch +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.