SHARE
TWEET

Untitled

a guest May 31st, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php session_start(); ?>
  2. <html><head><link href="main.css" rel="stylesheet" type="text/css" /></head><html>
  3. <?php
  4. include_once("connect.php");
  5. if(isset($_POST['submit'])) {
  6.         $username = $_POST['username'];
  7.         $password = $_POST['password'];
  8.     if(isset($_POST['username']) && isset($_POST['password'])) {
  9.         $password = stripslashes($password);
  10.         $username = stripslashes($username);
  11.         $username = mysql_real_escape_string($username);
  12.         $password = mysql_real_escape_string($password);
  13.         $row = mysql_query("SELECT * FROM login WHERE username='".$username."' AND password='".$password."' LIMIT 1");
  14.         if(mysql_num_rows($row) > 0 ) {
  15.             $_SESSION['loggedin'] = true;
  16.             $_SESSION['username'] = $username;
  17.             echo "Login Success!";
  18.             header("Location:index.php?page=home");
  19.         } else {
  20.         echo "WRONG USERNAME/PASSWORD";
  21.         }
  22.     }
  23. } else {
  24. echo '<form action="login.php" method="post">
  25. <table bgcolor="#111" width="274" border="0" align="center">
  26.  <tr>
  27.    <td colspan="2" align="center" bgcolor="#333">Please Login</td>
  28.  </tr>
  29.  <tr>
  30.    <td width="94" align="center" bgcolor="#333">Username:</td>
  31.    <td width="170" align="center" bgcolor="#333"><input type="text" name="username"></td>
  32.  </tr>
  33.  <tr>
  34.    <td align="center" bgcolor="#333">Password :</td>
  35.    <td align="center" bgcolor="#333"><input type="password" name="password"></td>
  36.  </tr>
  37.  <tr>
  38.    <td colspan="2" align="center" bgcolor="#333"><input type="submit" name="submit" value="login"></td>
  39.  </tr>
  40. </table>
  41. </form>';
  42. }
  43. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top