Almost there. Let me walk through things.
The username and password are brought in from the form and the admins are checked, then the members are checked. If not found anywhere, then go to this section. Prints out your ip address, checks the admins again and adds a new attempt to login. Somehow the update is not happening and I have checked the syntax and it looks right, even tried a couple tricks I've learned here, but no go.
Thanks for the help, you guys have been invaluable in the project!
echo "Wrong Username or Password";
echo '<br />';
$ip=$_SERVER['REMOTE_ADDR'];
echo 'Your IP Address has been logged! ';
echo $ip;
$sql="SELECT attempts FROM $admin_table WHERE username='$myusername'";
$result=mysql_query($sql);
echo $sql;
echo '<br />';
echo 'result:';
echo $result;
echo '<br />';
$count=mysql_num_rows($result);
echo "count";
echo $count;
echo '<br />';
if ($count==1){
$row = mysql_fetch_array($result);
$attempts=$row['attempts'];
echo 'attempts';
echo $attempts;
$attempts++;
echo 'attempts';
echo $attempts;
$addattempt="UPDATE $admin_table SET attempts = '". $attempts. "' WHERE username= '$myusername' ";
echo '<br />';
echo $addattempt;
if ($attempts==5){
echo '<meta http-equiv="refresh" content="2;url=banned.html">';
}
}
else {
if (!$_SESSION){
$_SESSION['attempts'];
}
$_SESSION['attempts']++;
}
echo print_r($_SESSION);
if ($attempts==5){
echo '<meta http-equiv="refresh" content="2;url=banned.html">';
}
else{
$_SESSION['attempts']++;
//echo '<meta http-equiv="refresh" content="2;url=index.php">';
}
}
}
The rest of it- if it can't find you in the admin table, then it uses a $_SESSION variable incremented every time through and if it's equal to 5 then you go to the ban page. I also check on the form page, so if you have 5 attempts, you automatically go to the banned page.
After it's working, if anyone has thoughts on how to do this better, I'm here to learn.
Thanks!