PDA

View Full Version : IP Spam Stop thing



Moh
23-09-2007, 05:57 PM
Does any 1 know a code where once an IP has entered a form it logs there ip so it wont let them use the form again?
iv looked around but couldnt find any :(
If you know, could you send link pls.
+Rep


Thread moved to ' Website Designing & Development ' by Yoshimitsui (Super Moderator).

Lilian
23-09-2007, 06:11 PM
You need alot of things lately don't you :P Can't you just store submitted IPs into a file?

Flisker
23-09-2007, 06:16 PM
Then it could be easily found and people could get hacked

You need alot of things lately don't you :) Can't you just store submitted IPs into a file?

Eccentric
23-09-2007, 06:20 PM
put it into a mysql db then query if ip = 0 display form ;)

Moh
23-09-2007, 06:46 PM
right, iv got it so it adds the ip 2 the database, now i need it so:
if ip is in database it says you cant use it
but if ip isnt it displays a form.

can any 1 provide me with a script pls <3

Eccentric
23-09-2007, 06:54 PM
well you would query like


Mysql_query()
fetch it lol
if ($query=1){
echo("You have taken part in the form");
}
if ($query=0){
echo("FORM");
}

Moh
23-09-2007, 06:58 PM
well you would query like


Mysql_query()
fetch it lol
if ($query=1){
echo("You have taken part in the form");
}
if ($query=0){
echo("FORM");
}
im not very good with querys :(

Tomm
23-09-2007, 07:01 PM
im not very good with querys :(


$ip = $_SERVER['REMOTE_ADDR'];
$query = "SELECT * FROM `loggedips ` WHERE `ip`='" . $ip . "';";
$res = mysql_query($query);
$num = mysql_num_rows($res);

if($num > 0) {
//don't display form
} else {
//display the form
}Edit the query as appropriate.

Eccentric
23-09-2007, 07:40 PM
$ip = $_SERVER['REMOTE_ADDR'];
$query = "SELECT * FROM `loggedips ` WHERE `ip`='" . $ip . "';";
$res = mysql_query($query);
$num = mysql_num_rows($res);

if($num > 0) {
//don't display form
} else {
//display the form
}Edit the query as appropriate.
Thanks for touching up on that as i'm not too good on php havnt revised on it for a while ;)

Want to hide these adverts? Register an account for free!