Simpatie.ro - matrimoniale
EliteHackers
SALUT 2022!! NE-AM MUTAT PE DISCORD ! Vrei să inviți un prieten? [T]eoria [H]aosului [C]ontrolat - https://discord.com/invite/U4HBCHzm7r Acesta aste link-ul oficial al acestui server.
Nou pe simpatie:
Sophya
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 54 ani
EliteHackersReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
EliteHackers / Scripting / [PHP] Ban IP From Visiting Pagini: 1 Moderat de Ad_Infinitum, AntiKiler, Puscas_marin, r3v
#1
Puscas_marin
Moderator
Postari: 315
Credit goes to: Nath
This is a short tutorial on how to ban an IP address from your website.

Either create a new .php document in a text editor or add the following php to an existing .php document. (ex. index.php)

Code:

<?php
$ip = getenv('REMOTE_ADDR');
$blocked = "xx.xx.xx.xx"; // Replace the x's with the IP address.

if (ereg($blocked,$ip))
{
echo "You Have Been Banned";
exit();
}
?>

'echo "You Have Been Banned";'

* Now to explain the code.

<?php - Starts the php tag. Lets the browser know what language you are using.

$ip = getenv('REMOTE_ADDR'); - Gets the users IP address

$blocked = "xx.xx.xx.xx"; - Tells the browser that the "xx.xx.xx.xx" IP is blocked/banned

if (ereg($blocked,$ip)) - If the blocked/banned IP is the same as the users IP, the following echo will be displayed.

{ - Starts a bracket

echo "You Have Been Banned"; - Echos the "You Have Been Banned" line onto the page.

exit(); - Exit so no more content is ouput

} - Ends a bracket

?> - Ends the php tag


_______________________________________
Deci asa se fac banii....da clik sa vezi

 
   
Pagini: 1