THinkPHP to get client IP and check address

2010-05-21  来源:本站原创  分类:PHP  人气:212 

Unfinished
TP1.5 to get the client IP address of the system of public function is: function get_client_ip (). Return value is the IP address.

Check IP address of the host country and the region class file is IpLocation.class.php, located ThinkPHP \ Lib \ ORG \ Net directory. Class name is IpLocation, is

public function getlocation ($ ip =");// omitted query the client IP address. returns an array. not found, then the return value is empty; found, then the array has a value of:

$ Location ['ip'];

$ Location ['country'];

$ Location ['area'];

Check the client IP and the corresponding region of the specific application process is:

import ('ORG.Net.IpLocation');

$ Ip = new Iplocation ();// create a new IP query object

$ Location = $ ip-> getlocation ();// omit that check the client IP. $ Location can be directly output to use, key name above.

If want to find a specific IP or domain area, the process is:

import ('ORG.Net.IpLocation');

$ Ip = new Iplocation ();// create a new IP query object

$ Ipname = '202 .38.68.68 '; / / Or you can use the domain name, such as $ ipname =' www.ustc.edu.cn ';

$ Location = $ ip-> getlocation ($ ipname );//$ location can be directly output to use, key name above.

If the client IP address as long as the query, the system functions can be directly used, such as:

$ Ip = get_client_ip ();

相关文章
  • THinkPHP to get client IP and check address 2010-05-21

    Unfinished TP1.5 to get the client IP address of the system of public function is: function get_client_ip (). Return value is the IP address. Check IP address of the host country and the region class file is IpLocation.class.php, located ThinkPHP \ L

  • jsp to get the client ip and mac address 2011-01-05

    jsp to get the client ip and mac address Transfer: http://footman265.javaeye.com/blog/832992 Articles Category: Java Programming Recently did a security system, the need for the user's ip and mac address authentication, used here to obtain the client

  • java to get the real client IP (reproduced) 2011-10-27

    ORIGINAL: http://jun-li-leo.iteye.com/blog/751981 We often want to write code to access the page recorded the source page address and the user's access to IP, it will use the following content. js method to obtain the source page address: var url = d

  • Get java client ip mac address 2010-03-29

    Transfer from: http://hi.baidu.com/coolcode/blog/item/0d42ffde48e07e5094ee37ec.html/cmtid/10029f13f5f1b78b6538dbca 1. To obtain the client ip address (this must be transmitted back from the client side): jsp page, the very simple, request.getRemoteAd

  • ASP.NET to get the client IP address 2010-02-05

    ASP.NET to get the client IP address approach: Method 1: Request.UserHostAddress.ToString (). Trim (); Method 2: Request.ServerVariables ["REMOTE_ADDR"];

  • web service to obtain the client ip 2010-03-29

    Editor: http://blog.ifeng.com/article/3478100.html / ** * Get the client IP address, such as the caller's IP, in order to check permissions. * For axis release webservice * @ Return * / public String getClientIpAxis () ( MessageContext mc = null; Htt

  • [Turn] a moment to view the Oracle client connection and display the client IP 2011-06-10

    1, see the total number of connections for each oracle account select username,count(username) from v$session where username is not null group by username 2, the default from v $ session can not directly access client IP, you can create a database to

  • In the JSP, the access to the true client IP 2010-07-28

    In the JSP, the access to client's IP address is: request.getRemoteAddr (), in most cases, this approach is valid. However, the adoption of Apache, Squid and other software can not get reverse proxy to the client's real IP address. If you use a rever

  • Linux Dedicated Hosting IP and MAC address binding, to prevent ARP cheating 2010-08-19

    1, ARP deception virus, mainly as follows: The machine not only affect the virus itself, but also affect the same segment of the other machine, the HTTP data to other machines by adding the virus code package . Code Examples: <html> <iframe src=h

  • IP voting procedures limit can not be used online search PHP code for the client to obtain IP Client IP - reserved 2011-03-29

    Received a voting requirements, need to do IP restrictions, IP restrictions for each certain opportunity to vote. I searched in the search engine key words: PHP client IP, the results are basically the following: if(getenv('HTTP_CLIENT_IP') && str

  • nginx proxy for less than the true client IP 2011-04-26

    In the Linux environment, the use of strong Nginx - reverse proxy, resulting in use request.getRemoteAddr () to obtain the IP are the company's proxy server IP, logging serious inaccurate! We all know that access to the client server IP address is: r

  • Multi-level pass client IP Nginx 2011-05-18

    Because of the need to adopt multi-level structure Nginx reverse proxy, but the back end of the program gets to the front of the client IP is Nginx of IP, the problem is the source of the back end of the Nginx HTTP Header in the IP did not get client

  • Linux host exclusive binding IP and MAC address, preventing ARP spoofing 2011-04-18

    A, ARP spoofing viruses, mainly as follows: The machine not only affect the virus itself, but also affect the same segment of the other machines, other machines will be the HTTP data packet by adding the virus code . Code examples are: <html> <if

  • haproxy should not keep an accurate record of the client IP, 2009-03-02

    Apache + HAProxy a server (A) Rails App two servers (B, C) version = 2.0.4 Medium production.log suddenly discovered some time ago only shows haproxy of IP. And should not show the real client ip However, in / etc / haproxy.cfg has been annotated #op

  • web project How to obtain client ip 2010-08-05

    Get client ip: public static String getIpAddr(HttpServletRequest request) { String ip = request.getHeader("X-Forwarded-For"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Cl

  • Get the client IP address 2010-03-26

    <?php function getip() { if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) $ip = getenv("HTTP_CLIENT_IP"); elseif (getenv("HTTP_X_FORWARDED_FOR") && strcas

  • Jsp to obtain client IP address (I can not read the code, find the comments) 2010-06-02

    <% String ip = request.getHeader ("x-forwarded-for"); %> <% if (ip == null | | ip.length () == 0 | | "unknown". equalsIgnoreCase (ip)) ( %> <% ip = request.getHeader ("Proxy-Client-IP"); %> <% ) If (ip ==

  • Flex for the client IP address (Java) 2011-01-06

    Is flex.messaging.FlexContext This class has a static method: flex.messaging.FlexContext.getHttpRequest () Access to the HttpRequest get back in getRemoteAddr Needless to say: flex.messaging.FlexContext.getHttpRequest (). getRemoteAddr () It's that s

  • tcp / ip kernel check 2010-09-06

    Header file <asm/checksum.h> ip verify: ip_fast_csum (const void * iph, unsigned int ihl) __wsum csum_partial (const void * buff, int len, __wsum sum); static inline __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len, unsigned

  • JavaScript html js java into the landing page displays the current user's IP areas, check IP network interface 2009-05-24

    Js interface with access to query the network ip address <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="E