871 // echo '(debug) $session->validate_session: Key does not match regex<br />Decrypted key: '.$decrypted_key; |
871 // echo '(debug) $session->validate_session: Key does not match regex<br />Decrypted key: '.$decrypted_key; |
872 return false; |
872 return false; |
873 } |
873 } |
874 $keyhash = md5($key); |
874 $keyhash = md5($key); |
875 $salt = $db->escape($keydata[3]); |
875 $salt = $db->escape($keydata[3]); |
876 $query = $this->sql('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms,x.* FROM '.table_prefix.'session_keys AS k |
876 $query = $db->sql_query('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms,x.* FROM '.table_prefix.'session_keys AS k |
877 LEFT JOIN '.table_prefix.'users AS u |
877 LEFT JOIN '.table_prefix.'users AS u |
878 ON ( u.user_id=k.user_id ) |
878 ON ( u.user_id=k.user_id ) |
879 LEFT JOIN '.table_prefix.'users_extra AS x |
879 LEFT JOIN '.table_prefix.'users_extra AS x |
880 ON ( u.user_id=x.user_id OR x.user_id IS NULL ) |
880 ON ( u.user_id=x.user_id OR x.user_id IS NULL ) |
881 LEFT JOIN '.table_prefix.'privmsgs AS p |
881 LEFT JOIN '.table_prefix.'privmsgs AS p |
882 ON ( p.message_to=u.username AND p.message_read=0 ) |
882 ON ( p.message_to=u.username AND p.message_read=0 ) |
883 WHERE k.session_key=\''.$keyhash.'\' |
883 WHERE k.session_key=\''.$keyhash.'\' |
884 AND k.salt=\''.$salt.'\' |
884 AND k.salt=\''.$salt.'\' |
885 GROUP BY u.user_id;'); |
885 GROUP BY u.user_id;'); |
|
886 if ( !$query ) |
|
887 { |
|
888 $query = $this->sql('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,u.reg_time,u.account_active,u.activation_key,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms FROM '.table_prefix.'session_keys AS k |
|
889 LEFT JOIN '.table_prefix.'users AS u |
|
890 ON ( u.user_id=k.user_id ) |
|
891 LEFT JOIN '.table_prefix.'privmsgs AS p |
|
892 ON ( p.message_to=u.username AND p.message_read=0 ) |
|
893 WHERE k.session_key=\''.$keyhash.'\' |
|
894 AND k.salt=\''.$salt.'\' |
|
895 GROUP BY u.user_id;'); |
|
896 } |
886 if($db->numrows() < 1) |
897 if($db->numrows() < 1) |
887 { |
898 { |
888 // echo '(debug) $session->validate_session: Key was not found in database<br />'; |
899 // echo '(debug) $session->validate_session: Key was not found in database<br />'; |
889 return false; |
900 return false; |
890 } |
901 } |