Page 1 of 1

Limit Number of Login Attempts

Posted: Thu Oct 21, 2004 12:28 am
by C++Casey
Hi how would I limit the number of login attempts to a member area to 5.

I have a database field name "Credits" that tracks the number of login attempts. Ideally, I want it so that each time a user logs in the "Credits" field is incremented by 1.

In the inital login page to I need to have a hidden field to hold the value of the "Credits". If so can you give me sample of what it would look like.

Next on the page that the form calls I have the below code. The alogrithm is as such....

select credits from customer table where userid = the value of the userid of the person that just logged in. if credits > 5 then restrict user from access else increment the credits field in the customer table by 1. below is my code

Code: Select all

<?php
$query = "SELECT Credits FROM Customer Where UserID = $userid";
$resultsc = mysql_query($query);
$credits=$resultsc + 1;

if($credits=="") {
echo '(No Credits found.)';
}
elseif($credits > 5){
	echo "Your number of credits have exceeded the amount allowed";
}
else {
mysql_close();
}
?>
Obviously this isn't working like I stated in my alogrithm...any help or feedback would be appreciated! Thanks

Posted: Thu Oct 21, 2004 12:37 am
by feyd
you need a [php_man]mysql_fetch_assoc()[/php_man] or a sibling call to get the number.