pastebin
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
pastebin
Follow @pastebin
create new paste
trending pastes
sign up
login
my settings
my profile
My Pastes
Public Pastes
Untitled
1 sec ago
Untitled
4 sec ago
Untitled
8 sec ago
~@watcH San Jose Sharks...
28 sec ago
Untitled
11 sec ago
Untitled
13 sec ago
Untitled
19 sec ago
Untitled
18 sec ago
Layout Width
Share Pastebin
Untitled
By: a guest | Nov 7th, 2009 | Syntax:
PHP
| Size: 0.93 KB | Hits: 65 | Expires: Never
Download
|
Raw
|
Embed
|
Report abuse
This paste has a previous version,
view the difference
.
<?php
/**
* @préambule : http://www.pcinpact.com/actu/news/51801-hadopi-wikipedia-olivier-henrard.htm
*
*/
function
refuse
(
$forbidden
,
$redirect
,
$email
)
{
$host
=
gethostbyaddr
(
$_SERVER
[
'REMOTE_ADDR'
]
)
;
if
(
substr
(
$host
,
-
1
*
strlen
(
$forbidden
)
)
==
$forbidden
)
{
header
(
"Status: 301"
)
;
header
(
'Location: http://'
.
$_SERVER
[
'SERVER_NAME'
]
.
$redirect
)
;
mail
(
$email
,
"[
{$_SERVER['SERVER_NAME']}
][refus de
$forbidden
]"
,
$host
.
"
\n
\n
"
.
print_r
(
$_SERVER
,
true
)
)
;
exit
;
}
}
/**
* Fonction présente sur toutes les pages de http://www.jaimelesartistes.info :
*/
refuse
(
'.culture.fr'
,
'/block.php'
,
'christine@jaimelesartistes.info'
)
;
/**
* résultat : tout visiteur en provenance de la Rue de Valois n'a droit qu'à http://www.jaimelesartistes.info/block.php
*
* c'est un peu puéril - mais qu'est ce que ça peut me faire rire
*
* -et ça marche : déjà deux alertes reçues dans la boîte mail-
*
*/
?>
create new paste
|
create new version of this paste
RAW Paste Data