Pages

Wednesday, December 2, 2009

आपका ब्लॉग IP द्वारा बैन (BAN) हो सकता है!

Blogger.com पर किसी Visitor को IP द्वारा Block या Ban (प्रतिबंधित) करना बड़ा मुश्किल काम है। परन्तु PHP की सहायता से ऐसा कर पाना संभव है। नीचे दी जा रही छोटी-सी Java Script इस कार्य में आपकी सहायता कर सकती है। इस Code को आप अपने Blog के Head यानि के नीचे Paste करके यह काम पूरा कर सकते हैं।

<script type="text/javascript" src="http://code.vietwebguide.com/php/addr.php"></script><script type="text/javascript">//<!CDATA[// Banned ip script 2.0//(C)2009 Anhvo//homepage: http://vietwebguide.comvar banned_ip = new Array();banned_ip[0] = '54.95';banned_ip[1] = '54.95.69.1';banned_ip[2] = '54.95.69.141';banned_ip[3] = '54.95';var mes_bi = "Your IP is banned so you cannot visit this website!";for(var i=0;i<banned_ip.length;i++) {eval('var re = /^' + banned_ip[i] + '/ ;'); if (re.test(mc_user_ip)) { document.write('<style type="text/css">'); document.write('BODY{display:none;}'); document.write('<\/style>'); alert(mes_bi); break; }}//]]></script>

ऊपर दिये गये Code में आप IP Range बदलकर, अपने मनचाहे Visitor(group) को IP द्वारा प्रतिबंधित कर सकते हैं। उदाहरण के तौर पर यदि आप 54.95.xxx.xxx IP range को Ban करना चाहते हैं तो आपको मात्र 54.59 लिखना होगा

0 comments: