Advertisement
Guest User

Untitled

a guest
Jun 6th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     require("configuration.php");
  4.  
  5.         if(isset($_GET['login']))
  6.         {
  7.  
  8.             $username = $_POST[username];
  9.             $password = md5(sha1(md5(sha1($_POST[password]))));
  10.             $db_info = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
  11.             $db_data = mysql_fetch_array($db_info);
  12.             $check_db = mysql_num_rows($db_info);
  13.  
  14.             if($check_db == 0)
  15.             {
  16.  
  17.                 echo("Account not found in our database.");
  18.  
  19.             }
  20.             else
  21.  
  22.             if($db_rdata[password] == $password)
  23.             {
  24.  
  25.                 $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
  26.                 $user = mysql_fetch_array($query);
  27.                 $_SESSION['id'] = "$user[id]";
  28.                 $_SESSION['password'] = "$user[password]";
  29.                 echo("Loading Index...<meta http-equiv='refresh' content='1;url=main.php'>");
  30.  
  31.             }
  32.             else
  33.             {
  34.  
  35.                 echo("Incorrect username or password!");
  36.  
  37.             }
  38.  
  39.         }
  40.         else
  41.         {
  42.  
  43.             echo("<form action='index.php?login' method='post'>
  44.            <input type='text' name='username' /><br />
  45.            <input type='password' name='password' /><br />
  46.            <input type='submit' name='submit' value='Login' /><br />
  47.            <br /><strong>Your IP will be logged ($_SERVER[REMOTE_ADDR])</strong>
  48.            </form>");
  49.  
  50.         }
  51.  
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement