Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-02-2012, 09:19 PM   PM User | #1
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
How Can I echo password from mysql

Can I echo password from mysql if so how do I do this as I done <?php echo $password; ?> but it blank


Thank you for replys
Whatnot is offline   Reply With Quote
Old 07-02-2012, 09:28 PM   PM User | #2
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
What code do you have so far?
__________________
Logic will get you from A to B. Imagination will take you everywhere.
Albert Einstein
dan-dan is offline   Reply With Quote
Old 07-02-2012, 09:48 PM   PM User | #3
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
It's probably encrypted?
But as Dan-Dan mentioned ... let's see the script so far.
mlseim is offline   Reply With Quote
Old 07-02-2012, 11:18 PM   PM User | #4
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
yes the password is encrypted can it be done?
Whatnot is offline   Reply With Quote
Old 07-03-2012, 12:42 AM   PM User | #5
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
This is a better explanation that I can provide:
http://webcheatsheet.com/php/md5_encrypt_passwords.php



.
mlseim is offline   Reply With Quote
Old 07-03-2012, 06:24 PM   PM User | #6
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
so can I decipher the password then echo it?
Whatnot is offline   Reply With Quote
Old 07-03-2012, 06:40 PM   PM User | #7
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
If its encrypted? Not really... some encryptions have been broken, like MD5, but if an encryption was easy to reverse engineer, it'd serve no purpose.

Last edited by Keleth; 07-03-2012 at 06:49 PM..
Keleth is offline   Reply With Quote
Old 07-03-2012, 06:46 PM   PM User | #8
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
No you can't! MD5 hashing is a one way encryption. That is why to match a password typed by a user to a password saved in the database, the typed password would also be hashed first.
__________________
Logic will get you from A to B. Imagination will take you everywhere.
Albert Einstein
dan-dan is offline   Reply With Quote
Old 07-03-2012, 08:24 PM   PM User | #9
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Encrypted: yes, you sure can. If you know how it was generated you can reverse it.
Hashed: no. Its purpose is one way, although you may be able to calculate an equivalency phrase (ie: more than one value hash to the same result).

MD5 (don't use btw), sha, and many others are all hashing techniques. You cannot go backwards. Well designed salting techniques would also make creating a comparable phrase through brute a horrendously long task to calculate. As in years, if you're lucky (or by theory, best case scenario would be O(1), but good luck at that).

You never compare the value of a database stored password. You compare the same hashed or encrypted value of a provided one to the database for comparison.
Fou-Lu is offline   Reply With Quote
Old 07-03-2012, 08:45 PM   PM User | #10
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Thanks for the lingo correction Fou, I always got those confused.
Keleth is offline   Reply With Quote
Old 07-03-2012, 09:03 PM   PM User | #11
Whatnot
New Coder

 
Join Date: Feb 2011
Posts: 69
Thanks: 7
Thanked 1 Time in 1 Post
Whatnot is an unknown quantity at this point
Code:
         if($database->addNewUser($subemail, md5($subpass), $subuser, $subgender, $subage)){
that hash?
Whatnot is offline   Reply With Quote
Old 07-03-2012, 09:18 PM   PM User | #12
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Yes, MD5 is a hash, as Fou mentioned. So you can't get back the original password, it would defeat the entire purpose of password security.
Keleth is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 09:45 AM.


Advertisement
Log in to turn off these ads.