<?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>PHP Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; Scripts</title>
	<atom:link href="http://www.phpmagicbook.com/category/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +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>Enable Gravatar/Avatar at Your Website &#8211; Gravatar Image PHP Script</title>
		<link>http://www.phpmagicbook.com/enable-gravataravatar-at-your-website-gravatar-image-php-script/</link>
		<comments>http://www.phpmagicbook.com/enable-gravataravatar-at-your-website-gravatar-image-php-script/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 09:37:06 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Useful Scripts]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[displaypic]]></category>
		<category><![CDATA[gravatar]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=499</guid>
		<description><![CDATA[You might have already created an account at gravatar (Globally Recognized Avatars) and enjoying your display picture or avatar at forums and blogs when you just post your comment with your email and there you are &#8212; it displays your avatar along with your comment. If you are a developer and you create websites &#8211; [...]<p><a href="http://www.phpmagicbook.com/enable-gravataravatar-at-your-website-gravatar-image-php-script/">Enable Gravatar/Avatar at Your Website &#8211; Gravatar Image PHP Script</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.phpmagicbook.com/wp-content/uploads/2009/10/gravatar.png" alt="gravatar" title="gravatar" width="200" height="44" class="alignright size-full wp-image-500" />You might have already created an account at <a rel="nofollow" target="_blank" href="http://en.gravatar.com/">gravatar</a> (Globally Recognized Avatars) and enjoying your display picture or avatar at forums and blogs when you just post your comment with your email and there you are &#8212; it displays your avatar along with your comment. If you are a developer and you create websites &#8211; PHP websites &#8211; and wondering how you can enable gravatars / avatars in your next project then here is very easy to use working solution &#8211; PHP script to enable gravatar at your PHP website / blog / forum / project.</p>
<p><span id="more-499"></span></p>
<p>Copy the following code. Paste it in a file, save it in PHP extension, upload it or use it at localhost &#8211; just change the <strong>usersEmail</strong> value to your email address, if you are already at gravatars website and hit it. Other instructions for customization of script &#8211; you can find in the script. e.g. size of gravatar, default image, rating etc.</p>
<h4>Gravatars PHP Script for Your Website</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// The users email, passed to Gravatar</span>
<span style="color: #000088;">$usersEmail</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;myemail@live.com&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// default avatar to load if Gravatar doesn't find one</span>
<span style="color: #000088;">$defaultImage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://domain.com/default.png&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The size of the image</span>
<span style="color: #000088;">$avatarSize</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;50&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Minimum rating for your site</span>
<span style="color: #666666; font-style: italic;">// Possible values (G, PG, R, X)</span>
<span style="color: #000088;">$avatarRating</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;G&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Border around the image</span>
<span style="color: #000088;">$avatarBorder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;000000&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// URL for Gravatar</span>
<span style="color: #000088;">$gravatarURL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.gravatar.com/avatar.php?gravatar_id=<span style="color: #009933; font-weight: bold;">%s</span>&amp;default=<span style="color: #009933; font-weight: bold;">%s</span>&amp;size=<span style="color: #009933; font-weight: bold;">%s</span>&amp;border=<span style="color: #009933; font-weight: bold;">%s</span>&amp;rating=<span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$avatarURL</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span>
<span style="color: #009900;">&#40;</span>
	<span style="color: #000088;">$gravatarURL</span><span style="color: #339933;">,</span>
	<span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$usersEmail</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$defaultImage</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$avatarSize</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$avatarBorder</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$avatarRating</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;img src=&quot;</span><span style="color: #0000ff;">&quot; .
	<span style="color: #006699; font-weight: bold;">$avatarURL</span> . &quot;</span><span style="color: #0000ff;">&quot; width=&quot;</span><span style="color: #0000ff;">&quot; .
	<span style="color: #006699; font-weight: bold;">$avatarSize</span> . &quot;</span><span style="color: #0000ff;">&quot; height=&quot;</span><span style="color: #0000ff;">&quot; .
	<span style="color: #006699; font-weight: bold;">$avatarSize</span> . &quot;</span><span style="color: #0000ff;">&quot; /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/enable-gravataravatar-at-your-website-gravatar-image-php-script/">Enable Gravatar/Avatar at Your Website &#8211; Gravatar Image PHP Script</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/text-to-image-using-php/" title="Text To Image Using PHP">Text To Image Using PHP</a></li><li><a href="http://www.phpmagicbook.com/captcha-image-number-verification/" title="Captcha &#8211; Image And Number Verification Using PHP">Captcha &#8211; Image And Number Verification Using PHP</a></li><li><a href="http://www.phpmagicbook.com/random-single-image-onload/" title="Random Single Image Onload Using PHP">Random Single Image Onload Using PHP</a></li><li><a href="http://www.phpmagicbook.com/php-javascript-based-image-gallery/" title="PHP Javascript Based Auto Populated Image Gallery">PHP Javascript Based Auto Populated Image Gallery</a></li><li><a href="http://www.phpmagicbook.com/display-images-from-folder/" title="Auto Display Images From Folder Using PHP">Auto Display Images From Folder Using PHP</a></li><li><a href="http://www.phpmagicbook.com/random-single-image-display-on-page-reload/" title="Random Single Image Display On Page Reload Using PHP">Random Single Image Display On Page Reload Using PHP</a></li><li><a href="http://www.phpmagicbook.com/php-photo-slide-show/" title="Auto Create PHP Photo Slide Show Using PHP">Auto Create PHP Photo Slide Show Using PHP</a></li><li><a href="http://www.phpmagicbook.com/image-gallery/" title="Auto Create Image Gallery from Folder Using PHP">Auto Create Image Gallery from Folder Using PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/enable-gravataravatar-at-your-website-gravatar-image-php-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP File Upload Script &#8211; Globals Off</title>
		<link>http://www.phpmagicbook.com/php-file-upload-script-globals-off/</link>
		<comments>http://www.phpmagicbook.com/php-file-upload-script-globals-off/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 12:52:15 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[File Upload]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Checks]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[filesize]]></category>
		<category><![CDATA[most wanted]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=308</guid>
		<description><![CDATA[It is easy to upload file when the Register_Globals are set to ON in the php.ini file (php configuration file) which is not recommended in any case for security reasons. When Globals are OFF then in this case I have tried this script and it works fine. Following is the script. Create two files. one [...]<p><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/">PHP File Upload Script &#8211; Globals Off</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>It is easy to upload file when the Register_Globals are set to ON in the php.ini file (php configuration file) which is not recommended in any case for security reasons. When Globals are OFF then in this case I have tried this script and it works fine. Following is the script. Create two files. one html containing form and the other php file containing php script. This script will need a directory named as &#8216;img&#8217; in root where this php script file is located according to the requirement of code. You can customize this code.</p>
<p><span id="more-308"></span></p>
<h4>HTML Form Code</h4>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form action=&quot;upload.php&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td&gt;File Name &lt;/td&gt;
&lt;td&gt;
&lt;input name=&quot;uploadedfile&quot; type=&quot;file&quot; id=&quot;uploadedfile&quot; /&gt;    &lt;/td&gt;
&lt;td&gt;&lt;label&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot; /&gt;
    &lt;/label&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;</pre></div></div>

<h4>PHP Upload Code</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Check that file is transferring to PHP code or not</span>
<span style="color: #666666; font-style: italic;">// print_r($_FILES);</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// upload</span>
<span style="color: #000088;">$image1</span><span style="color: #339933;">=</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploadedfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploadedfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// img is our upload directory</span>
	<span style="color: #000088;">$sUploadDir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'img/'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$sUploadedFile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sUploadDir</span> <span style="color: #339933;">.</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploadedfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploadedfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sUploadedFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$sThumbnail</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploadedfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;  File Uploaded Successfully&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/11/file-upload-php.rar' class="download">Download PHP File Upload Easy Way Script</a></p>
<p><strong>*** Important ***</strong></p>
<p>Never give a simple page to upload to your users if it is a website based on users. Always check that whether user is uploading image file, audio, video or script file. Check extension of file to be uploaded. Suppose you need jpg files to be uploaded. Set a check for script to upload just files with jpg extension and none other. If there is a bad user. He can upload a script file (php file) and damage your server. So security first. Checks are essential.</p>
<h4>Security Checks For File To Be Uploaded</h4>
<p><strong>Check Extension</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$userfile_type</span> <span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;image/pjpeg&quot;</span> OR <span style="color: #000088;">$userfile_type</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;image/gif&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #000088;">$msg</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;Your uploaded file must be of JPG or GIF. Other file types are unsupported&lt;BR&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$file_upload</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// at file_upload false you can exit from script</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Extract Base Name and Extension</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #000088;">$file_basename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// strip extention</span>
      <span style="color: #000088;">$file_ext</span>          <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #990000;">strripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// this will give us file extension to compare with our supported formats</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Check Extension</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$extension</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'.jpg'</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span><span style="color: #000088;">$extension</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This is not a JPEG&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>More Checks</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'somefile.jpg'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// assuming you've already taken some other</span>
<span style="color: #666666; font-style: italic;">// preventive measures such as checking file</span>
<span style="color: #666666; font-style: italic;">// extensions...</span>
&nbsp;
<span style="color: #000088;">$result_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result_array</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$mime_type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result_array</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mime'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mime_type</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;image/jpeg&quot;</span><span style="color: #339933;">:</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;file is jpeg type&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;image/gif&quot;</span><span style="color: #339933;">:</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;file is gif type&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;file is an image, but not of gif or jpeg type&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;file is not a valid image file&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/">PHP File Upload Script &#8211; Globals Off</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/get-file-size-and-file-type-in-php/" title="Get File Size and File Type In PHP">Get File Size and File Type In PHP</a></li><li><a href="http://www.phpmagicbook.com/function-existence-check/" title="Function Existence Check Using PHP">Function Existence Check Using PHP</a></li><li><a href="http://www.phpmagicbook.com/file-upload-get-info/" title="File Upload Using PHP and Get File Info">File Upload Using PHP and Get File Info</a></li><li><a href="http://www.phpmagicbook.com/htaccess-essential-tricks-for-blog-website-performance-a-guide/" title=".htaccess Essential Tricks For Blog/Website Performance &#8211; Guide">.htaccess Essential Tricks For Blog/Website Performance &#8211; Guide</a></li><li><a href="http://www.phpmagicbook.com/upload-max-filesize-large-file-uploads/" title="Upload Max Filesize &#8211; Large File Uploads in PHP">Upload Max Filesize &#8211; Large File Uploads in PHP</a></li><li><a href="http://www.phpmagicbook.com/find-screen-resolution-with-php/" title="Find Screen Resolution With PHP">Find Screen Resolution With PHP</a></li><li><a href="http://www.phpmagicbook.com/browser-check-with-php/" title="Browser Check With PHP">Browser Check With PHP</a></li><li><a href="http://www.phpmagicbook.com/php-file-append/" title="PHP &#8211; File Append">PHP &#8211; File Append</a></li><li><a href="http://www.phpmagicbook.com/php-file-delete-unlink-function/" title="PHP &#8211; File Delete &#8211; Unlink Function">PHP &#8211; File Delete &#8211; Unlink Function</a></li><li><a href="http://www.phpmagicbook.com/php-file-read/" title="PHP &#8211; File Read">PHP &#8211; File Read</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-file-upload-script-globals-off/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Display Records In Multiple Coulmns</title>
		<link>http://www.phpmagicbook.com/display-records-in-multiple-coulmns/</link>
		<comments>http://www.phpmagicbook.com/display-records-in-multiple-coulmns/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 12:34:06 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Useful Scripts]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[multiple columns]]></category>
		<category><![CDATA[split]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=281</guid>
		<description><![CDATA[We can display data fetched from database in a variety of ways. Depends upon our requirement. By multiple columns I mean dividing all fetches data into columns and displaying it. Here is how We can divide the resultset into multiple columns. Spliting Data into 3 Columns &#60;?php // Selecting Data From Database $sql=&#34;select * from [...]<p><a href="http://www.phpmagicbook.com/display-records-in-multiple-coulmns/">Display Records In Multiple Coulmns</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>We can display data fetched from database in a variety of ways. Depends upon our requirement. By multiple columns I mean dividing all fetches data into columns and displaying it. Here is how We can divide the resultset into multiple columns.</p>
<p><span id="more-281"></span></p>
<h4>Spliting Data into 3 Columns</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Selecting Data From Database</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;select * from tableName order by id desc&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$check</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//total number of records set in database</span>
<span style="color: #000088;">$no</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// start loop</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$no</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// Here and at the bottom where loop finishes 3 is the value which will split the fetched data into three columns</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">%</span><span style="color:#800080;">3</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span><span style="color: #0000ff;">&quot;&lt;tr&gt;&lt;td&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Display data fetched</span>
<span style="color: #b1b100;">print</span> <span style="color: #990000;">mysql_result</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">+</span><span style="color: #000088;">$i</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">%</span><span style="color:#800080;">3</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>By changing value 3 which is at the beginning and end of loop, you should be able to split the fetched data in multiple columns as required. Although the above example can serve the purpose of displaying data into many columns as you want but I would like to share another example which is for 2 columns.</p>
<h4>Spliting data into Two Columns &#8211; Second Way</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//it tells the data what collumn to go to</span>
<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$column</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;select * from tabbeName ORDER by id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//loop statement</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$myrow</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// this is the column 1</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$column</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;tr&gt;&lt;td width='320px' class='onebrd2cover'&gt;&lt;font color='#999999'&gt;<span style="color: #006699; font-weight: bold;">$count</span>.&lt;/font&gt; &lt;a href='pageName.php?mid=<span style="color: #006699; font-weight: bold;">$myrow[catid]</span>'&gt;<span style="color: #009933; font-weight: bold;">%s</span>&lt;/a&gt;&lt;/td&gt;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$myrow</span><span style="color: #009900;">&#91;</span>catname<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//this  is the column 2</span>
<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;td width='320px' class='onebrd2'&gt;&lt;font color='#999999'&gt;<span style="color: #006699; font-weight: bold;">$count</span>.&lt;/font&gt; &lt;a href='pageName.php?mid=<span style="color: #006699; font-weight: bold;">$myrow[catid]</span>'&gt;<span style="color: #009933; font-weight: bold;">%s</span>&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$myrow</span><span style="color: #009900;">&#91;</span>catname<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//increment the count</span>
<span style="color: #000088;">$count</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// this is a modulus operator it gets the remainder of the equation</span>
<span style="color: #000088;">$column</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$count</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/display-records-in-multiple-coulmns/">Display Records In Multiple Coulmns</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/provide-rss-feed-for-each-post-and-comment-at-your-wordpress-blog/" title="Provide RSS Feed for Each Post and Comment at Your WordPress Blog">Provide RSS Feed for Each Post and Comment at Your WordPress Blog</a></li><li><a href="http://www.phpmagicbook.com/protect-hotlink-the-right-way-using-htaccess/" title="Protect Hotlink the Right Way Using htaccess">Protect Hotlink the Right Way Using htaccess</a></li><li><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/" title="PHP File Upload Script &#8211; Globals Off">PHP File Upload Script &#8211; Globals Off</a></li><li><a href="http://www.phpmagicbook.com/for-loop/" title="For Loop in PHP">For Loop in PHP</a></li><li><a href="http://www.phpmagicbook.com/only-allow-your-ip-to-access-website-or-blog-admin/" title="Only Allow Your IP to Access Website or Blog Admin">Only Allow Your IP to Access Website or Blog Admin</a></li><li><a href="http://www.phpmagicbook.com/change-prosilver-header-logo-phpbb/" title="Change Prosilver Header and Logo in PHPBB &#8211; Working Solution">Change Prosilver Header and Logo in PHPBB &#8211; Working Solution</a></li><li><a href="http://www.phpmagicbook.com/php-echo/" title="PHP Echo in PHP">PHP Echo in PHP</a></li><li><a href="http://www.phpmagicbook.com/how-to-include-specific-file-in-wordpress-blog-template/" title="How to Include Specific File In WordPress Blog Template">How to Include Specific File In WordPress Blog Template</a></li><li><a href="http://www.phpmagicbook.com/php-functions/" title="PHP Functions">PHP Functions</a></li><li><a href="http://www.phpmagicbook.com/allow-htaccess-and-mod-rewrite-in-wamp/" title="Allow htaccess and Mod Rewrite in Wamp">Allow htaccess and Mod Rewrite in Wamp</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/display-records-in-multiple-coulmns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browser Check With PHP</title>
		<link>http://www.phpmagicbook.com/browser-check-with-php/</link>
		<comments>http://www.phpmagicbook.com/browser-check-with-php/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 02:18:01 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Checks]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[Explorer]]></category>
		<category><![CDATA[PHP Basics]]></category>
		<category><![CDATA[php scripts]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=194</guid>
		<description><![CDATA[Use this simple test for checking or detecting user&#8217;s browser information. &#60;?php // browser test if &#40;strpos&#40;$_SERVER&#91;'HTTP_USER_AGENT'&#93;, 'MSIE'&#41; !== FALSE&#41; &#123; echo 'You are using Internet Explorer.&#60;br /&#62; Get FireFox for better browsing.&#60;br /&#62;'; &#125; else &#123; echo 'You are &#60;strong&#62;NOT&#60;/strong&#62; using Internet Explorer.&#60;br /&#62; Good for you.&#60;br /&#62;'; &#125; ?&#62; &#160; &#60;?php // for [...]<p><a href="http://www.phpmagicbook.com/browser-check-with-php/">Browser Check With PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Use this simple test for checking or detecting user&#8217;s browser information.</p>
<p><span id="more-256"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// browser test</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MSIE'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'You are using Internet Explorer.&lt;br /&gt;
   Get FireFox for better browsing.&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'You are &lt;strong&gt;NOT&lt;/strong&gt; using Internet Explorer.&lt;br /&gt;
Good for you.&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// for browser info</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Or simply.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// browser test</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MSIE'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;firefox&quot;&gt;
Oyi...! Internet Explorer's dangerous... Get Firefox for safe and fast browsing... &lt;a href=&quot;link&quot;&gt;Click heya to get the FF&lt;/a&gt;
&lt;/div&gt;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can put this css in head section of web page for warning message. And put above php script at the top of all your web page content.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
&lt;!--
<span style="color: #6666ff;">.firefox</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">11px</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f8eada</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">visibility</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#f2d9bd</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">11px</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.firefox</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">11px</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff6600</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.firefox</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">11px</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
--<span style="color: #00AA00;">&gt;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/08/browser-test.rar' class="download">Download Browser Test Example</a></p>
<p><a href="http://www.phpmagicbook.com/browser-check-with-php/">Browser Check With PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/htaccess-essential-tricks-for-blog-website-performance-a-guide/" title=".htaccess Essential Tricks For Blog/Website Performance &#8211; Guide">.htaccess Essential Tricks For Blog/Website Performance &#8211; Guide</a></li><li><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/" title="PHP File Upload Script &#8211; Globals Off">PHP File Upload Script &#8211; Globals Off</a></li><li><a href="http://www.phpmagicbook.com/php-is-not-secure/" title="PHP is Not Secure">PHP is Not Secure</a></li><li><a href="http://www.phpmagicbook.com/protect-php-dot-ini-file-from-being-viewed/" title="Protect php dot ini file from being viewed">Protect php dot ini file from being viewed</a></li><li><a href="http://www.phpmagicbook.com/php-essential-security-fixes-for-your-website/" title="PHP Essential Security Fixes For Your Website">PHP Essential Security Fixes For Your Website</a></li><li><a href="http://www.phpmagicbook.com/show-a-part-of-string-substr/" title="Show A Part Of String &#8211; substr in PHP">Show A Part Of String &#8211; substr in PHP</a></li><li><a href="http://www.phpmagicbook.com/text-to-image-using-php/" title="Text To Image Using PHP">Text To Image Using PHP</a></li><li><a href="http://www.phpmagicbook.com/find-visitor-browser-info-using-php/" title="Find Visitor Browser Info Using PHP">Find Visitor Browser Info Using PHP</a></li><li><a href="http://www.phpmagicbook.com/find-screen-resolution-with-php/" title="Find Screen Resolution With PHP">Find Screen Resolution With PHP</a></li><li><a href="http://www.phpmagicbook.com/function-existence-check/" title="Function Existence Check Using PHP">Function Existence Check Using PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/browser-check-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP AJAX Email Form</title>
		<link>http://www.phpmagicbook.com/php-ajax-email-form/</link>
		<comments>http://www.phpmagicbook.com/php-ajax-email-form/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 04:39:43 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Ajax & PHP]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Email Systems]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ajax php email]]></category>
		<category><![CDATA[php email]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=191</guid>
		<description><![CDATA[Send emails using PHP and AJAX. Its a complete AJAX PHP based email solution. Just download it and give it a try. Do not forget to change recipient&#8217;s email address in - scripts/contact.php and - scripts/xmlHttpRequest.php and you are done. Download Ajax PHP Based Email Solution PHP AJAX Email Form is a post from: PHP [...]<p><a href="http://www.phpmagicbook.com/php-ajax-email-form/">PHP AJAX Email Form</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.phpmagicbook.com/wp-content/uploads/2008/06/ajax-frm-mail.jpg" alt="" title="Send Emails Via AJAX And PHP - AJAX Email Form - PHP Email" width="400" height="388" class="aligncenter size-full wp-image-192" /></p>
<p>Send emails using PHP and AJAX. Its a complete AJAX PHP based email solution. Just download it and give it a try.</p>
<p><span id="more-255"></span></p>
<p>Do not forget to change recipient&#8217;s email address in<br />
- scripts/contact.php<br />
and<br />
- scripts/xmlHttpRequest.php<br />
and you are done.</p>
<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/ajaxform.rar' class="download">Download Ajax PHP Based Email Solution</a></p>
<p><a href="http://www.phpmagicbook.com/php-ajax-email-form/">PHP AJAX Email Form</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/sending-email-with-php/" title="Sending eMail Using PHP">Sending eMail Using PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-ajax-email-form/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Function Existence Check Using PHP</title>
		<link>http://www.phpmagicbook.com/function-existence-check/</link>
		<comments>http://www.phpmagicbook.com/function-existence-check/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 03:55:23 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Checks]]></category>
		<category><![CDATA[Function Exists]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[Functions]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=188</guid>
		<description><![CDATA[function_exists &#8212; Return TRUE if the given function has been defined. To check that whether a function is defined or exists or not use function_exists. Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. Returns TRUE on success or FALSE on failure. &#60;?php if &#40;function_exists&#40;'imap_open'&#41;&#41; &#123; echo &#34;IMAP functions are available.&#60;br [...]<p><a href="http://www.phpmagicbook.com/function-existence-check/">Function Existence Check Using PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>function_exists &#8212;  Return TRUE if the given function has been defined. To check that whether a function is defined or exists or not use function_exists. Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. Returns TRUE on success or FALSE on failure.</p>
<p><span id="more-252"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'imap_open'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;IMAP functions are available.&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;IMAP functions are not available.&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/function-existence-check/">Function Existence Check Using PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/" title="PHP File Upload Script &#8211; Globals Off">PHP File Upload Script &#8211; Globals Off</a></li><li><a href="http://www.phpmagicbook.com/htaccess-essential-tricks-for-blog-website-performance-a-guide/" title=".htaccess Essential Tricks For Blog/Website Performance &#8211; Guide">.htaccess Essential Tricks For Blog/Website Performance &#8211; Guide</a></li><li><a href="http://www.phpmagicbook.com/show-a-part-of-string-substr/" title="Show A Part Of String &#8211; substr in PHP">Show A Part Of String &#8211; substr in PHP</a></li><li><a href="http://www.phpmagicbook.com/find-screen-resolution-with-php/" title="Find Screen Resolution With PHP">Find Screen Resolution With PHP</a></li><li><a href="http://www.phpmagicbook.com/browser-check-with-php/" title="Browser Check With PHP">Browser Check With PHP</a></li><li><a href="http://www.phpmagicbook.com/php-implode/" title="PHP &#8211; Implode">PHP &#8211; Implode</a></li><li><a href="http://www.phpmagicbook.com/php-explode/" title="PHP &#8211; Explode">PHP &#8211; Explode</a></li><li><a href="http://www.phpmagicbook.com/php-functions/" title="PHP Functions">PHP Functions</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/function-existence-check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; String Case &#8211; Capitalization</title>
		<link>http://www.phpmagicbook.com/php-string-case-capitalization/</link>
		<comments>http://www.phpmagicbook.com/php-string-case-capitalization/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 23:33:18 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Capitalization]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[String Case]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[php case]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=179</guid>
		<description><![CDATA[String to Upper Case &#8211; strtoupper The strtoupper function takes one argument, the string you want converted to upper case and returns the converted string. Only letters of the alphabet are changed, numbers will remain the same. &#60;?php $originalString = &#34;String Capitalization 5654&#34;; $upperCase = strtoupper&#40;$originalString&#41;; echo &#34;Old string - $originalString &#60;br /&#62;&#34;; echo &#34;New [...]<p><a href="http://www.phpmagicbook.com/php-string-case-capitalization/">PHP &#8211; String Case &#8211; Capitalization</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<h4>String to Upper Case &#8211; strtoupper</h4>
<p>The strtoupper function takes one argument, the string you want converted to upper case and returns the converted string. Only letters of the alphabet are changed, numbers will remain the same.</p>
<p><span id="more-246"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$originalString</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String Capitalization 5654&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$upperCase</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$originalString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Old string - <span style="color: #006699; font-weight: bold;">$originalString</span> &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;New String - <span style="color: #006699; font-weight: bold;">$upperCase</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Output:</span>
<span style="color: #666666; font-style: italic;">// New String - STRING CAPITALIZATION 5654</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>String to lower Case &#8211; strtolower</h4>
<p>The strtolower function also has one argument: the string that will be converted to lower case.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$originalString</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String Capitalization 1234&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lowerCase</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$originalString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Old string - <span style="color: #006699; font-weight: bold;">$originalString</span> &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;New String - <span style="color: #006699; font-weight: bold;">$lowerCase</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Output:</span>
<span style="color: #666666; font-style: italic;">// New String - string capitalization 1234</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>Capitalizing the First Letter &#8211; ucwords</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$titleString</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;a title that could use some hELP&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ucTitleString</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ucwords</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$titleString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Old title - <span style="color: #006699; font-weight: bold;">$titleString</span> &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;New title - <span style="color: #006699; font-weight: bold;">$ucTitleString</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Output:</span>
<span style="color: #666666; font-style: italic;">// New Title - New title - A Title That Could Use Some HELP</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/php-string-case-capitalization/">PHP &#8211; String Case &#8211; Capitalization</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/find-page-url-php/" title="Find Page URL With PHP &#8211; File Path">Find Page URL With PHP &#8211; File Path</a></li><li><a href="http://www.phpmagicbook.com/php-post-and-get/" title="PHP Post And Get">PHP Post And Get</a></li><li><a href="http://www.phpmagicbook.com/php-arrays/" title="PHP Arrays">PHP Arrays</a></li><li><a href="http://www.phpmagicbook.com/php-strings/" title="PHP Strings">PHP Strings</a></li><li><a href="http://www.phpmagicbook.com/local-and-glob-scope/" title="Local And Global Variable Scope in PHP">Local And Global Variable Scope in PHP</a></li><li><a href="http://www.phpmagicbook.com/php-logical-operators/" title="PHP Logical Operators">PHP Logical Operators</a></li><li><a href="http://www.phpmagicbook.com/php-functions/" title="PHP Functions">PHP Functions</a></li><li><a href="http://www.phpmagicbook.com/php-for-each-loop/" title="PHP ForEach Loop">PHP ForEach Loop</a></li><li><a href="http://www.phpmagicbook.com/php-do-while-loop/" title="PHP Do While Loop">PHP Do While Loop</a></li><li><a href="http://www.phpmagicbook.com/php-while-loop/" title="PHP While Loop">PHP While Loop</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-string-case-capitalization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Data As An Array &#8211; Download PHP Example</title>
		<link>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/</link>
		<comments>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 18:38:22 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Arrays]]></category>
		<category><![CDATA[For Loop]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[Loops]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=167</guid>
		<description><![CDATA[Array &#038; Loop Example Suppose we have a form and we want from user to select from a list of check boxes and check his favorite choices, post that data as an array and we want to display that data by calling array and arranging it in a loop. Then for this purpose consider following [...]<p><a href="http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/">Get Data As An Array &#8211; Download PHP Example</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<h4>Array &#038; Loop Example</h4>
<p>Suppose we have a form and we want from user to select from a list of check boxes and check his favorite choices, post that data as an array and we want to display that data by calling array and arranging it in a loop. Then for this purpose consider following example.</p>
<p><span id="more-237"></span></p>
<h4>Form Code</h4>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;Arrays example&lt;/p&gt;
&lt;p&gt;Check your favorite Movies:
&lt;/p&gt;
&lt;form action=&quot;nextpagename.php&quot; method=&quot;post&quot; name=&quot;array-form&quot; id=&quot;array-form&quot;&gt;
  &lt;p&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Harry Potter&quot;&gt;
    Harry Potter&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;The Hobbit&quot;&gt;
    The Hobbit&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Lord Of Rings&quot;&gt;
    Lord Of Rings&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Matrix&quot;&gt;
    Matrix&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Happy Feet&quot;&gt;
    Happy Feet&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;The Hell Boy&quot;&gt;
    The Hell Boy&lt;br /&gt;
    &lt;input name=&quot;pick[]&quot; type=&quot;checkbox&quot; value=&quot;Hulk&quot;&gt;
    Hulk&lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;
    &lt;input type=&quot;submit&quot; name=&quot;button&quot; id=&quot;button&quot; value=&quot;Submit&quot;&gt;
    &lt;/label&gt;
&lt;/p&gt;
&lt;/form&gt;</pre></div></div>

<h4>PHP Code &#8211; Retrieve Data From Array and Display It Through A Loop</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pick'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$displaydata</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pick'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$displaydata</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In the above example we have collected the data from check boxes in form of arrays named as <strong>pick[]</strong> and we have sent it to another PHP page where it is displayed through a for loop.</p>
<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/array-example.rar' class="download">PHP Arrays Example Download</a></p>
<p><a href="http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/">Get Data As An Array &#8211; Download PHP Example</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-for-loop/" title="PHP For Loop">PHP For Loop</a></li><li><a href="http://www.phpmagicbook.com/php-arrays/" title="PHP Arrays">PHP Arrays</a></li><li><a href="http://www.phpmagicbook.com/php-for-each-loop/" title="PHP ForEach Loop">PHP ForEach Loop</a></li><li><a href="http://www.phpmagicbook.com/php-do-while-loop/" title="PHP Do While Loop">PHP Do While Loop</a></li><li><a href="http://www.phpmagicbook.com/php-while-loop/" title="PHP While Loop">PHP While Loop</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/get-data-as-an-array-download-php-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>For Loop in PHP</title>
		<link>http://www.phpmagicbook.com/for-loop/</link>
		<comments>http://www.phpmagicbook.com/for-loop/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 00:10:13 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Loops]]></category>
		<category><![CDATA[Randomizing]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[loop]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=130</guid>
		<description><![CDATA[I am describing for loop with an example that include randomizing number display using images from a directory. Use following script and create a folder nb and put images 0.gif, 1.gif, &#8230; , 9.gif containing same digit over each and see. PHP Code &#60;?php $mynumber= rand&#40;1111111111,9999999999&#41;; // echo $mynumber; $ilength=strlen&#40;$mynumber&#41;; for&#40;$i=0; $i&#60;$ilength; $i++&#41; &#123; $ipic= [...]<p><a href="http://www.phpmagicbook.com/for-loop/">For Loop in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.phpmagicbook.com/wp-content/uploads/2008/06/random-numbers-for-loop.jpg" alt="for loop" title="For Loop" width="400" height="42" class="aligncenter size-full wp-image-131" /></p>
<p>I am describing for loop with an example that include randomizing number display using images from a directory. Use following script and create a folder nb and put images 0.gif, 1.gif, &#8230; , 9.gif containing same digit over each and see.</p>
<p><span id="more-205"></span></p>
<h4>PHP Code</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$mynumber</span><span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1111111111</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9999999999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// echo $mynumber;</span>
<span style="color: #000088;">$ilength</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mynumber</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$ilength</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$ipic</span><span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mynumber</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sFilePath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nb/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ipic</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.gif&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000088;">$sFilePath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;nb/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ipic</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.gif&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span> <span style="color: #000088;">$sFilePath</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/for-loop-rand-numbers.rar' class="download">For Loop Rand Numbers Script Download</a></p>
<p><a href="http://www.phpmagicbook.com/for-loop/">For Loop in PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-sessions/" title="PHP &#8211; Sessions">PHP &#8211; Sessions</a></li><li><a href="http://www.phpmagicbook.com/local-and-glob-scope/" title="Local And Global Variable Scope in PHP">Local And Global Variable Scope in PHP</a></li><li><a href="http://www.phpmagicbook.com/php-file-delete-unlink-function/" title="PHP &#8211; File Delete &#8211; Unlink Function">PHP &#8211; File Delete &#8211; Unlink Function</a></li><li><a href="http://www.phpmagicbook.com/add-view-delete-record/" title="Add, View, Delete Record Using PHP">Add, View, Delete Record Using PHP</a></li><li><a href="http://www.phpmagicbook.com/random-flash-swf-onload-php-script/" title="Random Flash SWF Onload PHP Script">Random Flash SWF Onload PHP Script</a></li><li><a href="http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/" title="Change Color Theme With PHP &#8211; CSS Switch">Change Color Theme With PHP &#8211; CSS Switch</a></li><li><a href="http://www.phpmagicbook.com/how-to-display-some-content-at-homepage-single-post-of-blog/" title="How To Display Some Content at Just Home Page and Single Post of Blog">How To Display Some Content at Just Home Page and Single Post of Blog</a></li><li><a href="http://www.phpmagicbook.com/file-upload-with-renaming/" title="File Upload With Renaming Using PHP">File Upload With Renaming Using PHP</a></li><li><a href="http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/" title="Quick Edit &#8211; Little File Based PHP CMS">Quick Edit &#8211; Little File Based PHP CMS</a></li><li><a href="http://www.phpmagicbook.com/include-function-include-a-file-using-php/" title="Include Function &#8211; Include A File Using PHP">Include Function &#8211; Include A File Using PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/for-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Edit &#8211; Little File Based PHP CMS</title>
		<link>http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/</link>
		<comments>http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 17:44:23 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[CMS II]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[File Manipulation]]></category>
		<category><![CDATA[No Database]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[text file based cms]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=114</guid>
		<description><![CDATA[Single php file based whole file handeling and listing PHP CMS which lets you create file or edit file in a fly. No database required. It stores its data in a file. User authentication system is available in it also. You can create users in it and then after login you can create directory or [...]<p><a href="http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/">Quick Edit &#8211; Little File Based PHP CMS</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.phpmagicbook.com/wp-content/uploads/2008/06/cms-text-based-php.jpg" alt="PHP CMS, no database required" title="CMS, Text Based PHP File Handling System" width="400" height="355" class="aligncenter size-full wp-image-115" /></p>
<p>Single php file based whole file handeling and listing PHP CMS which lets you create file or edit file in a fly. No database required. It stores its data in a file. User authentication system is available in it also. You can create users in it and then after login you can create directory or files as well as modify, copy, delete or rename them very easily. A nice file uploader is also available in it.</p>
<p><span id="more-197"></span></p>
<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/create-dir_file_edit_upload.rar' class="download">Quick Edit PHP File Based CMS Download</a></p>
<p><a href="http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/">Quick Edit &#8211; Little File Based PHP CMS</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-creating-a-file/" title="Creating A File Using PHP">Creating A File Using PHP</a></li><li><a href="http://www.phpmagicbook.com/add-view-delete-record/" title="Add, View, Delete Record Using PHP">Add, View, Delete Record Using PHP</a></li><li><a href="http://www.phpmagicbook.com/social-cms-digg-mixx-reddit/" title="Free Social CMS like Digg, Mixx, Reddit">Free Social CMS like Digg, Mixx, Reddit</a></li><li><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/" title="PHP File Upload Script &#8211; Globals Off">PHP File Upload Script &#8211; Globals Off</a></li><li><a href="http://www.phpmagicbook.com/smarty-for-smart-developers/" title="Smarty For Smart Developers">Smarty For Smart Developers</a></li><li><a href="http://www.phpmagicbook.com/get-file-size-and-file-type-in-php/" title="Get File Size and File Type In PHP">Get File Size and File Type In PHP</a></li><li><a href="http://www.phpmagicbook.com/php-file-append/" title="PHP &#8211; File Append">PHP &#8211; File Append</a></li><li><a href="http://www.phpmagicbook.com/php-file-delete-unlink-function/" title="PHP &#8211; File Delete &#8211; Unlink Function">PHP &#8211; File Delete &#8211; Unlink Function</a></li><li><a href="http://www.phpmagicbook.com/php-file-read/" title="PHP &#8211; File Read">PHP &#8211; File Read</a></li><li><a href="http://www.phpmagicbook.com/php-file-write/" title="PHP &#8211; File Write">PHP &#8211; File Write</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/quick-edit-little-file-based-php-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 4.091 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-30 16:33:30 -->
