Prohibit an IP Address

Written by @m_k_amin 21 November 2012

You may have visitors that hurt your site and you want to block their access. Here is a code that get this ability to you. just replace the $blocked with the IP that must be blocked and enjoy!

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<!-- This Script is from www.phpfreecpde.com, Coded by: Kerixa Inc-->
<?php
			$blocked="127.0.0.1";   //Replace This IP with the IP which must be blocked.
$ip = getenv('REMOTE_ADDR');
if (ereg($blocked,$ip)) die('
?>
<p style="text-align: center;	color: #FF0000;	font-size: 32pt;"><strong>Your IP is Blocked!</strong></p>
<?php
');
?>

<br><font face="Tahoma"><a target="_blank" href="http://www.phpfreecode.com/"><span style="font-size: 8pt; text-decoration: none">PHP Free Code</span></a></font><a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>                                                
                                            

Example:


About @m_k_amin

This user is pending a biography.

M

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: grkkid, Manaakividuinfo.com, karticksv, sava, tinatina
advertisement 2