Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2005-12-20, 06:47 AM
Junior Member
 
Join Date: Dec 2005
Posts: 2
chewdata
Default

I have tried to use MD5 to store passwords in a text file,
however when I compare the user password with the MD5 password, ie if ( $userpass = MD5($password ) { }, I get an "unexpected $" parse error.
I'm confused, as it works on my pc running apache/php/mysql (localhost)

Any help appreciated
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2005-12-20, 11:06 AM
Member
 
Join Date: Aug 2005
Location: Petoskey, MI
Posts: 83
n8dnx
Default

chewdata:

Your code should absolutely work, except that "=" should be "==". I'm a bit confused by the parse error message thought, was that all it said?

In any case, the code below works.

Code:
<?php
$password = 'THISisaTEST';
$userpass = MD5($password);
if ( $userpass == MD5($password ) ) { echo "HERE"; }
?>
If you have any other problems it may be that you're not getting $password back out of your text file correctly. You may want to have it display the string before it's stored and visually compare it to what you're getting back out of the text file.
Reply With Quote
  #3 (permalink)  
Old 2005-12-20, 11:49 AM
Junior Member
 
Join Date: Dec 2005
Posts: 2
chewdata
Default

Thanks
That'all it said
However I think the problem is in paring the text file

Looking into it,I'll post result
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:28 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.