我只需要从专门的IP地址进入一个网站。
是否可能使用购买力平价。
这个项目正在开发之中,一些人利用了该项目,说“网站并不好”。 So
避免此类事情。 因此,我需要这样作。
我只需要从专门的IP地址进入一个网站。
是否可能使用购买力平价。
这个项目正在开发之中,一些人利用了该项目,说“网站并不好”。 So
避免此类事情。 因此,我需要这样作。
尝试:
if ($_SERVER[ REMOTE_ADDR ] == "x.x.x.x")
echo "admin";
else
echo "user";
它检查用户,并采取行动。
我建议使用“htaccess”文档,而不是在你的“php”编码中添加:
RewriteEngine On
RewriteBase /
# IPs that are still allowed to view everything
RewriteCond %{REMOTE_ADDR} !^213.123.39.12$ [NC]
RewriteRule !^(noentry_image.jpg|favicon.ico)$ sorry_stay_out.html [L]
仅将“htaccess”档案放在你网站的根基。 然后,每个人都会被转往Sorry_stay_out.html网页,其中载有不露面的_。
获准访问的IP所有来访者都将认为该网址是正常的。 您可以重复“RewriteCond %{REMOTE_ADDR} !^213.123.39.12美元”这一行文,并按您的意愿,用不同的知识产权添加更多的知识产权。
仅作封锁的替代办法:
order allow,deny
allow from 62.57.16.192
allow from 72.232.56.154
deny from all
如果来源来自IP,你可以使用“SERVER”变量进行核对。 这里是一些有用的功能信标(仅为_SERVER):
function gethostname($ip){
return gethostbyaddr($ip);}
function gethostnamepretty($ip){
$host=gethostbyaddr($ip);
$host=explode( . ,$host);
$max=count($host);
return $host[$max - 2];}
function getRawRealIP($s){
if (!empty($s[ HTTP_CLIENT_IP ])) //check ip from share internet
{
$ip=$s[ HTTP_CLIENT_IP ];
}
elseif (!empty($s[ HTTP_X_FORWARDED_FOR ])) //to check ip is pass from proxy
{
$ip=$s[ HTTP_X_FORWARDED_FOR ];
}
else
{
$ip=$s[ REMOTE_ADDR ];
}
return $ip;}
function checkIP($ip){
return long2ip(ip2long($ip));}
function useragent($s){
return $s[ HTTP_USER_AGENT ];}
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...