Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //error_reporting(0);
- if(isset($_GET['username']) AND isset($_GET['password'])){
- $username = $_GET['username'];
- $password = $_GET['password'];
- } else {
- $username = "";
- $password = "";
- }
- if(isset($_COOKIE['username']) AND isset($_COOKIE['password'])){
- $username = $_COOKIE['username'];
- $password = $_COOKIE['password'];
- }
- ?>
- <?php
- if($username == "test" AND $password == "test"){
- echo '
- Sono Loggato, ora sloggati!
- <br><br>
- <form method="POST">
- <input type="submit" name="logout" value="logout"/>
- <a href="/"></a>
- </form>
- ';
- if(isset($_POST['logout'])){
- $username = NULL;
- $password = NULL;
- header("refresh:0; url=/");
- }
- setcookie("username", $username, time() + 300);
- setcookie("password", $password, time() + 300);
- } else {
- echo '
- <form action="/" method="GET">
- Username: <input type="text" name="username"></input>
- <br><br>
- Password: <input type="password" name="password"></input>
- <br><br>
- <input type="submit" value="login"></input>
- </form>
- ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement