Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = mysql_real_escape_string(stripslashes($_REQUEST["username"]));
- $password = sha1(md5(sha1($_REQUEST["passowrd"])));
- $con = mysql_connect("localhost","root","password"); // That's probably your password, Adam :P
- $query = mysql_query("SELECT * FROM `users` WHERE `username` = \"".$username."\"");
- if(!$query) exit("Cannot query database. (".mysql_error().")");
- else{
- if(mysql_num_rows($query) !== 1) die("Username does not exist.");
- $arr = mysql_fetch_array($query);
- if(!$arr) exit("Could not fetch mySQL array. (".mysql_error().")");
- if($password !=== $arr["password"]) exit("Invalid password.");
- else{
- session_start();
- $_SESSION["logged_in"] = true; // Something to that matter.
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement