Increment
Posted: Sat Oct 13, 2007 9:25 am
Maybe I'm just being silly, but the more I've been working on this, the more I mess it up, and now it doesn't even echo counter so I can't see tell where the problem is anymore... HELP!!!
If tried to add a condition to a web page that counts how many times someone tries to log in. I want the value of counter to go up only when I reload the page. When I set the value of $counter to 0, it comes back with 0. If I have it go through a different page it comes back as one, but that would mean going through a different page each time.
I'm so confused with it all
Can someone please tell me where I'm going wrong?
If tried to add a condition to a web page that counts how many times someone tries to log in. I want the value of counter to go up only when I reload the page. When I set the value of $counter to 0, it comes back with 0. If I have it go through a different page it comes back as one, but that would mean going through a different page each time.
I'm so confused with it all
Code: Select all
<?php
$counter = $counter++;
echo $counter;
if ($counter == 0) {
echo $form;}
elseif (($counter > 0) && ($counter < 5)) {
echo "<p>Sorry but that username and password combination is not valid. Please try again.</p>";
echo $form;}
else {
echo "<p>Sorry, you have exceeded the allocated number of attempts for authorisation. Please contact the <a href=\"admin.php\">administrator</a>.</p>";
}
?>