473,386 Members | 1,715 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,386 software developers and data experts.

password checker

hi,
I have a little problem with the following part of my code.
I use post method to get the password from the form [$first ].
Because there is an encrypted password in mysql database, I check with
$pass = mysql_query("Select password('$unencryptedPass')");
while($row = mysql_fetch_array($unencryptedPass))
{

$encryptedPassw = $row[0];
}
how the encrypted password looks like.
Then I make a simple query:
mysql_query("Select login, password from edv_verantwortliche where
login = '$login' AND password = '$encryptedPassw'") or
die("authorization failed");
But it doesn' t seem to work. I could login every time.

I have checked all values with echo method - they are correct...
Could somebody help me, please.

TIA
Jul 17 '05 #1
1 2366

On 5-Oct-2003, eu******@student.euv-frankfurt-o.de (magda muskala) wrote:
hi,
I have a little problem with the following part of my code.
I use post method to get the password from the form [$first ].
Because there is an encrypted password in mysql database, I check with
$pass = mysql_query("Select password('$unencryptedPass')");
while($row = mysql_fetch_array($unencryptedPass))
{

$encryptedPassw = $row[0];
}
how the encrypted password looks like.
Then I make a simple query:
mysql_query("Select login, password from edv_verantwortliche where
login = '$login' AND password = '$encryptedPassw'") or
die("authorization failed");
But it doesn' t seem to work. I could login every time.

I have checked all values with echo method - they are correct...
Could somebody help me, please.


You will only die if mysql encounters an error. Not finding any rows is not
an error. Also, you can do it all in one SELECT.

try:

$rs = mysql_query("select login,password from edv_verantwortliche where
login=$login and password=password('$unencryptedPass')") or die('mysql
error: ',mysql_error());
if (mysql_numrows($rs)==0)
{
echo 'Authorization Failed.';
exit();
}
// authorization OK
}

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

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

Similar topics

3
by: Richard M | last post by:
Can anyone please lend me a hand, I'm trying to design a cookie based password system. I have managed to do everything bar one thing that is driving me crazy. I have a MYSQL database called...
7
by: Hank Reed | last post by:
I am trying to use the spell checker on an unbound control in Access 2000. I run the checker in the AfterUpdate event of the control. After the spell checker is done, I get the following message:...
8
by: Joe | last post by:
Hello All: Does anyone know of a spell checker that works with .NET? Any options will be welcome. TIA, -- Joe
13
by: kolmogolov | last post by:
/* Hi, I have removed things irrelevant to reproducing the problem. What's wrong with my code? Thanks in advance for any hint! 1166425362 */ #include <stdio.h> #include <stdlib.h> #include...
4
by: sweetguy1only | last post by:
Hi all, I am a MS Access developer using VB 6 (yes, I know it is a bit old). The problem I am having is, I have a software that allows my customers to put in the information of their clients....
6
by: Neil | last post by:
Is there way to have control over the MS-Access spell checking (besides just launching it)? We want to tell it to check all records, but skip certain fields (or, alternatively, ONLY check certain...
2
by: slider | last post by:
Hey all, this is something really easy and i just cant seem to make it work. All i need is an IF then else statement that will make sure that a password is greater than six characters. Im using VB...
9
by: ARC | last post by:
Hello all, I developed a tool a year or so ago for adding your own spell-checker to an access application. This is mainly for those using the runtime, as you can't distribute the spell-checker...
7
by: Philth | last post by:
Hi folks, Can anyone spot any problems with this? It's not returning any errors. <?php // login2.php include("connect_courses.php");
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.