Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-13-2008, 10:00 PM md5 problem
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Hey guys. I am playing around with md5() for a login script. I have it setup now where when you register it submits $password=md5($row['pass']); to the database and then when you login it checks if strtoupper($password)==strtoupper(md5($_POST[pass]))

The problem is I always get different results :P.

So to make things simple I had it submit md5("hello"); into the database when I registered and then when Im on the login page it just retrieves the password from the database and compares it to md5("hello"); on the login page.

But its still different. What stupid mistake am I doing today?
Truly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-13-2008, 10:09 PM Re: md5 problem
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I can't figure it out from what you've provided, but if you give a code snippet, that might help. Also, you don't need to use strtoupper, just comparing the md5() result should suffice.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-13-2008, 10:19 PM Re: md5 problem
Mattmaul1992's Avatar
Ultra Talker

Posts: 486
Name: Matt
Trades: -1
Yer.. Drop the strtouppers. Run this...
PHP Code:
<?php
if (md5('hello') == md5('hello'))
{
print 
'success';
}
else
{
print 
'failure';
}
?>
If success comes out it's getting messed up somewhere in your database otherwise wow.. Somethings seriously wrong with your server..
__________________
PHP Code:
$talkupation++; 

Please login or register to view this content. Registration is FREE
- Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 01-14-2008, 05:56 AM Re: md5 problem
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Are you sure that $row['pass'] is absolutely the same as $_POST['pass']?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 01-24-2008, 07:46 AM Re: md5 problem
carloncho's Avatar
Skilled Talker

Posts: 80
Name: Carlos
Trades: 0
Why use strtoupper?
__________________
-----------------------

Please login or register to view this content. Registration is FREE
carloncho is offline
Reply With Quote
View Public Profile Visit carloncho's homepage!
 
Reply     « Reply to md5 problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40486 seconds with 12 queries