Current location: Hot Scripts Forums » Programming Languages » PHP » MySQL Password()


MySQL Password()

Reply
  #1 (permalink)  
Old 05-03-04, 02:31 PM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
MySQL Password()

When I use the Password function in MYSQL, it will encrypt the password rite... how do I decrypt it back?
I notice also the encryption varies, if I encrypt the same value twice.
Now I realise that I cannot backup my database since the encrypted password will be different.

I use the following for password validation :-
PHP Code:

$username $_POST['user'];

$passwrd $_POST['pass'];

$query "SELECT * FROM user WHERE userid='$username' AND pass=PASSWORD('$passwrd')"
__________________
Mr. Brown Eyes
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 01:40 AM
nd2 nd2 is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
you don't.
you encript the password you want to match, such as the one coming from user input form.

$query = "SELECT * FROM user WHERE userid='$username' AND pass=PASSWORD('".addslashes($_POST['passwrd'])."')";

if you are using mysql 4.0 or less use md5() becouse it's a bit more secure, however if you have 4.1 or beater mysql has updated the password function in this release to a 41byte long hash compared to md5's 32byte long hash and the old password functions 16byte.
__________________
IonCMS (Coming Soon.)
http://ioncms.com
--
Ncaster (Free php/mysql cms)
http://ncaster.cjb.net
Reply With Quote
  #3 (permalink)  
Old 05-05-04, 10:59 PM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
Then how do I backup my database?
__________________
Mr. Brown Eyes
Reply With Quote
  #4 (permalink)  
Old 05-06-04, 05:14 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Quote:
Originally Posted by eddyvlad
Then how do I backup my database?
if you are using phpMyAdmin, Click on Export and all tables should be packed into a file or shown on screen...
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #5 (permalink)  
Old 05-07-04, 11:16 AM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by NeverMind
if you are using phpMyAdmin, Click on Export and all tables should be packed into a file or shown on screen...
The problem is, the encrypted password will stay encrypted and when I load it back at the database, the encrypted password will not be valid coz MySQL will somehow have a different encryption like an enigma machine or something.
__________________
Mr. Brown Eyes
Reply With Quote
  #6 (permalink)  
Old 05-07-04, 12:10 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
after you have encrypted all passwords, you can't retraive the original ones !
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 01:41 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
Error while creating database (Errornumber 2002: "Can't connect to local MySQL server lylesback2 PHP 5 04-11-04 01:37 PM
mysql crash IMPORTANT comby PHP 0 03-02-04 10:27 AM
great product for dumping/recovering MySQL databases Dave Brown General Advertisements 1 10-03-03 07:40 AM


All times are GMT -5. The time now is 10:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.