Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //admin - 1234
- if( isset($_POST["login"]) && isset($_POST["pass"]) &&
- !empty($_POST["login"]) && !empty($_POST["pass"]) &&
- !isset($_GET["exit"])
- ){
- if($_POST["login"]=="admin" && $_POST["pass"]==1234){
- setcookie('exit', 'yes', time() + (60*60*8));
- header('Refresh: 1; url=http://phpchallenge.dev04/3-4.php');
- }else{
- echo "Пользователь не найден";
- }
- }
- if($_GET["singout"]=="yes"){
- setcookie('exit', '', 1);
- header('Refresh: 1; url=http://phpchallenge.dev04/3-4.php');
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <title></title>
- <meta charset="utf-8">
- </head>
- <body>
- <?php if($_COOKIE["exit"]){ ?>
- <p>Добро пожаловать!!!</p>
- <a href="<?php echo $_SERVER['PHP_SELF'];?>?singout=yes">Выйти</a>
- <?php }else{ ?>
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
- <input type="text" name="login" placeholder="Login" />
- <input type="text" name="pass" placeholder="Password"/>
- <input type="submit" value="sing in" />
- <input type="reset" />
- </form>
- <?php } ?>
- <body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement