Page 1 of 1

user authentification using mysql

Posted: Mon Jul 15, 2002 6:07 pm
by ludal
Hi

Well i have a little problem concerning the result of athentfication ...
In fact i enter a login & password in textfield (everything s normal here :)
and the result of my request goes wrong each time it called login.inc ->

Code: Select all

<?
	include("db.inc");
	$db = new database;
	$db->Dbinit();
	$db->DbConnect();
	$db->Log();
	
	session_start();

	if ($REQUEST_METHOD == "POST")
	 &#123;
		if (isset($inp_login))
		&#123;
			$data = $db->check_user($inp_login, $inp_password);

			if (count($data) == 0) 
				&#123;
				echo "ok you' re a vip ...";
				&#125;
				else if  (count($data) == 1)
					&#123;
					echo "try again later ...";
					&#125;
			&#125;
		&#125;

?>
i ve made a class called db.inc which contains every actions on my base , including the check_user() function above ...

Could you help me ...

Posted: Tue Jul 16, 2002 8:09 am
by enygma
you dont really say what the error you're getting is.
That would help a lot....

re

Posted: Tue Jul 16, 2002 10:06 am
by ludal
hi,
actually the error is that the request' result sends always "try again later ...",
that 's my problem ,

sql request

Posted: Tue Jul 16, 2002 10:09 am
by ludal
Moreover , my sql request stored in db.inc is a function called check_user()
like that:

Code: Select all

function check_user($login, $password) &#123;
	   return $this->DbSelect("select * from clients where login = '$inp_login' AND password = '$inp_password'");
	 &#125;

Posted: Tue Jul 16, 2002 10:39 am
by enygma
so you're just returning the database handler, and not an actual result?
that's kinda odd.....you might want to do some matching against the username and password against what they entered...