daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Jun 18th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Get user login ID from username and password
  2. function user_login_id($username, $password) {
  3.     $username = sanitize($username);
  4.     $password = sha1($password);
  5.     $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;");
  6.     if ($data !== false) return $data['id'];
  7.     else return false;
  8. }
  9.  
  10. // TFS 0.3+ compatibility.
  11. function user_login_id_03($username, $password) {
  12.     if (config('salt') === true) {
  13.         if (user_exist($username)) {
  14.             $user_id = user_id($username);
  15.             $username = sanitize($username);
  16.            
  17.             $data = mysql_select_single("SELECT `salt`, `id`, `name`, `password` FROM `accounts` WHERE `id`='$user_id';");
  18.             $salt = $data['salt'];
  19.             if (!empty($salt)) $password = sha1($salt.$password);
  20.             else $password = sha1($password);
  21.             return ($data !== false && $data['name'] == $username && $data['password'] == $password) ? $data['id'] : false;
  22.         } else return false;
  23.     } else return user_login_id($username, $password);
  24. }
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