-
connect();
Restrict remote IP access, ps: This ** is really dizzy, hehe, used 8 ifs, -
Extract the stored IP addresses from the database that you want to restrict.
query_str = "select limit_ip from us_limitip";
db->query($query_str);
The results are extracted in a loop and verified one by one.
while ($db->next_record())limit_ip = $db->f("limit_ip");
lip = explode(".", $limit_ip);
If the first restriction IP address is * or 0, you will be redirected to an error page.
if ((lip[0]=='*') |lip[0]=='0'If it happens that the client IP is equal to the IP limit we restrict, we will jump to the error page.
if ($client ip==$limit ip) If the first set of IPs is the same, the second set of IPs is matched.
if ($cip[0] == $lip[0]) If the second set of restricted IPs is *, jump to the error page.
if ($lip[1]=='*')
The second group of IP matches will be matched by the third group of IP addresses.
if ($cip[1]==$lip[1]) jumps to the error page if the third set of restricted characters is *.
if ($lip[2]=='*')
If the third group of IP addresses matches, skip to the third group of checks.
if ($cip[2]==$lip[2]) If the fourth set of restricted IP is * or 0, you will be directed to an error page.
if ((lip[3]=='*') |lip[3]=='0')) Release the database query results.
db->free();
IP Verification Ended
-
Obtain the remote IP address.
ip=getenv("remote_addr");
Break down the IP address into 4 segments and put them into an array.
ip_arr=explode(".",$ip);
The first two IP addresses are combined into a single string.
ip_first=$ip_arr[0].$ip_arr[1];
The third segment of the IP address is assigned to another variable.
ip_last=$ip_arr[2];
Check whether the IP address is allowed to be allowed.
ip_first!='202198'?exit('You don't have access permissions'):$ip_last<123 ||ip_last>223?exit('You don't have access permissions'):1;
Done, this should be the most concise program.
-
The upstairs brother is well written. However, it is better to write the judgment as a function. Just call it directly and pull it.
Pull correctly. else {
header("");
-
The accessible IP address is stored in a file.
ip=$_server['remote_addr'];
ok=0;foreach (preg_split('/\s+/',file_get_contents('')) as $aip)
if ($ip==$aip) $ok=1;
if ($ok==0)
The back is normal**.
-
There are two ways to do this, one is to store the IP in a file, and the other is to write the IP to the database.
When the IP accesses, give him an error 403
-
195)&&userips[1]<=163 &&userips[1]>=163)&&userips[2]<=079 &&userips[2]>=072)&&userips[3]<=255 &&userips[3]>=000)){
echo "Your IP doesn't match! ";
exit;else{echo "Verified! ";
That's how I think of it.
Get the user's IP use"."Split into arrays.
Then repentance to restrict IP off is used separately"."Split into arrays.
Then determine whether the user's IP is within this IP break (determine whether the four elements are within this range).
Here's one found in Blue Ideal for your reference.
— Stuffy ———
getipadr(&$thisip);
thenetip=get_netip($ thisip);
for($ i=0;$ i
-
intremoteip = ip2long($_server['Flip the remote addr'Siyu]);
if ((intremoteip - ip2long(''))intremoteip - ip2long(''))0) {
exit('IP banned'accompaniment);
-
The PHP program runs on the server, not on the browser's machine, but only sends the HTML result generated by the run to the browser's browser program, and it is impossible to modify the browser's ** settings.
PHP can modify the settings of the server machine by modifying the registry.
-
You can take a look at the curl-related modules in the manual.
curl has an option called curlopt proxy, which is used to set **.
There is an example of this in the manual:
curl = curl_init();
curl_setopt($curl, curlopt_url, $requesturl);
curl_setopt($curl, curlopt_returntransfer, 1);
curl_setopt($curl, curlopt_timeout, 'timeout_in_seconds');
curl_setopt($curl, curlopt_proxy, 'proxy_ip:proxy_port');
pagecontent = trim(curl_exec($curl));
curl_close($curl);
-
There are many kinds of "**IP" now, that is, software to IP.
There are many IP points on the software for users to switch.
Install the IP converter on your computer and select a different IP point on the IP software to connect.
Recommended software. Similar software can be found.
Most cities in the country (millions of IP points can be switched arbitrarily).
-
Get the IP address of the local server, run the program if it is the IP address you need, and don't execute it if it doesn't.
This method can only deceive people who do not understand the program. Anyone who knows a little about the program will modify it.
-
What you're talking about with domain name or IP restrictions is actually a bit like a "hotlink protection" setting, and if you want to restrict it in PHP, you can check the $server[ in the environment variable'server_name'] is the domain name, $server[.]'server_addr'It's the IP, just add a restriction here, I hope it can help you :)
-
It doesn't seem to be the case in the project, putting operations into the cache and writing to the database every 24 hours. As long as it is judged that there is this record in the cache, it will not be written to the database.
-
My train of thought is:
In the first case of the first time the IP is logged in, the IP and the time of the login are recorded in the database.
In the second case, the database already has an IP record, but has not logged in within 24 hours, let him operate, and update the time of the IP in the database (here use the current time and the time of the database to compare whether it is greater than 24 hours, less than 24 hours is the third case).
In the third case, the database already has an IP record, but it has been logged in within 24 hours, and it is not allowed to operate it, and the IP of the database is not updated.
PS: I often do this when I do my polls.
-
Get the IP can be restricted with cookies and sessions, but the user can clear the cookies
You can also write a field in a database or a file.
-
the requested url was not found on this server.
web server at port
For example, the sibling directory is put in.
-
Enter the IP into the database, add a function to the specified page, and determine whether it matches the database.
-
IP List File:
ip = array(
Access to files: require once('');
if( in_array($_server['remote_addr'],$ip) )
-
$src_ip = $_server['remote_addr'];
if ($src_ip != "")
You can modify it yourself according to this.
If the computer has an IP conflict or a slow network, we can use a fixed IP address to prevent the IP address from being automatically modified every time the computer is turned on or off.
hcomm=createfile(port, generic_read and generic_write,0, null, open_existing,file_attribute_normal and file_flag_overlapped,null); >>>More
Is it to jump somewhere on this page to add an anchor.
There is a corresponding ** on the Internet, you can check it yourself!
I want to ask, have you written it now?