Bannir IP d'un site

Fermé
Yassinedu74 Messages postés 1 Date d'inscription vendredi 16 mars 2012 Statut Membre Dernière intervention 16 mars 2012 - Modifié par Chris 94 le 16/03/2012 à 18:19
Fallentree Messages postés 2309 Date d'inscription mercredi 25 février 2009 Statut Membre Dernière intervention 22 juillet 2019 - 16 mars 2012 à 16:08
Bonjour, je voulait vous demander si ont pouver créer un srcipt pour bannir un ip d'un site si oui comment faire merci à celuit qui me repondras.



3 réponses

Fallentree Messages postés 2309 Date d'inscription mercredi 25 février 2009 Statut Membre Dernière intervention 22 juillet 2019 208
Modifié par Fallentree le 16/03/2012 à 16:04
Attention chez certain hebergeur les IP ne sont pas fixes...
En php, y a une variable $_SERVER['REMOTE_ADDR'];
tu fais
<?php    
$Paslui="167.192.1.11";
if ($_SERVER['REMOTE_ADDR']!=$Paslui) { $header="https://forums.commentcamarche.net/forum/affich-24723344-bannir-ip-d-un-site";} else $header="ma page index.php";    
?>    
script ====>window.location.replace("<?php echo $header;?>");  
 
0
Fallentree Messages postés 2309 Date d'inscription mercredi 25 février 2009 Statut Membre Dernière intervention 22 juillet 2019 208
16 mars 2012 à 16:00
A tester biensur ...
0
Fallentree Messages postés 2309 Date d'inscription mercredi 25 février 2009 Statut Membre Dernière intervention 22 juillet 2019 208
16 mars 2012 à 16:08
<?php
echo $_SERVER['REMOTE_ADDR'];
$Paslui="127.0.0.1";
if ($_SERVER['REMOTE_ADDR']!=$Paslui) { $header="https://forums.commentcamarche.net/forum/affich-24723344-bannir-ip-d-un-site";} else $header="";
?>
<script>
<?php if ($header!="") {?>");
window.location.replace("<?php echo $header;?>");
<?php } ?>");
</script>
0