Re: MySQL password()
| From: | Liam MacKenzie | Date: | Tue, 30 Jul 2002 06:50:11 +0000 |
| Subject: | Re: MySQL password() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110304@lists.php.net to get a copy of this message | ||
Mmm.. think you misinterpreted my question...
http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
PASSWORD(str)
how do you unPASSWORD(str) in PHP?
----- Original Message -----
From: "Negrea Mihai" <mike@umft.ro>
To: "Liam MacKenzie" <phplist@operationenigma.com>
Cc: <php-general@lists.php.net>
Sent: Tuesday, July 30, 2002 4:31 PM
Subject: Re: [PHP] MySQL password()
> Try doing on the first time this:
> $query="SELECT * FROM users where username='$PHP_AUTH_USER' and passwd
> =password($PHP_AUTH_PW)";
> then with mysql_num_rows you find out if the query returned any row.. or
with
> is_resource()
> if it returned then the authentication was successfull.. if not.. not :)
>
>
> On Tuesday 30 July 2002 09:28 am, Liam MacKenzie wrote:
> > Hi all,
> > I do this:
> >
> >
> > dbconnect();
> > $query="SELECT * FROM users where username='$PHP_AUTH_USER'";
> > $result=mysql_query($query);
> > $list=mysql_fetch_array($result);
> > if ($PHP_AUTH_PW !== $list[passwd] || "" == $PHP_AUTH_PW || "all" !=
> > $list[domain]){
> > Header("WWW-authenticate: basic realm=\"EMM\"");
> > Header( "HTTP/1.0 401 Unauthorized");
> > unauthorized();
> > exit;
> > }
> > }
> >
> >
> >
> >
> > Noe this bit:
> > if ($PHP_AUTH_PW !== $list[passwd]
> >
> > My problem is that the password stored in MySQL was done with
password(),
> > so it comes out similar to this as plain text:
> >
> > 072g307j9236a82h3u
> >
> >
> > How do I Un password() it?
> >
> > I have RTFM but to no avail.
> >
> > If you tell me to RTFM again, at least tell me what to search for ;-)
> >
> > Cheers,
> > Liam
>
> --
> Negrea Mihai
> web: http://www.negrea.net
>
>
>