Advertisement
Shad0w

Untitled

Jan 4th, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. function setc($name, $content, $hours = "24") {
  3.     setcookie($name,$content,time()+3600*$hours);
  4. }
  5. function read_cookie($username){
  6.     return $_COOKIE[$username];
  7. }
  8. ?>
  9. <!doctype html>
  10.     <html>
  11.         <head>
  12.         <title>WebTrix- Log In</title>
  13.         <link rel="stylesheet" href="style.css" />
  14.         </head>
  15.         <body>
  16.             <div id="main">
  17.                 <div id="header">
  18.                 <div id="MyForm">
  19.                     <br /><h1>WebMatrix</h1>
  20.                     <form action="login.php" method="post">
  21.                     <?php
  22.                     if(isset($_POST["username"]))
  23.                     {
  24.                         $username=$_POST["username"];
  25.                         $MyPass=$_POST["MyPass"];
  26.                         if($username=="Admin"&&$MyPass==123456) {
  27.                             setc("username", $username, 48);
  28.                             setc("password", $MyPass, 48);
  29.                             print <<<HTML
  30.                             Welcom Admin
  31.                             <br /><br /><br /><br />
  32.                             <a href='secret.php' id='secret'>Secret page</a>
  33. HTML;
  34.                         }
  35.                     }
  36.                         else
  37.                         {
  38.                             echo "The username or Password you enterd is not correct!";
  39.                             echo "<br />";
  40.                             echo "<br />";
  41.                             echo "<br />";
  42.                             echo "<br />";
  43.                             echo "<a href='index.html'>Try again</a>";
  44.                         }
  45.                     }
  46.                     ?>
  47.                     </form>
  48.                 </div>
  49.                 </div>
  50.             </div>
  51.         </body>
  52.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement