Advertisement
Guest User

Untitled

a guest
Aug 5th, 2009
2,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * @préambule : http://www.pcinpact.com/actu/news/51801-hadopi-wikipedia-olivier-henrard.htm
  5.  *
  6.  */
  7. function refuse($forbidden, $redirect, $email) {
  8.     $host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  9.     if(substr($host, -1 * strlen($forbidden)) == $forbidden){
  10.         header("Status: 301");
  11.         header('Location: http://'.$_SERVER['SERVER_NAME'] . $redirect);       
  12.         mail($email,"[{$_SERVER['SERVER_NAME']}][refus de $forbidden]",$host."\n\n".print_r($_SERVER, true));
  13.         exit;
  14.     }
  15.    
  16. }
  17.  
  18. /**
  19.  * Fonction présente sur toutes les pages de http://www.jaimelesartistes.info :
  20.  */
  21. refuse('.culture.fr', '/block.php', 'christine@jaimelesartistes.info');
  22.  
  23. /**
  24.  * résultat : tout visiteur en provenance de la Rue de Valois n'a droit qu'à http://www.jaimelesartistes.info/block.php
  25.  *
  26.  *  c'est un peu puéril - mais qu'est ce que ça peut me faire rire
  27.  *
  28.  *  -et ça marche : déjà deux alertes reçues dans la boîte mail-
  29.  *
  30.  */
  31.  
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement