SHARE
TWEET

Untitled

a guest Oct 4th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     // Set database server access variables:
  3.     $host = "localhost";
  4.     $user = "root";
  5.     $pass = "root";
  6.     $db = "logansarchive";
  7.  
  8.     // Open connection
  9.     $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
  10.    
  11.     // Select database
  12.     mysql_select_db($db) or die ("Unable to select database!");
  13.  
  14.     $user = $_POST["adminname"];
  15.     $pass = $_POST["adminpass"];
  16.    
  17.     $passwordHash = sha1(pass);
  18.    
  19.     $query = "SELECT AdminName FROM Admins WHERE AdminName = '".$user."' AND AdminPass = '".$passwordHash."'";
  20.     $result = mysql_query($query) or die ("<p>Error in query:</p><p>".$query."</p><p>".mysql_error()."</p>");
  21.     if (mysql_num_rows($result) < 1)
  22.     {
  23.         // Access denied
  24.         header('Location: auth.php?r=0');
  25.     }
  26.     else
  27.     {
  28.         // Access granted
  29.         session_start();
  30.         $_SESSION['name'] = $user;
  31.         header('Location: index.php');
  32.     }
  33. ?>
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