<?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>SublimeSite</title>
	<atom:link href="http://www.sublimesite.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sublimesite.com</link>
	<description>Resources for webdesigners and developers</description>
	<lastBuildDate>Thu, 27 May 2010 18:03:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP Array Insertion And Removal</title>
		<link>http://www.sublimesite.com/php-array-insertion-and-removal/</link>
		<comments>http://www.sublimesite.com/php-array-insertion-and-removal/#comments</comments>
		<pubDate>Thu, 27 May 2010 18:02:19 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[insertion]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[remove]]></category>

		<guid isPermaLink="false">http://www.sublimesite.com/?p=150</guid>
		<description><![CDATA[Just wanted to quickly post two PHP snippets that I find helpful at times. The first of the two snippets is arrayInsert, arrayInsert will return an array after placing a value at a specified index in an array and move all the elements after the insertion down one. There are three parameters; $array, $value, and [...]]]></description>
			<content:encoded><![CDATA[<p>Just wanted to quickly post two PHP snippets that I find helpful at times. The first of the two snippets is arrayInsert, arrayInsert will return an array after placing a value at a specified index in an array and move all the elements after the insertion down one.  There are three parameters; $array, $value, and $index. </p>
<p>$array should be pretty self explanatory, this is the array that you would like to insert an element into. $value, is the vale that you would like to insert, this can be any data type. Last is $index, $index is where you want to place the new value within the array. Remember that the first element in an array starts with an index of 0.</p>
<pre class="brush:php">
function arrayInsert($array, $value, $index){
	//Loops through array pushing everything back one
	for($i = count($array)-1; $i >= $index; $i--)
		$array[$i+1] = $array[$i];
	//Inserts the new value
	$array[$index] = $value;
	return $array;
}
</pre>
<p><span id="more-150"></span><br />
The next snippet is arrayRemove, arrayRemove will remove an element from an array and then move all the elements after the removed element up one. There are two parameters that are needed for this method, $array which is the $array you want to remove from and $index which is the element index in the array you want to remove.</p>
<pre class="brush:php">
function arrayRemove($array, $index){
	//Loops through array pushing everything up one
	for($i = $index; $i < count($array)-1; $i++)
		$array[$i] = $array[$i+1];
	//Unsets the last value because it's nolonger needed
	unset($array[count($array)-1]);
	return $array;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sublimesite.com/php-array-insertion-and-removal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating Dynamic Images With PHP</title>
		<link>http://www.sublimesite.com/creating-dynamic-images-with-php/</link>
		<comments>http://www.sublimesite.com/creating-dynamic-images-with-php/#comments</comments>
		<pubDate>Thu, 20 May 2010 16:51:37 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[changing]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[dynamic images]]></category>
		<category><![CDATA[host name]]></category>
		<category><![CDATA[ip]]></category>

		<guid isPermaLink="false">http://www.sublimesite.com/?p=163</guid>
		<description><![CDATA[Have you ever looked on forums and wonder how people get images that display your IP address in their signature? In this post I will show you how to not only get and display the users IP address but also their browser information and host name. I&#8217;m going to try and explain how this can [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever looked on forums and wonder how people get images that display your IP address in their signature? In this post I will show you how to not only get and display the users IP address but also their browser information and host name. I&#8217;m going to try and explain how this can be achieved without going into to much detail.</p>
<div class="light_box noborder"><img src="/wp-content/article_images/creating_dynamic_images_with_php/dynamic_info.php"></div>
<h3>Getting Started</h3>
<p>Before we do anything lets set the header content-type to image/jpeg, to do this add the follow one line of code to the top of your PHP file.</p>
<pre class="brush:php">
header ("Content-type: image/jpeg");
</pre>
<p>Now that we have told PHP what it is exactly that we will be displaying, we can start to gather the user&#8217;s information. </p>
<pre class="brush:php">
$ip = $_SERVER['REMOTE_ADDR'];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];

/*wordwrap() will add a new line symbol after a specified amount
of characters, in our case 50*/
$browser = wordwrap($browser,50, "\n");

/*After we create the new lines we will need to explode the
$browser string into an array. (see more later)*/
$browser = explode("\n", $browser);
</pre>
<p><span id="more-163"></span><br />
$ip: This should be pretty self explanatory, it&#8217;s the user&#8217;s IP address<br />
$hostaddress: The internet host name corresponding to a given IP address<br />
$browser: All kinds of information on the user&#8217;s browser </p>
<h3>Creating The Image</h3>
<p>Next, we need to create an image from an existing image and what better way to do that than with imageCreateFromJPEG(). While we are at it lets set our font color, I have chosen plain black but feel free to change it to fit your needs.</p>
<pre class="brush:php">
//Create a new image from board.jpg
$img_handle = imageCreateFromJPEG("board.jpg");
//Font color (in RGB format)
$color = ImageColorAllocate ($img_handle, 0, 0, 0);
</pre>
<h3>Adding The Text</h3>
<p>Finally, we can start add in the text.</p>
<pre class="brush:php">
//ImageString (image, font, x-position, y-position,  "text", font color);

ImageString ($img_handle, 3, 20, 20,  "Your IP: $ip", $color);
ImageString ($img_handle, 3, 20, 40,  "Your Host Address: $hostaddress", $color);
ImageString ($img_handle, 3, 20, 60,  "Your Browser: ", $color);
</pre>
<p>What I did here is was just create three lines of text using ImageString(). If you want to know more about ImageString try checking the <a href="http://us.php.net/manual/en/function.imagestring.php">PHP manual</a></p>
<p>You may have noticed that we never added in the users browser information, there&#8217;s a good reason for that. ImageString doesn&#8217;t support multiple lines of text, so if you remember from before we split $browser into and array of lines. So now all we have to do is loop through the array and print the lines one by one.</p>
<pre class="brush:php">
for($i = 0; $i < count($browser); $i++)
	ImageString ($img_handle, 3, 35, 80+($i*20), $browser[$i], $color);
</pre>
<h3>Display The Image</h3>
<p>Finally we have came to the last step, that is to display the image and then free any memory that we may have used while creating the image.<br />
To do this all we need is the two simple lines below.</p>
<pre class="brush:php">
ImageJpeg ($img_handle, null, 100);
ImageDestroy ($img_handle);
</pre>
<p>You call the image the same way that you would any other, but instead of .jpg, .png, or whatever it's .php.</p>
<pre class="brush:html">
<img scr="images/dynamic.php">
</pre>
<h3>Final Code</h3>
<pre class="brush:php">
header ("Content-type: image/jpeg");

$ip = $_SERVER['REMOTE_ADDR'];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];

$browser = wordwrap($browser,50, "\n");
$browser = explode("\n", $browser);

$img_handle = imageCreateFromJPEG("board.jpg");
$color = ImageColorAllocate ($img_handle, 0, 0, 0);

ImageString ($img_handle, 3, 20, 20,  "Your IP: $ip", $color);
ImageString ($img_handle, 3, 20, 40,  "Your Host Address: $hostaddress", $color);
ImageString ($img_handle, 3, 20, 60,  "Your Browser: ", $color);

for($i = 0; $i < count($browser); $i++)
	ImageString ($img_handle, 3, 35, 80+($i*20), $browser[$i], $color);

ImageJpeg ($img_handle, null, 100);
ImageDestroy ($img_handle);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sublimesite.com/creating-dynamic-images-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting To Localhost Remotely</title>
		<link>http://www.sublimesite.com/connecting-to-localhost-remotely/</link>
		<comments>http://www.sublimesite.com/connecting-to-localhost-remotely/#comments</comments>
		<pubDate>Fri, 14 May 2010 20:15:50 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[default gateway]]></category>
		<category><![CDATA[incoming requests]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[remote computer]]></category>

		<guid isPermaLink="false">http://www.sublimesite.com/?p=112</guid>
		<description><![CDATA[This tutorial will show you how to access your computer's localhost for a remote machine. We will need to forward incoming requests to the computer with localhost setup on it.

<h3>Step One: Gathering Information</h3>
<b>Windows:</b> Click Start>Run and type cmd and press &#60;Enter&#62;. A DOS windows will come up, when it does type "ipconfig/all" and press &#60;Enter&#62;. What we came her for are the lines "Default Gateway" and "ip address", after you locate these lines write them down to be used later.

<b>Mac:</b> Open Applications>Utilities>Terminal. In the terminal window type "ipconfig getpacket en0" if you have an Ethernet connection, or "ipconfig getpacket en1" for wireless. What we came her for are the lines "yiaddr" and "siaddr", after you locate these line write them down to be used later.

Now, we need to get our IP address for this go to <a href="www.whatismyip.com">whatismyip.com</a> and write down that number as well.
<span id="more-112"></span>
<h3>Step Two: Forwarding</h3>
In your browser's address bar type what you wrote down for "Default Gateway" (or "siaddr" if on a mac) and hit &#60;Enter&#62;. Sign into the admin panel, if you don't know your username and password look through your modem's manual or check <a href="http://www.phenoelit-us.org/dpl/dpl.html">phenoelit-us.org</a> for a list of default logins. Once logged in look for the page titled "Forwarding" or something like that. Here is where you redirect incoming requests to the computer that's running localhost.
<div class="light_box noborder"><img src="<br />
<b>Fatal error</b>:  Call to undefined function imagePath() in <b>/home8/sublimes/public_html/sublimesite/wp-content/plugins/php-execution-plugin/includes/class.php_execution.php(273) : eval()'d code</b> on line <b>12</b><br />
