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

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -