Very sharp! PHP: Getting visitor access details

Source: Internet
Author: User
When visitors visit your website, this type of information can be stored in the database. It can also retrieve details of visitors from its IP address and other request headers to the current page. Currently, it records user computer operating systems, browsers, IP addresses, countries, cities, geographic coordinates, Internet service providers or use ip-api.comWeb services. Institute

When visitors visit your website, this type of information can be stored in the database. It can also retrieve details of visitors from its IP address and other request headers to the current page. Currently, it records user computer operating systems, browsers, IP addresses, countries, cities, geographic coordinates, Internet service providers or use ip-api.comWeb services. Institute

When visitors visit your website, this type of information can be stored in the database.

It can also retrieve details of visitors from its IP address and other request headers to the current page.

Currently, it records user computer operating systems, browsers, IP addresses, countries, cities, geographic coordinates, Internet service providers or Web services using ip-api.com.

The stored data can be associated with a given domain name address.

Http://www.codepearl.com/files/239.html PHP
 setSubdomain("www.codepearl.com");$info->getVisitorInfo($_SERVER['HTTP_USER_AGENT']);$info->insertInfo();?>    
     
     
     
     
 
CREATE TABLE IF NOT EXISTS `visitors` (`id` int(11) NOT NULL,  `domain` varchar(150) NOT NULL,  `ip` varchar(15) NOT NULL,  `serverDate` varchar(10) NOT NULL,  `serverTime` varchar(10) NOT NULL,  `timeZone` varchar(100) NOT NULL,  `userOS` varchar(100) NOT NULL,  `userBrowser` varchar(100) NOT NULL,  `userAgent` varchar(300) NOT NULL,  `country` varchar(100) NOT NULL,  `countryCode` varchar(10) NOT NULL,  `city` varchar(100) NOT NULL,  `state` varchar(10) NOT NULL,  `lat` varchar(40) NOT NULL,  `lon` varchar(40) NOT NULL,  `isp` varchar(200) NOT NULL,  `org` varchar(200) NOT NULL,  `asp` varchar(200) NOT NULL) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
Function getVisitorInfo ($ httpUserAgent) {$ this-> setUserIp (); $ this-> setServerDate (); $ this-> setServerTime (); $ this-> setUserOs ($ httpUserAgent); $ this-> setUserBrowser ($ httpUserAgent); $ this-> setUserAgent ($ httpUserAgent ); $ query = @ unserialize (file_get_contents ('HTTP: // ip-api.com/php/'.w.this-> getUserIp ())); // you can set $ this-> setUserCountry ($ query ['country']) for the IP Retrieval Interface; $ this-> setUserCountryCode ($ query ['countrycode']); $ this-> setUserCity ($ query ['city']); $ this-> setUserStateOfRegion ($ query ['regionname']); $ this-> setLatitude ($ query ['lat']); $ this-> setlongpolling ($ query ['lon ']); $ this-> setISP ($ query ['isp ']); $ this-> setORG ($ query ['org']); $ this-> setAS ($ query ['as']); $ this-> setTimeZone ($ query ['timezone ']);}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.