?
Solved

Problems with password() server function

Posted on 2003-12-02
4
Medium Priority
?
204 Views
Last Modified: 2008-03-06
Hi everyone,

I am creating a user registration and login forms.
During the user registration form I insert a record into my users table and encode my password with this method here is a snipet of my code:

$query = "INSERT INTO users (userID,userName, password, userType, irstName, lastName, phone, fax, email, website, gridArea, company, addedServices, specialty)  VALUES (NULL, '$userid', password('$userpassword'), '$userType', .......

The password field in MySQL database is a VarChar(10)

in my login form i will verify the user info and once again here is the snippet:

$query = "SELECT userType FROM $user_tablename WHERE userName = '$userid'                  AND password = password('$userpassword')";

THIS DOES NOT WORK, it does not seem to match the passwords. I have tried inserting an echo statement ensuring that the password passed by the variable is correct, I have echoed the whole query statement and it looks good.

I have tried inserting a user record without using the password method and then searching without of course using the password method and that seems to work. It is when I use the password method I am getting issues.

Could it my field size too small? or the wrong type?

Please help

Regards,
Chris

 
0
Comment
Question by:vinaymal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 400 total points
ID: 9862800
the field needs to be 16 chars in length, try then

loz
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9868309
password() function returns a string 16 chars in length... if you want to use the MD5() function, it returns a string 32 chars in length
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question