cardoso Posted August 30, 2006 Share Posted August 30, 2006 Hi All, I have a community site that I've created as a hobby.... over the past month os so, there's been this guy/girl who has made it their mission to enter loads of crap on my site. At first it was only 2 or 3 a day... yesterday it was 160.So I implimented one of those "captcha" thing to make it harder... that only helped for a few hours. Then I started filtering the content in my sql statement... that's getting to be more work then it's worth... he/she has far too many words for me to keep up. Now I decided to capture and write to the DB the user's info based on ip... so I get the following:$ip = $_SERVER['REMOTE_ADDR'];$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);$referrer_page = $_SERVER['HTTP_REFERER'];$requested_page = $_SERVER['REQUEST_URI'];$AllUserInfo = "----IP:".$ip."----HOSTNAME:".$hostname."----REFERRER PAGE:".$referrer_page."----REQUESTED PAGE:".$requested_page;But that did not work... I get a NULL value... he's somehow blocking that information.Can someone help? This is a free site I've created out of the love for my community and this person is making it so hard for me to want to continue.Thanks for any help you might throw my way.Nelson Cardoso Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/ Share on other sites More sharing options...
ToonMariner Posted August 30, 2006 Share Posted August 30, 2006 You could only allow posts where $_SERVER['REMOTE_ADDR'] is available - that way you could back trace.Even if they spoof an ip address you will get another measure of how they are circumventing your system - and then prevent that. Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82793 Share on other sites More sharing options...
cardoso Posted August 30, 2006 Author Share Posted August 30, 2006 Good call!!! I've already implimented your idea. I'm a bit of a newbie with sql so I hadn't thought of that.Thank you soooooooooo much.Nelson Cardoso Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82852 Share on other sites More sharing options...
wildteen88 Posted August 30, 2006 Share Posted August 30, 2006 Did yu create the forum yourself, if you did then it sounds like you have an exploit in your code which the hacker is using to spam your forum. Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82859 Share on other sites More sharing options...
cardoso Posted August 30, 2006 Author Share Posted August 30, 2006 Hi wildteen88... any gotcha's that I should look out for? Any "recommends" for solutions?Thanks for replying to my emailNelson Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82867 Share on other sites More sharing options...
cardoso Posted August 30, 2006 Author Share Posted August 30, 2006 ToonMariner, not sure if you're still following this thread... can you help with one more thing (or anyone else)?I added what another snippet to my if statement before my insert code:if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "malta_add") && ($_SERVER['REMOTE_ADDR'] != "")) {.......I added the: && ($_SERVER['REMOTE_ADDR'] != "")This was to try to avoid the hacker from even submitting if the ip was empty. But it didn't work because he was able to submit... and when I look at the database, no value was captured in my "user ip" field. Have I written this wrong? Shouldn't that addition have stopped a post if there was no value for $_SERVER['REMOTE_ADDR'?Thanks a million!!Nelson Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82884 Share on other sites More sharing options...
HuggieBear Posted August 30, 2006 Share Posted August 30, 2006 [quote]I added what another snippet to my if statement before my insert code:if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "malta_add") && ($_SERVER['REMOTE_ADDR'] != "")) {.......Have I written this wrong? Shouldn't that addition have stopped a post if there was no value for $_SERVER['REMOTE_ADDR'][/quote]You could try this:[code]if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "malta_add") && (!$_SERVER['REMOTE_ADDR'])) {.......[/code]I think this should work if $_SERVER['REMOTE_ADDR'] is empty.Rich Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82920 Share on other sites More sharing options...
cardoso Posted August 30, 2006 Author Share Posted August 30, 2006 Wow!!! This forum is fantastic!!! You people have been a great help....HuggieBear... the only change I made was "I took out the '!'"... because I want them to submit if there is an ip address.You got me 99% over that hurdle (I have to do some thinking for myself)... thanks so much!Take care.Nelson Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82954 Share on other sites More sharing options...
tomfmason Posted August 30, 2006 Share Posted August 30, 2006 [quote author=ToonMariner link=topic=106238.msg424647#msg424647 date=1156944767]Even if they spoof an ip address you will get another measure of how they are circumventing your system - and then prevent that.[/quote]I agree. here is a very good article that describes various methods of [url=http://www.developerfusion.co.uk/show/4656/]insertion[/url] and how to prevent them. Here is one that is just good [url=http://www.developerfusion.co.uk/show/5381/]general reading[/url]. I found these to be very infomative and think that they should be standard reading for all. The most improtant thing is to sanitize the user imputed data. Use something like [url=http://us3.php.net/manual/en/function.mysql-real-escape-string.php]mysql_real_escape_string[/url] and maybe [url=http://us3.php.net/manual/en/function.preg-match.php]preg_match[/url], to pervent unwanted caricatrues. The reason that the ip field is empty is most likely that they are bypassing that field. What I would do is have a time stamp that for each post(You may already have that). I would then create a table (called something like `hits`)and a script that would record the ip of every person that enters my site along with the referrer and timestamp.Then when the unwanted posts are placed then you could search the `hits` table by the timestamp in the post. And there we go. You should now have the ip of the person that is posting these posts.They may also be posting from out side your site. So another thing that I would do is do something like this[code=php:0]if (!$_SERVER['HTTP_REFERER'] !== 'http://yoursite.com/the_posting_page.php') header("HTTP/1.1 404 Not Found");}[/code]Or maybe a acess denied error. I would stick with the the 404.Good luck,Tom Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82957 Share on other sites More sharing options...
HuggieBear Posted August 30, 2006 Share Posted August 30, 2006 [quote]HuggieBear... the only change I made was "I took out the '!'"... because I want them to submit if there is an ip address.You got me 99% over that hurdle (I have to do some thinking for myself)... thanks so much![/quote]Sorry about the '!' I misread the code... :oGlad you picked up on it though :) Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82963 Share on other sites More sharing options...
.josh Posted August 30, 2006 Share Posted August 30, 2006 also, just to clear up that you bug isn't actually somewhere else, is this person's the ONLY person that your db is not getting their ip address? In other words, is your db storing other people's ip addresses just fine? Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82970 Share on other sites More sharing options...
tomfmason Posted August 30, 2006 Share Posted August 30, 2006 Another thing that I would do is put size limits on all of my text fields , something like 20, and maybe pass all of the fields that are going to be placed in database through [url=http://us3.php.net/manual/en/function.htmlentities.php]htmlentities[/url] Quote Link to comment https://forums.phpfreaks.com/topic/19140-how-do-i-fight-this-forum-hacker-how-to-get-his-ip-info/#findComment-82973 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.