it is possible to set cookie and session only with username or something like that?
$_SESSION['username'] = $row['username'];
setcookie('username', $row['username'], time() + (60 * 60 * 24 * 30));
it is possible to set cookie and session only with username or something like that?
$_SESSION['username'] = $row['username'];
setcookie('username', $row['username'], time() + (60 * 60 * 24 * 30));
Yes it's possible, however;
$_COOKIE['username']
in auditing, or within your logic raw, people can "become other people"Generally, setcookie
is used to store data on the clients machine that you want to use for when they return at a later date - or example, checking to see if they agreed to your cookie policy.
A session cookie is used for the session of the visit and then destroyed once they leave (ie: logout) the web app.
Notes