Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get user login ID from username and password
- function user_login_id($username, $password) {
- $username = sanitize($username);
- $password = sha1($password);
- $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;");
- if ($data !== false) return $data['id'];
- else return false;
- }
- // TFS 0.3+ compatibility.
- function user_login_id_03($username, $password) {
- if (config('salt') === true) {
- if (user_exist($username)) {
- $user_id = user_id($username);
- $username = sanitize($username);
- $data = mysql_select_single("SELECT `salt`, `id`, `name`, `password` FROM `accounts` WHERE `id`='$user_id';");
- $salt = $data['salt'];
- if (!empty($salt)) $password = sha1($salt.$password);
- else $password = sha1($password);
- return ($data !== false && $data['name'] == $username && $data['password'] == $password) ? $data['id'] : false;
- } else return false;
- } else return user_login_id($username, $password);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement