Re: [PHP] password=password('$password') <----- ? help me... :P
I've got a typo near the bottom: left(password('$cPasswordf),10)"; should be left(password('$cPassword'),10)"; (Strange, the "f" is nowhere near " ' ") mt At 05:41 PM 1/19/2002 -0400, Miles Thompson wrote: >Hawk, > >Pardon me for not following this thread very closely, but I just played >around at the MySQL console. The fields I have are cName c(20) and >cPassword(10) > >This executed OK >insert admin (cName, cPassword) values ('Deb', password('peaches')); > >select cName, cPassword from admin; >returned >Deb : 041ae71715 > >select cName, cPassword from admin where cName = 'Deb' and cPassword = >password('peaches'); >returned >Empty Set (Uh Oh! -- Thought a bit ...) > >select cName, cPassword from admin where cName = 'Deb' and cPassword = >left(password('peaches'),10); >returned >Deb : 041ae71715 > >I've left the field names out just for convenience, but this leads me to >two questions: > >1. Password is the name of a function and you're using it as a field name. >Can you confirm that MySQL isn't choking on that? > >2. Could field length be the problem? > >A query of this form works >select cName, cPassword from admin where cName = 'Deb' and cPassword = >left(password('peaches'),10); >so in PHP this should work >$cName = 'Deb'; >$cPassword = 'peaches'; >$qry = "select cName, cPassword from admin where cName = '$cName' and >cPassword = left(password('$cPasswordf),10)"; >etc > >Have you echoed your query and what does it display? > >I hope this is helpful - Miles > > > >At 08:41 PM 1/19/2002 +0100, Hawk wrote: >>I've been trying to get this to work for a while, and everyone says that I >>should use the same thing, but it doesn't work, can anyone tell me what I'm >>doing wrong? >>from the form on the previous page I have the $username and $password vars >> >>mysql_connect($host, $user, $pswd); >>mysql_select_db($db); >>$query = "SELECT username,password FROM users WHERE username='$username' AND >>password=password('$password')"; >>$result = mysql_query($query); >>$num = mysql_num_rows($result); >> >>the $query line is made up from what everyone has told me to write.. >>I tried to add a list($usarname, $pessword) = mysql_fetch_row($result); >>and it returned "" .. but when I removed the "AND >>password=password('$password')" part the list showed the username and the >>password in encrypted form >>I don't know how this could help me in any way, but atleast it shows I have >>an encrypted password, but the problem is that the line everyone uses >>doesn't work.. maybe I need to change some setting in mysql och php.ini or >>something? anyone have any idea? >>I know I've asked this several times but it doesn't seem like I'm understood >>with my problem. Hope I will be now. >> >>Hawk >> >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >>To contact the list administrators, e-mail: [EMAIL PROTECTED] > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] password=password('$password') <----- ? help me... :P
Hawk, Pardon me for not following this thread very closely, but I just played around at the MySQL console. The fields I have are cName c(20) and cPassword(10) This executed OK insert admin (cName, cPassword) values ('Deb', password('peaches')); select cName, cPassword from admin; returned Deb : 041ae71715 select cName, cPassword from admin where cName = 'Deb' and cPassword = password('peaches'); returned Empty Set (Uh Oh! -- Thought a bit ...) select cName, cPassword from admin where cName = 'Deb' and cPassword = left(password('peaches'),10); returned Deb : 041ae71715 I've left the field names out just for convenience, but this leads me to two questions: 1. Password is the name of a function and you're using it as a field name. Can you confirm that MySQL isn't choking on that? 2. Could field length be the problem? A query of this form works select cName, cPassword from admin where cName = 'Deb' and cPassword = left(password('peaches'),10); so in PHP this should work $cName = 'Deb'; $cPassword = 'peaches'; $qry = "select cName, cPassword from admin where cName = '$cName' and cPassword = left(password('$cPasswordf),10)"; etc Have you echoed your query and what does it display? I hope this is helpful - Miles At 08:41 PM 1/19/2002 +0100, Hawk wrote: >I've been trying to get this to work for a while, and everyone says that I >should use the same thing, but it doesn't work, can anyone tell me what I'm >doing wrong? >from the form on the previous page I have the $username and $password vars > >mysql_connect($host, $user, $pswd); >mysql_select_db($db); >$query = "SELECT username,password FROM users WHERE username='$username' AND >password=password('$password')"; >$result = mysql_query($query); >$num = mysql_num_rows($result); > >the $query line is made up from what everyone has told me to write.. >I tried to add a list($usarname, $pessword) = mysql_fetch_row($result); >and it returned "" .. but when I removed the "AND >password=password('$password')" part the list showed the username and the >password in encrypted form >I don't know how this could help me in any way, but atleast it shows I have >an encrypted password, but the problem is that the line everyone uses >doesn't work.. maybe I need to change some setting in mysql och php.ini or >something? anyone have any idea? >I know I've asked this several times but it doesn't seem like I'm understood >with my problem. Hope I will be now. > >Hawk > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: [PHP] password=password('$password') <----- ? help me... :P
Try this one .. :) .. mysql_connect($host, $user, $pswd); mysql_select_db($db); $query = "SELECT username,password FROM users WHERE username='$username' AND password='$password'"; $result = mysql_query($query); $num = mysql_num_rows($result); -Ursprüngliche Nachricht- Von: Hawk [mailto:[EMAIL PROTECTED]] Gesendet: Samstag, 19. Januar 2002 20:41 An: [EMAIL PROTECTED] Betreff: [PHP] password=password('$password') <- ? help me... :P I've been trying to get this to work for a while, and everyone says that I should use the same thing, but it doesn't work, can anyone tell me what I'm doing wrong? from the form on the previous page I have the $username and $password vars mysql_connect($host, $user, $pswd); mysql_select_db($db); $query = "SELECT username,password FROM users WHERE username='$username' AND password=password('$password')"; $result = mysql_query($query); $num = mysql_num_rows($result); the $query line is made up from what everyone has told me to write.. I tried to add a list($usarname, $pessword) = mysql_fetch_row($result); and it returned "" .. but when I removed the "AND password=password('$password')" part the list showed the username and the password in encrypted form I don't know how this could help me in any way, but atleast it shows I have an encrypted password, but the problem is that the line everyone uses doesn't work.. maybe I need to change some setting in mysql och php.ini or something? anyone have any idea? I know I've asked this several times but it doesn't seem like I'm understood with my problem. Hope I will be now. Hawk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] password=password('$password') <----- ? help me... :P
I've been trying to get this to work for a while, and everyone says that I should use the same thing, but it doesn't work, can anyone tell me what I'm doing wrong? from the form on the previous page I have the $username and $password vars mysql_connect($host, $user, $pswd); mysql_select_db($db); $query = "SELECT username,password FROM users WHERE username='$username' AND password=password('$password')"; $result = mysql_query($query); $num = mysql_num_rows($result); the $query line is made up from what everyone has told me to write.. I tried to add a list($usarname, $pessword) = mysql_fetch_row($result); and it returned "" .. but when I removed the "AND password=password('$password')" part the list showed the username and the password in encrypted form I don't know how this could help me in any way, but atleast it shows I have an encrypted password, but the problem is that the line everyone uses doesn't work.. maybe I need to change some setting in mysql och php.ini or something? anyone have any idea? I know I've asked this several times but it doesn't seem like I'm understood with my problem. Hope I will be now. Hawk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]