Advertisement
Guest User

Untitled

a guest
May 12th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. $username = mysql_real_escape_string(stripslashes($_REQUEST["username"]));
  3. $password = sha1(md5(sha1($_REQUEST["passowrd"])));
  4. $con = mysql_connect("localhost","root","password"); // That's probably your password, Adam :P
  5. $query = mysql_query("SELECT * FROM `users` WHERE `username` = \"".$username."\"");
  6. if(!$query) exit("Cannot query database. (".mysql_error().")");
  7. else{
  8.     if(mysql_num_rows($query) !== 1) die("Username does not exist.");
  9.     $arr = mysql_fetch_array($query);
  10.     if(!$arr) exit("Could not fetch mySQL array. (".mysql_error().")");
  11.     if($password !=== $arr["password"]) exit("Invalid password.");
  12.     else{
  13.         session_start();
  14.         $_SESSION["logged_in"] = true; // Something to that matter.
  15.     }
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement