Jump to content


Photo

Mixing php function in SELECT query


  • Please log in to reply
5 replies to this topic

#1 belick

belick
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 21 November 2005 - 04:52 PM

I need to use my PHP function in the mysql query like:


SELECT Password FROM TABLE WHERE User = 'AnyUser' && '$_POST[PASS]' = checkcrypt(Password ) LIMIT 0,1

Any help?
<?="C"+"Y"+"T"+"N"+"E"+"T"+"."+"C"+"O"+"M";?>
Cytnet.com :-)

#2 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 21 November 2005 - 05:11 PM

$sql = "SELECT Password FROM TABLE WHERE User = 'AnyUser' && '$_POST[PASS]' = '".checkcrypt(Password)."' LIMIT 0,1";

Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#3 belick

belick
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 21 November 2005 - 05:21 PM

I tried that, the problem is that I need to place the "Password" field from the database which is something like: SDFDS3532523rfqASdfsd3D23D3f223g3g and instatd its try to decrypt the word Password...



<?="C"+"Y"+"T"+"N"+"E"+"T"+"."+"C"+"O"+"M";?>
Cytnet.com :-)

#4 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 21 November 2005 - 05:28 PM

i thought Password was coming from a php variable...
how did you store the password? MD5?
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#5 belick

belick
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 21 November 2005 - 05:36 PM

kind of I have my own encryption function, if it was md5 so mysql would work fine, that's my problem... :-(
<?="C"+"Y"+"T"+"N"+"E"+"T"+"."+"C"+"O"+"M";?>
Cytnet.com :-)

#6 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 21 November 2005 - 06:43 PM

if you encrypt the password before storing into the db, then you could use the syntax I gave you. If not, then you have to do that after you got the record from the query.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users