php - How can I secure this user cookie? -


so i've user login network , creates cookie upon login. need know how secure because @ moment can edit cookie , give me access username update loggedin cookie to. existing code:

<? $username = $_request['username']; $goto = $_request['goto']; $expdate = time() + 864000;  setcookie('loggedin',"$username",$expdate, "/");  echo "<meta http-equiv=refresh content=\"0; url='/$goto.html'\">"; ?> 

any appreciated! thank you! i'm new cookies , php in general.

in php, setting arguments cookies done through optional arguments on “setcookie” function:

setcookie( name, value, expire, path, domain, secure, httponly);  // open setcookie( 'username', 'bob', 0, '/', '.example', false, false);  // locked down setcookie( 'username', 'bob', 0, '/forums', 'www.example.com', isset($_server["https"]), true); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -