Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $my_loginName = "comp321";
- $my_password = "comp321_0910";
- $expire_period = time()+60*60;
- $login_success = false;
- if(isset($_POST['loginName'])){
- $loginName = $_POST['loginName'];
- $password = $_POST['password'];
- setcookie("login_success", false, $expire_period);
- if($loginName == $my_loginName && $password == $my_password){
- $login_success = true;
- setcookie("login_success", true, $expire_period);
- setcookie("login_time", date(DATE_COOKIE), $expire_period);
- header( "Location:".$_SERVER['PHP_SELF'] );
- exit();
- }
- }
- if(isset($_GET['logout'])){
- setcookie("login_success", '', time()-3600);
- setcookie("login_time", '', time()-3600);
- header( "Location:".$_SERVER['PHP_SELF'] );
- exit();
- }
- ?>
- <html>
- <body>
- <?php
- if(isset($_COOKIE['login_success'])){
- ?>
- You are already logged in successfully. <br>
- <?php
- }else{
- ?>
- <h1 align="center">321 shopping center</h1>
- <image src="">
- <form name="frm_login" method="POST" action="store.php">
- <table align="center" width="300" border="0" cellspacing="5" cellpadding="5">
- <tr>
- <td>Username : </td>
- <td><input name="loginName" id="loginName" type="text"></td>
- </tr>
- <tr>
- <td>Password : </td>
- <td><input name="password" id="password" type="password"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" value="Login">
- <a href="registration.php">New user</a></td>
- </tr>
- </table>
- </form>
- <?php
- if($login_success == false && isset($_POST['loginName'])){
- ?>
- <font color="#FF0000">
- <b>username or password incorrect!</b></font><br><br>
- <?php
- }
- }
- ?>
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement