vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   LowerCase (https://vborg.vbsupport.ru/showthread.php?t=164668)

Goofy12 12-08-2007 09:30 AM

LowerCase
 
Hey I made a script to check the username + password
most important line is:
Code:

$result = mysql_fetch_array( mysql_query("SELECT * FROM `vb_user` WHERE username='$name' AND password='$pass'",$db) );
but there is one problem, if I check:

Code:

user:Username
pass:password

it will work

Code:

user:username
pass:password

it wont work.

it depends on how the user registered... if he registered with a uppercase it wont work if i check with lowercase, and if he registered with a lowercase it wont work if I check with uppercase.

Opserty 12-08-2007 09:42 AM

I presume vb_user is the vBulletin User table correct?

If so your query won't return no matches because you will first have to hash the password so you can compare them. Here is a quick outline of what you need to do:
  1. Connect to the Database
  2. Fetch the Username, Password and SALT
  3. Hash the input password and then hash it again with the salt.
  4. Compare the input password with the Password you fetch from the database
  5. Then do whatever you need to depending on the result.
With regards to your actual question, I don't think Passwords are case sensitive however I'm not too sure about Usernames but I think they are case-sensitve too.

Marco van Herwaarden 12-08-2007 09:42 AM

There are a few solutions to this:

- Force both to lowercase
- Use LIKE instead of = (WHERE username LIKE '$name')

Edit: In contrary to the previous post, passwords are case-sensitive (the stored hash not really case-sensitive), usernames can be handle case-insensitive.


All times are GMT. The time now is 09:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01003 seconds
  • Memory Usage 1,711KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete