crypt

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Locked
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

crypt

Post by ol4pr0 »

Have been looking around on the internet and found some, however i just cant get this to work..

the password has been send to the db like this

Code: Select all

$encrypted_password = crypt($_REQUEST['password']);
this i am trying to use to login... and many other ways.. however no luck

Code: Select all

#with form <input type=text name=username> and <input type=password name=password>
$encrypted_password ='SELECT password FROM users WHERE login=?',array($_REQUEST['username']));
if (crypt($_REQUEST['password'],$encrypted_password)==$encrypted_password);
{
	setcookie ("USERNAME", $_POST['username']);
	setcookie ("PASSWORD", $_POST['password']); 
	echo 'logged in';
} else {
	echo 'ERROR:';
}
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

well, look closely at this line :

Code: Select all

$encrypted_password ='SELECT password FROM users WHERE login=?',array($_REQUEST['username']));
what do you see wrong with it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

wouldn't he also need to actually execute the query to get the stored password before using said password?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

that was kinda what i was hinting at ;)
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

We seem to have gone full circle back to here again :o
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Locking thread. Old4pro, view your page in mark's link he just gave.
Last edited by infolock on Sun Jun 20, 2004 3:09 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

heh, I forgot about that thread.. :)
Locked