php question
- Started
- Last post
- 23 Responses
- bolus
i've got this nice little guestbook on my website, but i'm getting more and more spam from russia lately. not a great programmer, can anyone point me in the right direction when I wanne block some ip addresses?
thanks
- determinedmoth0
Quite easy.
Post the code.
- UndoUndo0
you can capture the users ip with
$HTTP_SERVER_VARS["REMOTE_ADDR...
record it , and check for the ip address when the user returns. if their ip matches yr list of bad ones redirect them or dont allow them to post
- bolus0
thanks, i got as far as registering the ip's but can't find a way to block em (as i said, i'm not a hero in php, or anything else for that matter)
- paraselene0
you're an ace with a camera, though, bolus!
- bolus0
thanks para :)
anybody gonna help me?
- cosmo0
do you know the ip address that you want banned? if you post them here.
- cosmo0
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR...
if ($ip == "the ip to be banned goes here")
{
echo "Banzored!";
}
else
{
echo "This is not spam.";
} // end if
- bolus0
thanks cosmo, but i can't get it to work, keeps saying "this is not spam" when i block my own ip address :( ??
- cosmo0
echo $ip = $HTTP_SERVER_VARS["R EMOTE_ADDR"];
add that line and see if your ip address matches.
- bolus0
yes, the ip which is supposed to make it say banned, tells me "no spam"
- bolus0
maybe i'm doing something wrong, would you mind changing this file and sendig it to me?
http://www.janpostma.com/gastenb…
(this is the old version)
- cosmo0
sure.
- cosmo0
you've got mail bolus.
- bolus0
thank you cosmo, you're a hero :) it works
- urban100
why not just use htaccess... in the public_html directory of your server there may be an .htaccess file already (if not create it).
then paste the following, using the ip you want to block:
order allow,deny
deny from 127.0.0.1
allow from all
- bolus0
who the f*ck is posting iframes containting NT in my guestbook??
- paraselene0
weird! i just went there to look at your guestbook to see what you were talking about and an iframe with my profile info popped up there! scary. i reckon it was unintentional whoever did it. look again and see if there are two. if there are, then the second one is me, sorry!
- bolus0
just removed them :), still weird
- UndoUndo0
did you get it sorted bolus? I saw cosmo came into the thread b4 I went home yesterday and thought he would sort it for you