<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Get users IP with PHP</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/</link>
	<description></description>
	<pubDate>Thu, 08 Jan 2009 11:17:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Royce Hart</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9520</link>
		<dc:creator>Royce Hart</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9520</guid>
		<description>I'm not certain, but I believe that GetHostByName() has been crashing in instances where the IP address of the visitor does not resolve. Has anyone else experienced issues with this function? Thanks.
</description>
		<content:encoded><![CDATA[<p>I&#039;m not certain, but I believe that GetHostByName() has been crashing in instances where the IP address of the visitor does not resolve. Has anyone else experienced issues with this function? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9519</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9519</guid>
		<description>Silly question maybe - but what's in line 1? Try removing any extra spaces around the code - maybe there's some hidden characters that aren't displaying in your text editor that's messing it up?</description>
		<content:encoded><![CDATA[<p>Silly question maybe - but what&#039;s in line 1? Try removing any extra spaces around the code - maybe there&#039;s some hidden characters that aren&#039;t displaying in your text editor that&#039;s messing it up?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C:</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9517</link>
		<dc:creator>C:</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9517</guid>
		<description>Many thanks!!! you are in my fav. Goddess!</description>
		<content:encoded><![CDATA[<p>Many thanks!!! you are in my fav. Goddess!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edwin</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9518</link>
		<dc:creator>Edwin</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9518</guid>
		<description>I have just tried this code at the top of a PHP script:

2   	if ($_SERVER['HTTP_X_FORWARD_FOR']) 
3	 {
4		$REM_ADDR = $_SERVER['HTTP_X_FORWARD_FOR'];
5	 } else {
6 	$REM_ADDR = $_SERVER['REMOTE_ADDR'];
7	}
8 	$HOST = $_SERVER['HTTP_HOST']; // grabs host
9 	$USER_AGENT = $_SERVER['HTTP_USER_AGENT'];

But it gives me this error in the browser when I upload and vioew it online:

Parse error: parse error in /home/schofield/public_html/test.php on line 2

I have tried with JUST this code - nothing else and I still get the error. Is it to do with server settings at my ISP?

Not had any other problems with my PHP on the server.

This is the 
www.extendev.co.uk/test.php</description>
		<content:encoded><![CDATA[<p>I have just tried this code at the top of a PHP script:</p>
<p>2   	if ($_SERVER['HTTP_X_FORWARD_FOR'])<br />
3	 {<br />
4		$REM_ADDR = $_SERVER['HTTP_X_FORWARD_FOR'];<br />
5	 } else {<br />
6 	$REM_ADDR = $_SERVER['REMOTE_ADDR'];<br />
7	}<br />
8 	$HOST = $_SERVER['HTTP_HOST']; // grabs host<br />
9 	$USER_AGENT = $_SERVER['HTTP_USER_AGENT'];</p>
<p>But it gives me this error in the browser when I upload and vioew it online:</p>
<p>Parse error: parse error in /home/schofield/public_html/test.php on line 2</p>
<p>I have tried with JUST this code - nothing else and I still get the error. Is it to do with server settings at my ISP?</p>
<p>Not had any other problems with my PHP on the server.</p>
<p>This is the<br />
<a href="http://www.extendev.co.uk/test.php" rel="nofollow">http://www.extendev.co.uk/test.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9516</link>
		<dc:creator>Corey</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9516</guid>
		<description>SORRY about the above, forgot to take-out my "" tags, so it didn't all post.

Neil,

NOTE: as others mentioned above, these very by PHP version. But the ones below work for the latest versions (4.0+, ans in some of the 3+,,,they have just now released version 4.3.3)

&#60;?php
&#36;IP=&#36;_SERVER['REMOTE_ADDR'];
&#36;HOST= gethostbyaddr(&#36;IP);
?&#62;
Your page content...blah...blah...blah...
&#60;form.....&#62;
&#60;input type=hidden name="UserIP" value="&#60;?php echo &#36;IP ?&#62;"&#62;
&#60;input type=hidden name="HostName" value="&#60;?php echo &#36;HOST ?&#62;
&#60;/form&#62;
The need to include the "php" right after the start of the script ("&#60;?php") and in the "echo" statement varies by version of PHP, and in current versions can be set by the host. Try it without it first, and if it works use it so that you don't use alot of bandwidth on a PHP-heavy site.</description>
		<content:encoded><![CDATA[<p>SORRY about the above, forgot to take-out my &#034;&#034; tags, so it didn&#039;t all post.</p>
<p>Neil,</p>
<p>NOTE: as others mentioned above, these very by PHP version. But the ones below work for the latest versions (4.0+, ans in some of the 3+,,,they have just now released version 4.3.3)</p>
<p>&lt;?php<br />
&#36;IP=&#36;_SERVER['REMOTE_ADDR'];<br />
&#36;HOST= gethostbyaddr(&#36;IP);<br />
?&gt;<br />
Your page content&#8230;blah&#8230;blah&#8230;blah&#8230;<br />
&lt;form&#8230;..&gt;<br />
&lt;input type=hidden name=&#034;UserIP&#034; value=&#034;&lt;?php echo &#36;IP ?&gt;&#034;&gt;<br />
&lt;input type=hidden name=&#034;HostName&#034; value=&#034;&lt;?php echo &#36;HOST ?&gt;<br />
&lt;/form&gt;<br />
The need to include the &#034;php&#034; right after the start of the script (&#034;&lt;?php&#034;) and in the &#034;echo&#034; statement varies by version of PHP, and in current versions can be set by the host. Try it without it first, and if it works use it so that you don&#039;t use alot of bandwidth on a PHP-heavy site.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9514</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9514</guid>
		<description>How could I ustilize this in a Contact Form?
I am currently using a Form where I don't know how to get the respondents' IP address.

I will apprecdiate any help.
thanks
neil</description>
		<content:encoded><![CDATA[<p>How could I ustilize this in a Contact Form?<br />
I am currently using a Form where I don&#039;t know how to get the respondents&#039; IP address.</p>
<p>I will apprecdiate any help.<br />
thanks<br />
neil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9515</link>
		<dc:creator>Corey</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9515</guid>
		<description>Neil,

NOTE: as others mentioned above, these very by PHP version. But the ones below work for the latest versions (4.0+, ans in some of the 3+,,,they have just now released version 4.3.3)

&#60;?php
&#36;IP=&#36;_SERVER['REMOTE_ADDR'];
&#36;HOST= gethostbyaddr(&#36;IP);
?&#62;
Your page content...blah...blah...blah...





The need to include the "php" right after the start of the script ("&#60;?php") and in the "echo" statement varies by version of PHP, and in current versions can be set by the host. Try it without it first, and if it works use it so that you don't use alot of bandwidth on a PHP-heavy site.</description>
		<content:encoded><![CDATA[<p>Neil,</p>
<p>NOTE: as others mentioned above, these very by PHP version. But the ones below work for the latest versions (4.0+, ans in some of the 3+,,,they have just now released version 4.3.3)</p>
<p>&lt;?php<br />
&#36;IP=&#36;_SERVER['REMOTE_ADDR'];<br />
&#36;HOST= gethostbyaddr(&#36;IP);<br />
?&gt;<br />
Your page content&#8230;blah&#8230;blah&#8230;blah&#8230;</p>
<p>The need to include the &#034;php&#034; right after the start of the script (&#034;&lt;?php&#034;) and in the &#034;echo&#034; statement varies by version of PHP, and in current versions can be set by the host. Try it without it first, and if it works use it so that you don&#039;t use alot of bandwidth on a PHP-heavy site.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9513</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9513</guid>
		<description>Put your script tags around it &#60;? and ?&#62; and put it on your page, or in an include (it's not .htacess related so don't put it there). Then you have the user's IP as a "string" type in that variable &#36;ip - you can do anything you want with it. Write it to a file, display it on the screen, write it to a database... all depends on what you want to do. This is just a little snippet - not too useful on its own... more as a piece to a larger whole.</description>
		<content:encoded><![CDATA[<p>Put your script tags around it &lt;? and ?&gt; and put it on your page, or in an include (it&#039;s not .htacess related so don&#039;t put it there). Then you have the user&#039;s IP as a &#034;string&#034; type in that variable &#36;ip - you can do anything you want with it. Write it to a file, display it on the screen, write it to a database&#8230; all depends on what you want to do. This is just a little snippet - not too useful on its own&#8230; more as a piece to a larger whole.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9511</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9511</guid>
		<description>Updated the post. Thanks!</description>
		<content:encoded><![CDATA[<p>Updated the post. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reese</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9512</link>
		<dc:creator>reese</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/18/get-users-ip-with-php/#comment-9512</guid>
		<description>Hi, excuse my naivety...I do use PHP and other hacks on my site, but I'm clueless as to how to implement this. WOuld it be an include or in an htaccess file? And then how would you view the results?</description>
		<content:encoded><![CDATA[<p>Hi, excuse my naivety&#8230;I do use PHP and other hacks on my site, but I&#039;m clueless as to how to implement this. WOuld it be an include or in an htaccess file? And then how would you view the results?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.310 seconds -->
