user authentification using mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ludal
Forum Newbie
Posts: 4
Joined: Mon Jul 15, 2002 6:07 pm

user authentification using mysql

Post 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 ...
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post by enygma »

you dont really say what the error you're getting is.
That would help a lot....
ludal
Forum Newbie
Posts: 4
Joined: Mon Jul 15, 2002 6:07 pm

re

Post by ludal »

hi,
actually the error is that the request' result sends always "try again later ...",
that 's my problem ,
ludal
Forum Newbie
Posts: 4
Joined: Mon Jul 15, 2002 6:07 pm

sql request

Post 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;
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post 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...
Post Reply