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!
Hi I have some code that limits the user to a certain number of logins. Each time a user logs in it records a "credit" to the database. Once the total credits reach 5 then the user no longer has access to the member area. My code does everything except limit the user to the 5 login attempts. Can someone help me write the code that will limt the user to the 5 login attempts. Here is my code.
<?
$updateSQL = mysql_query("SELECT credits FROM USERS WHERE username='$loginUsername'");
if ($updateSQL >5) {
echo "Number of credits have exceeded 5";
}
else {
$addCredit= "UPDATE USERS SET credits=credits+1 WHERE username='$loginUsername'";
}
mysql_select_db($database_Users, $Users);
$Result1 = mysql_query($addCredit, $Users) or die(mysql_error());
?>
if the die statement is inside the IF then the script will only stop if the condition is met (more than five hits), if the user has less than 5 hits then the browser will skip the IF.