<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tech stuff &#187; visitor information</title>
	<atom:link href="http://codytaylor.org/tag/visitor-information/feed" rel="self" type="application/rss+xml" />
	<link>http://codytaylor.org</link>
	<description>From Cody Taylor.</description>
	<lastBuildDate>Sun, 30 Oct 2011 04:15:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get Site Visitor Information With PHP</title>
		<link>http://codytaylor.org/2009/06/get-site-visitor-information-with-php.html</link>
		<comments>http://codytaylor.org/2009/06/get-site-visitor-information-with-php.html#comments</comments>
		<pubDate>Sat, 06 Jun 2009 15:59:25 +0000</pubDate>
		<dc:creator>Cody Taylor</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[visitor information]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://codytaylor.org/?p=14101</guid>
		<description><![CDATA[wanted to do a few custom things with one of my site's stats....]]></description>
			<content:encoded><![CDATA[<p>I wanted to do a few custom things with one of my site&#8217;s stats. PHP made this nice and simple with the $_SERVER array. When someone visits one of your scripts the $_SERVER array is automatically filled so as long as you know the keys then you can get all the information needed. These are the most useful items for identifying a visitor that I found in this using this array.</p>
<p>$_SERVER['REMOTE_ADDR']  gives you their ip address.<br />
$_SERVER['HTTP_USER_AGENT'] is their user-agent (What browser they are using).<br />
$_SERVER['HTTP_REFERER'] is where they came from.<br />
$_SERVER['REQUEST_URI'] is the page they want to view.</p>
<p>This data is kinda useless unless you put it in a database so here&#8217;s a create table mySQL statement.<br />
<pre><code>
$sql = &quot;CREATE TABLE visitors (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`visitor_id` mediumint(11) NOT NULL AUTO_INCREMENT,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`ip_address` VARCHAR(16)&nbsp;&nbsp;NOT NULL,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`user_agent` varchar(100) NOT NULL default &#039;&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`time_of_visit` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`referrer` varchar(256) NOT NULL default &#039;&#039;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`target_url` VARCHAR(256) NOT NULL,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PRIMARY KEY&nbsp;&nbsp;(`visitor_id`)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;);&quot;;
</code></pre></p>
<p>If you&#8217;d like to explore the $_SERVER array more there is very detailed info at <a href='http://php.net/manual/en/reserved.variables.server.php' title='PHP $_SERVER Documentation'>the php web site</a>.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcodytaylor.org%2F2009%2F06%2Fget-site-visitor-information-with-php.html&amp;linkname=Get%20Site%20Visitor%20Information%20With%20PHP"><img src="http://codytaylor.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://codytaylor.org/2009/06/get-site-visitor-information-with-php.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

