News:

So the widespread use of emojis these days kinda makes forum smileys pointless, yeah?

Main Menu

[PHP]blocking ip address from viewing site

Started by deadly7, August 05, 2005, 09:33:18 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Sidoh


deadly7

Oh, I should add something...

echo '<meta http-equiv="refresh" content="0; URL=www.google.com" />';

If you're using that, add http:// before the website (www.google.com) or else it will redirect to www.mysite.com/folder/www.google.com
[17:42:21.609] <Ergot> Kutsuju you're girlfrieds pussy must be a 403 error for you
[17:42:25.585] <Ergot> FORBIDDEN

on IRC playing T&T++
<iago> He is unarmed
<Hitmen> he has no arms?!

on AIM with a drunk mythix:
(00:50:05) Mythix: Deadly
(00:50:11) Mythix: I'm going to fuck that red dot out of your head.
(00:50:15) Mythix: with my nine

Sidoh

Well, yeah. That was um... shorthand HTML. *looks around nervously*

Warrior

The reason the header didn't work: If you're going to do something like that you need to make sure it's one of the first things done, else the page will already have sent it's header information out thus producing that error.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

deadly7

war, so I should've put that before <head>?
[17:42:21.609] <Ergot> Kutsuju you're girlfrieds pussy must be a 403 error for you
[17:42:25.585] <Ergot> FORBIDDEN

on IRC playing T&T++
<iago> He is unarmed
<Hitmen> he has no arms?!

on AIM with a drunk mythix:
(00:50:05) Mythix: Deadly
(00:50:11) Mythix: I'm going to fuck that red dot out of your head.
(00:50:15) Mythix: with my nine

Mythix

No.



<head>
<meta http-equiv="refresh" content="5; url=refresh1.html">

<title> chapter 17 multimedia </title>

</head>



works just as well.
Philosophy, n. A route of many roads leading from nowhere to nothing.

- Ambrose Bierce


Sidoh

Quote from: Anti-Newby on August 06, 2005, 11:44:42 PM
The reason the header didn't work: If you're going to do something like that you need to make sure it's one of the first things done, else the page will already have sent it's header information out thus producing that error.

It always works unless you've done anything with sessions or cookies (I'm sure there are other similar causes of the error, but these are the two main cuprates I've found).

And no, deadly7. He's saying it's the first routine that should be executed within PHP.

By tradition, meta tags are within the head tags, but it doesn't matter (I think W3C might care, but all browsers I use don't).

Warrior

First or near first, from what I've noticed.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Sidoh

Quote from: Anti-Newby on August 07, 2005, 10:32:01 AM
First or near first, from what I've noticed.

Anything that is before a session or cookie declaration is my belief.

Warrior

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

venox

Rather than looping through the array.  Which, works just fine.  Using in_array() would be a bit faster.



if (in_array($ip, $iparray)) {
    die('You are banned!');
}


Sidoh

Haha, yeah.  I just remembered that function a few days ago when I was doing something with arrays.

Good to see ya venox! :)

venox

Quote from: Sidoh on August 23, 2005, 07:44:36 PM
Haha, yeah.  I just remembered that function a few days ago when I was doing something with arrays.

Good to see ya venox! :)

Likewise :)

zorm

Note that given things like HTTP_X_FORWARDED_FOR are headers sent by the client they can be forged and as such checking only them is likely a bad idea. One should really be checking all possible ips and not just the first found one.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Sidoh

Quote from: zorm on August 23, 2005, 10:46:29 PM
Note that given things like HTTP_X_FORWARDED_FOR are headers sent by the client they can be forged and as such checking only them is likely a bad idea. One should really be checking all possible ips and not just the first found one.

Blame the guy on php.net!  :)