Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $_SESSION['valid_user_name'] = getUserId($username, $password);
- function getUserId($username, $password)
- {
- $username = addslashes($username);
- $username = mysql_real_escape_string($username);
- $password = addslashes($password);
- $password = mysql_real_escape_string($password);
- $conn = db_connect();
- $result = $conn->query("select id from user where username='$username' and password= sha1('$password')");
- if (!$result) {
- throw new Exception('Could not retrieve your user id.');
- }
- if ($result->num_rows > 0) {
- return $result;
- } else {
- throw new Exception('Could not retrieve your user id.');
- }
- }
Add Comment
Please, Sign In to add comment