mirror of
https://github.com/php/web-php.git
synced 2026-03-31 19:52:29 +02:00
20 lines
547 B
PHP
20 lines
547 B
PHP
<?
|
|
if (isset($user) && isset($pass)) {
|
|
$MAGIC_COOKIE = base64_encode("$user:$pass");
|
|
# we set a cookie good for five years
|
|
SetCookie("MAGIC_COOKIE", base64_encode("$user:$pass"), time()+157248000);
|
|
echo "<b>Cookie set</b>.<br>";
|
|
}
|
|
if (isset($MAGIC_COOKIE)) {
|
|
list($user,$pass) = explode(":", base64_decode($MAGIC_COOKIE));
|
|
}
|
|
?>
|
|
|
|
<form action="<?echo $PHP_SELF;?>" method="POST">
|
|
user: <input type=text name=user value="<?echo $user;?>">
|
|
<br>
|
|
pass: <input type=password name=pass value="<?echo $pass;?>">
|
|
<br>
|
|
<input type=submit>
|
|
</form>
|