I need some help. I want to make a secure loginsystem and here is my script for the system that checks how many times you tried to login ($try). db.php is the script for connecting with my database. The system isn't in connecton with the loginsystem it is only the part where it checks how many have times you tired to login. If the IP isn't existing, the system will add the IP but if the IP doesn't exist he also adds the IP. Then I have the IP twice in my database. Please help me.
<?php
include("db.php"); /*connect with mysql*/
$try = 1 ; /*number of tries you had (it will be updatet if you tries the second time)*/
$ip = $_SERVER[REMOTE_ADDR]; //your IP
$ipz = mysql_query("select IP from IPs where IP = '$ip'"); /*check if your ip is in my database*/
if($ipz == $ip) {
mysql_query("update IPs set tries = '$try' where IP = '$ip'");
}
else {
mysql_query("insert into IPs values('$_SERVER[REMOTE_ADDR]', '$try')");
}
?>