Baller Blockin’ with Cookies
May 30, 2006
So, I modified the code from the last post to help defend against IP spoofing, dynamic IPs, and proxies.
New code:
<?php
$badIPs = array(“1.2.3.4″, “2.3.4.5″, “3.4.5.6″); // Bad IP list
foreach($badIPs as $badMonkey) {
if(($_SERVER['REMOTE_ADDR'] == $badMonkey) || ($_COOKIE['badMonkey'])) { // Bad monkey! No website for you!
setcookie(“badMonkey”, ‘blockMe’, time()+2592000, ‘/’);
header(“Location: http://tubgirl.com”); // Send them to this site.
}
}
?>
Now, if your IP is in the block list, it sets a cookie which lasts a month ( the time()+2592000 statement (2592000 = 60sec * 60mins * 24hrs * 30days) ), and then checks for the cookie. This way, if they then re-set their net connection and get a new IP, pop into a proxy or spoof their IP, etc. it will still block them. If after a month, their IP is no longer in the block list, then the cookie is unset and they are allowed back into the site.
Until they clear their cookies and try one of the workarounds, that is.
Baller Blockin’
May 30, 2006
No, this has nothing to do with that amazing cinematic masterpiece by Cash Money, but instead about blocking website access.
A friend of mine just ICQ’d me, asking if there was an easy way to redirect unwanted IPs from reading her blog to a bit more of a visually caustic website (like the now-defunct goatse.cx).
I replied with this:
<?php
$badIPs = array(“1.2.3.4″, “2.3.4.5″, “3.4.5.6″); // List of bad IP addresses.
foreach($badIPs as $badMonkey) {
if($_SERVER['REMOTE_ADDR'] == $badMonkey) { // Bad monkey! No website for you!
header(“Location: http://tubgirl.com”); // Redirect them to this site.
}
}
?>
It’s pretty simple, you just have to make sure that you do the following:
0) Server/site/blog/page/etc. that runs PHP.
1) Pick out a suitable offensive site (Like TubGirl, for example).
2) Open the file that has the <html> and <head> tags. (assuming it’s a .php, .inc, .tpl, etc file)
3) Paste the code before the <html> tag.
4) Replace sample IPs with real ones and replace the site where you want to send them to.
That’s it! You can have an unlimited number of IPs to block. Since this isn’t JavaScript and takes place at the server level, it’s can’t really be circumvented by disabling JavaScript on the browser. The only real way around this is to hop on another IP address/connection, spoof the one you’re on, go through a proxy, use coral cache, or other similar methods. Really when it comes down to it, if someone _really_ wants to read those public entries, they can. This’ll just piss ‘em off. ;)
Now, who actually clicked on the Tubgirl link? Let’s see a show of hands.
Always a Bridesmaid …
May 26, 2006
Well, I’m off in an hour or two to Florida this weekend for my cousin’s wedding.
Hopefully I’ll be back in time on Sunday to catch the end of an amazing Giro, and to collect my $20 from Sonny that Basso will have won me.
And with that $20, I’m going to turn right back around and bet it on Basso for the overall winner of the Tour de France.
Happy Towel Day!
May 25, 2006
Lara is right. I really shouldn’t have any friends.
*Disclaimer*: I don’t actually name my towels. I just did that to point out that I was indeed sporting one this morning, in public.
May 25th: Towel Day
May 24, 2006
Tomorrow is Towel Day. It is a day that us geeks celebrate Douglas Adams and further label ourselves as “easy targets” by carrying our towels in rememberance.
Why a towel? Well, let’s refer to the Hitchhikers Guide to the Galaxy for that answer:
A towel, it says, is about the most massively useful thing an interstellar hitch hiker can have. Partly it has great practical value – you can wrap it around you for warmth as you bound across the cold moons of Jaglan Beta; you can lie on it on the brilliant marble-sanded beaches of Santraginus V, inhaling the heady sea vapours; you can sleep under it beneath the stars which shine so redly on the desert world of Kakrafoon; use it to sail a mini raft down the slow heavy river Moth; wet it for use in hand-to-hand-combat; wrap it round your head to ward off noxious fumes or to avoid the gaze of the Ravenous Bugblatter Beast of Traal (a mindboggingly stupid animal, it assumes that if you can’t see it, it can’t see you – daft as a bush, but very ravenous); you can wave your towel in emergencies as a distress signal, and of course dry yourself off with it if it still seems to be clean enough.
More importantly, a towel has immense psychological value. For some reason, if a strag (strag: non-hitch hiker) discovers that a hitch hiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, face flannel, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet weather gear, space suit etc., etc. Furthermore, the strag will then happily lend the hitch hiker any of these or a dozen other items that the hitch hiker might accidentally have “lost”. What the strag will think is that any man who can hitch the length and breadth of the galaxy, rough it, slum it, struggle against terrible odds, win through, and still knows where his towel is is clearly a man to be reckoned with.
Tak! Tak en Lah!
May 23, 2006
In two hours, Stephen King’s Desperation airs on ABC.
Ron Perlman is Collie Entragian. Most of you don’t care. I do.
cantwait.cantwait.cantwait.
Austin and back, again
May 23, 2006
I just spent the past four days in Austin, TX with Dana. We drove up Friday morning in a 2 car caravan with my friend Joe, his half-sister Maya, and her adorable daughter Mimi who were also happening to go to Austin.
I’ll try at a later point to give a better re-cap, but in case I don’t, here is the quick version in non-chronological order: I got to see friends, eat (cold) PizzaNight™ pizza, camp, drink delicious homemade beer and wine, got a high-five from a dog, play pool at a Johnny Cash tribute bar, and Release the Bats™.
Oh, and Andre and Leigh got married.
I didn’t think that it was customary to give gifts to your guests, but I want to thank you two for those, again. And more than that, I want to thank you for an absolutely wonderful long weekend / mini-vacation. And I miss all you Austin guys (and your dogs) already. Not that we really need a reason, but I hope that we can all get together again soon.
On that whole Net Neutrality thing…
May 11, 2006
So, a co-worker asked me today to explain this new crap that is anti-net neutality. There’s been plenty of talk about it, and chancers are good that you have heard some of it.
For those of you that are in the dark, I’m not going to explain it so just click that above link, or just watch the damn video bleow. Preferably both. Those familiar with the scenario should also watch the video. Basically, if you have eyes, ears, understand English, love ninjas, hate pirates, have broadband access and a multimedia-capable computer, or are just breathing, you should watch this. Just skip the first 14 seconds (the annoying intro).
Blind leading the blind.
May 9, 2006
So where do we go
When everyone knows that we’re nowhere?
And we’re not even nowhere,
They say you can get there from here.
– Firewater, Too Many Angels
So, in preparing for Andre and Leigh’s wedding next weekend, I decide to GoogleMap my trip. The results are, well, a bit stupid (applicable stupid area). Why in the flying fuck would I want to drive up to Austin and then down to Kyle, TX when I can just continue on I-10 and the go north to Kyle? So I can drive a longer distance at a slower speed on TX71? It can be much simpler/faster!
This brings me to a feature request (and I’ll make it when I find the proper place to do so) of GoogleMaps. When you pull up the main maps page, you can enter a single address like: 900 Scott Street Kyle, Texas 78640, or you can enter two for directions: New Orleans, LA to 900 Scott Street Kyle, Texas 78640. The key operator / delimiter here is the to. I’m asking for an extension of the first, or a second, new, delimiter.
Either accomplish the same thing, allowing the user to specify “hops”, or intermediate points between the start and the end. The new delimiter, via, would allow me to re-route my path through Luling, TX instead of Austin, Tx. Example: New Orleans, LA to Kyle, TX via Luling, TX. Similarly, the “multiple to” extension would look like this: New Orleans, LA to Luling, TX to Kyle, TX. Both would tell GoogleMaps to route me first to Luling, TX using whatever mapping logic they use, then proceeding to Kyle, TX. There could be a theoretical limit to the number of hops, but I guess there really is no point to that.
Maybe via would best be used as a road/street/highway/etc definition. So I could enter New Orleans, LA to Luling, TX to Kyle, TX via I-10. I think I like this use of via better. Maybe at this point it could be reduced to New Orleans, LA to Kyle, TX via I-10, if the mapping logic used I-10 as a preference to TX71. And no, I’m not going to go back and re-edit the above.
Ok, now that I have figured out which way I want to go, it’s time for me to find a feature request / bug submission area for Google.