Welcome to the Linux community forum, interact with 2 million technical staff into the header (Content-type: texthtml; charsetutf-8 );? Formmethodpostactiondemo_setCookie2.phpname: inputtypetextnameusernameinputtypesubmitvalue log on to form? Php
Welcome to the Linux community forum and interact with 2 million technical staff> enter header ("Content-type: text/html; charset = UTF-8 ");? Form method = "post" action = "demo_setCookie2.php" name: input type = "text" name = "username" input type = "submit" value = "login"/form? Php/
Welcome to the Linux community forum and interact with 2 million technicians>
Header ("Content-type: text/html; charset = UTF-8 ");
?>
/**
* Demo_setCookie2.php
*/
If (isset ($ _ POST ["username"]) & $ _ POST ["username"] = "benjamin "){
// Correct. Generate a cookie before redirecting
SetCookie ("username", "Benjamin ");
Header ("Location: demo_setCookieSuccess.php ");
} Else {
Header ("Location: demo_setCookie.php ");
}
?>
/**
* Demo_setCookieSuccess.php
*/
Header ("Content-type: text/html; charset = UTF-8 ");
If (isset ($ _ COOKIE ["username"]) {
Echo "welcome". $ _ COOKIE ["username"];
} Else {
Echo "illegal Logon ";
}
?>
[1] [2]