473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problems when using PASSWORD( $pass) in PHP/MySql

Hello.
I have a login pages with two fields. One for username and one for
password.
The username and password are stored in a mysql table.

When I am using plain-text password. It is no problem to login.
But when I use the PASSWORD() function, it is not possible to login at
all.

Is it because of the way I query the database?

I like to use the PASSWORD() function since it make a password like
"jad79daf78" to be similar to
"9834asfg25t4i930aga494asfd4faf444ijsd4457" in the password cell
instead of plain "jad79daf78"

Karl
Jan 10 '08 #1
4 1353
..oO(Karl)
>I have a login pages with two fields. One for username and one for
password.
The username and password are stored in a mysql table.

When I am using plain-text password. It is no problem to login.
But when I use the PASSWORD() function, it is not possible to login at
all.

Is it because of the way I query the database?
We don't know how you query the database since you didn't post any
query. But if you use PASSWORD() to store the passwords, then of course
you also have to call PASSWORD() when you compare the user-submitted PW
with the stored one.

Micha
Jan 10 '08 #2
On 10 Jan, 12:32, Michael Fesser <neti...@gmx.dewrote:
.oO(Karl)

Is it because of the way I query the database?

We don't know how you query the database since you didn't post any
query. But if you use PASSWORD() to store the passwords, then of course
you also have to call PASSWORD() when you compare the user-submitted PW
with the stored one.
Yes, i think that. But how do I build a query that call PASSWORD()?

Jan 10 '08 #3
..oO(Karl)
>On 10 Jan, 12:32, Michael Fesser <neti...@gmx.dewrote:
>.oO(Karl)

>Is it because of the way I query the database?

We don't know how you query the database since you didn't post any
query. But if you use PASSWORD() to store the passwords, then of course
you also have to call PASSWORD() when you compare the user-submitted PW
with the stored one.

Yes, i think that. But how do I build a query that call PASSWORD()?
SELECT ...
FROM yourAuthTable
WHERE username = '$username'
AND password = PASSWORD('$password')

where $username and $password contain the validated and sanitized values
(see mysql_real_escape_string()) from the form on your HTML page.

Micha
Jan 10 '08 #4
Michael Fesser wrote:
SELECT ...
FROM yourAuthTable
WHERE username = '$username'
AND password = PASSWORD('$password')

where $username and $password contain the validated and sanitized values
(see mysql_real_escape_string()) from the form on your HTML page.
Thank you!

Karl
Jan 10 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: P Srinivasulu | last post by:
When Mysql runs on machine with multiple NIC's. Mysql server takes the IP Address that we specify in the configuration file. This IP Address may or may not be a primary IP Address of that machine....
1
by: encohen | last post by:
There have been several posts on having MS Access using MySQL as the backend db. I know that you have to set up an ODBC connection and use the MySQL odbc driver. What I want to know is how to set up...
2
by: Shun | last post by:
Hello, I am new to .net Platform. I want to build a sample application using VB.net and backend mysql. now my problem is how to connect to the mysql database. which is the better provider(...
0
by: xkp | last post by:
Hi all, i just had to install the 5.0 version of mysql. previously i used an old 3."something" (my server crashed so i dont remember the precise version). I used to access mysql database using...
14
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
1
by: Ted | last post by:
In MS SQL I used the following to create a stored procedure. USE AdventureWorks; GO IF OBJECT_ID ( 'HumanResources.usp_My_Search', 'P' ) IS NOT NULL DROP PROCEDURE HumanResources.usp_My_Search;...
9
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is...
1
by: WebNewbie | last post by:
Hi, I am new to using mysql and there isn't any tutorials online on that shows how to create mysql stored procedure for paging purposes. Thus, I read tutorials on creating stored proc that were...
0
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.