0

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')");
}

?>
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Akay2
1

Please restate the key issue. This statement says the same thing twice:
" If the IP isn't existing, the system will add the IP but if the IP doesn't exist he also adds the IP."

0

Sorry i write it wrong i mean:
If the IP isn't existing, the system will add the IP but if the IP does exist he also adds the IP

1

Check the manual for mysql_query. It returns a resource it doesn't return a field.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.