<?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>iBlog random &#187; php</title>
	<atom:link href="http://blog.zurka.us/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zurka.us</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 28 May 2013 20:28:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>Generate QR Codes with php (EASY)</title>
		<link>http://blog.zurka.us/generate-qr-codes-with-php-easy/</link>
		<comments>http://blog.zurka.us/generate-qr-codes-with-php-easy/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 22:30:19 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qr code]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=1079</guid>
		<description><![CDATA[There you go, a function that will generate a QR Code with the help of a function hosted on the Google API servor. function generate_qr($url, $size =&#039;150&#039;, $imgsize = false, $EC_level=&#039;L&#039;, $margin=&#039;0&#039;) { $url = urlencode($url); return &#039;&#60;img src=&#34;http://chart.apis.google.com/chart?chs=&#039;.$size.&#039;x&#039;.$size.&#38;cht=qr&#38;chld=&#039;.$EC_level.&#039;&#124;&#039;.$margin.&#039;&#38;chl=&#039;.$url.&#039;&#34; alt=&#34;QR code&#34; width=&#34;&#039;.($imgsize ? $imgsize : $size).&#039;&#34; height=&#34;&#039;.($imgsize ? $imgsize : $size).&#039;&#34; /&#62;&#039;; } You call [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fgenerate-qr-codes-with-php-easy%2F&title=Generate+QR+Codes+with+php+%28EASY%29&desc=There+you+go%2C+a+function+that+will+generate+a+QR+Code+with+the+help+of+a+function+hosted+on+the+Google+API+servor.+function+generate_qr%28%24url%2C+%24size+%3D%27150%27%2C+%24imgsize+%3D+false%2C+%24EC_level%3D%27L%27%2C+%24margin%3D%270%27%29+%7B+%24url+%3D+urlencode%28%24url%29%3B+return+%27%27%3B+%7D+You+call+it+like+this%3A+And+get+something+like+this%3A+Try&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>There you go, a function that will generate a QR Code with the help of a function hosted on the Google API servor.</p>
<pre class="brush: php">function generate_qr($url, $size =&#039;150&#039;, $imgsize = false, $EC_level=&#039;L&#039;, $margin=&#039;0&#039;) {
    $url = urlencode($url);
    return &#039;&lt;img src=&quot;http://chart.apis.google.com/chart?chs=&#039;.$size.&#039;x&#039;.$size.&amp;cht=qr&amp;chld=&#039;.$EC_level.&#039;|&#039;.$margin.&#039;&amp;chl=&#039;.$url.&#039;&quot; alt=&quot;QR code&quot; width=&quot;&#039;.($imgsize ? $imgsize : $size).&#039;&quot; height=&quot;&#039;.($imgsize ? $imgsize : $size).&#039;&quot; /&gt;&#039;;
}</pre>
<p>You call it like this: </p>
<pre class="brush: php">&lt;?php echo generate_qr(&#039;http://blog.zurka.us&#039;); ?&gt;</pre>
<p>And get something like this:</p>
<p><img src="http://chart.apis.google.com/chart?chs=150x150&#038;cht=qr&#038;chld=L|0&#038;chl=http://blog.zurka.us" alt="blog.zurka.us qr code" /></p>
<p>Try pointing your favorite <a href="http://www.qrme.co.uk/qr-code-resources/qr-code-readers.html">code reader</a> at it!</p>
<p>PS: I just noticed that it doesn&#8217;t work well because of the dark background, <a href="http://chart.apis.google.com/chart?chs=150x150&#038;cht=qr&#038;chld=L|0&#038;chl=http://blog.zurka.us">try it here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/generate-qr-codes-with-php-easy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL variant for PHP&#8217;s in_array</title>
		<link>http://blog.zurka.us/mysql-variant-for-phps-in_array/</link>
		<comments>http://blog.zurka.us/mysql-variant-for-phps-in_array/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 13:54:56 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=1021</guid>
		<description><![CDATA[So you have an array, let&#8217;s call it $array. $array = array(&#039;one&#039;, &#039;two&#039;, &#039;three&#039;); And you want to do a MySQL query that will check if one of the values in the array are present or similar or whatever. In PHP it would look like this: if (in_array(&#039;one&#039;, $array)) and it would return true. Now [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fmysql-variant-for-phps-in_array%2F&title=MySQL+variant+for+PHP%27s+in_array&desc=So+you+have+an+array%2C+let%27s+call+it+%24array.+%24array+%3D+array%28%27one%27%2C+%27two%27%2C+%27three%27%29%3B+And+you+want+to+do+a+MySQL+query+that+will+check+if+one+of+the+values+in+the+array+are+present+or+similar+or+whatever.+In+PHP+it+would+look+like+this%3A+if+%28in_array%28%27one%27%2C+%24array%29%29+and+it+would+return+true.+Now+to+do&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>So you have an array, let&#8217;s call it $array.</p>
<pre class="brush: php">$array = array(&#039;one&#039;, &#039;two&#039;, &#039;three&#039;);</pre>
<p>And you want to do a MySQL query that will check if one of the values in the array are present or similar or whatever. In PHP it would look like this:</p>
<pre class="brush: php">if (in_array(&#039;one&#039;, $array))</pre>
<p>and it would return true. Now to do this in MySQL we can use (along other things but I use this one) the <strong>IN</strong> statement.</p>
<pre class="brush: php">
mysql_query(&#039;select something from table where one IN (&quot;&#039; . implode(&#039;&quot;,&quot;&#039;, $array) . &#039;&quot;)&#039;);
</pre>
<p>Why is this useful? Let&#8217;s say you&#8217;ve got an array of file extensions (pictures) and you have a database with some files in it, pictures, music, videos. You want to display only the pictures, because you want to display the last 15 uploaded pictures. Let&#8217;s say you have the filename and extension (filename = hack.jpg) stored in your database. Let&#8217;s see an example of what you could do&#8230;</p>
<pre class="brush: php">
mysql_query(&#039;select id, name, filename from uploads where substr(filename, -3) IN (&quot;&#039; . implode(&#039;&quot;,&quot;&#039;, $pics) . &#039;&quot;) order by id desc limit 12&#039;);
</pre>
<p>And that&#8217;s it. Easy peasy!</p>
<p>Have swing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/mysql-variant-for-phps-in_array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fetch MP3 Tags from Last.fm Using PHP</title>
		<link>http://blog.zurka.us/fetch-mp3-tags-from-last-fm-using-php/</link>
		<comments>http://blog.zurka.us/fetch-mp3-tags-from-last-fm-using-php/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:20:08 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=1014</guid>
		<description><![CDATA[Today I&#8217;m gonna show you a script that I did for a project of mine that fetches the tags from LastFM and updates the database inserting the top 5 tags from their database and leaves your tags as they are. I believe it could be a lot less messy but I am too lazy to [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Ffetch-mp3-tags-from-last-fm-using-php%2F&title=Fetch+MP3+Tags+from+Last.fm+Using+PHP&desc=Today+I%27m+gonna+show+you+a+script+that+I+did+for+a+project+of+mine+that+fetches+the+tags+from+LastFM+and+updates+the+database+inserting+the+top+5+tags+from+their+database+and+leaves+your+tags+as+they+are.+I+believe+it+could+be+a+lot+less+messy+but+I+am+too+lazy+to+make+it+more+understandable+%3AD+You&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>Today I&#8217;m gonna show you a script that I did for a project of mine that fetches the tags from LastFM and updates the database inserting the top 5 tags from their database and leaves your tags as they are.</p>
<p>I believe it could be a lot less messy but I am too lazy to make it more understandable <img src='http://blog.zurka.us/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  You update the tags using yoursite.com/?autotag=id (of the song from your database). You could as easily do a loop and update every song in the database. But why would you <img src='http://blog.zurka.us/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  So let&#8217;s go with my messy code!</p>
<p>Ps: you must get your API key on <a href="http://last.fm/api">their site</a>.</p>
<p>.</p>
<pre class="brush: php">
$f = mysql_fetch_assoc(mysql_query(&#039;select name, tags from songs where id = &quot;&#039; . $_GET[&#039;autotag&#039;] . &#039;&quot;&#039;));
$e = explode(&#039;-&#039;, $f[&#039;name&#039;]);
$url = @simplexml_load_file(&#039;http://ws.audioscrobbler.com/2.0/?method=track.getinfo&amp;api_key=YOUR API KEY&amp;artist=&#039; . $e[0] . &#039;&amp;track=&#039; . trim($e[1]));
$t_cnt = count($url-&gt;track-&gt;toptags-&gt;tag);
$t = explode(&#039;,&#039;, $f[&#039;tags&#039;]);
$tags = array();
for ($i = 0; $i &lt; count($t); $i++) {
    if ($t[$i] != &#039;&#039;) $tags[] .= trim($t[$i]);
}
for($j = 0; $j &lt; $t_cnt; $j++) {
    array_push($tags, (string)$url-&gt;track-&gt;toptags-&gt;tag[$j]-&gt;name);
}
$tags = array_unique($tags);
$ct = count($tags);
for ($k = 0; $k &lt;= $ct; $k++) {
    if ($tags[$k] != &#039;&#039;) $tagss .= ($k &gt;= 1 ? &#039;, &#039; : &#039;&#039;) . $tags[$k];
}
//mysql_query(&#039;update songs set tags = &quot;&#039; . $tagss . &#039;&quot; where id = &quot;&#039; . $_GET[&#039;autotag&#039;] . &#039;&quot;&#039;);
exit($tagss);
</pre>
<p>It reads the name of the song from the database. The name should be <strong>Artist &#8211; Title</strong>, as it then explodes this at the &#8211; and presumes the first piece is the artist and the second is the title of the song. This are the info that LastFM wants you to include in the URL if you want to get the song info.</p>
<p>Next, we read the xml file with the song information. We explode our preexistent tags from the database and we count the tags in the xml file.</p>
<p>We create a new array $tags, which will include our preexistent tags (should be separated by commas (,)). We push our tags into it and then we push the tags from LastFM into it.</p>
<p>We use the array_unique function to delete duplicate tags, if there are any. When we finish doing that, we echo the tags into a new variable, $tagss.</p>
<p>At the end, we could update the database entry (if you uncomment the commented line) or just exit the function and echo our new $tagss variable.</p>
<p>That&#8217;s it, hope you understood anything.</p>
<p>Have swing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/fetch-mp3-tags-from-last-fm-using-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Help me Test my Mailing List System</title>
		<link>http://blog.zurka.us/help-me-test-my-mailing-list-system/</link>
		<comments>http://blog.zurka.us/help-me-test-my-mailing-list-system/#comments</comments>
		<pubDate>Thu, 28 May 2009 10:55:15 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mailing list]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=942</guid>
		<description><![CDATA[I&#8217;m developing my very own mailing list system and need you to help me test it All you have to do is subscribe to it on the right, it is free, quick and doesn&#8217;t hurt (you will also get a verification email, which you should check and click the link included). Since it&#8217;s new I [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fhelp-me-test-my-mailing-list-system%2F&title=Help+me+Test+my+Mailing+List+System&desc=I%27m+developing+my+very+own+mailing+list+system+and+need+you+to+help+me+test+it+%3A%29+All+you+have+to+do+is+subscribe+to+it+on+the+right%2C+it+is+free%2C+quick+and+doesn%27t+hurt+%28you+will+also+get+a+verification+email%2C+which+you+should+check+and+click+the+link+included%29.+Since+it%27s+new+I+need+a+lot+of+people&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>I&#8217;m developing my very own mailing list system and need you to help me test it <img src='http://blog.zurka.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  All you have to do is subscribe to it on the right, it is free, quick and doesn&#8217;t hurt (you will also get a verification email, which you should check and click the link included).</p>
<p>Since it&#8217;s new I need a lot of people to test the mail queuing and other stuff.</p>
<p>If you would like to be a beta tester (:D), test it and create your own campaigns I can give you access for free.</p>
<p>It is something like <a href="http://www.aweber.com/">aweber</a> but since I don&#8217;t have access to it I&#8217;m developing it on my own, differently.</p>
<p><strong>Features in v0.3</strong></p>
<p>- add and edit campaigns<br />
- subscribe, verify and unsubscribe<br />
- an automatic email is sent on subscription and verification<br />
- possibility to send an email to every subscriber in the campaign<br />
- you can add links so you can track clicks on them<br />
- email scheduling<br />
- email importing (deletes duplicates and incorrect addresses)<br />
- possibility of embedding the subscription form anywhere<br />
- possibility of redirecting the user to your own thank you page on subscription<br />
- possibility of sending attachments<br />
- html support<br />
- you can attach a file to send when the user verifies his email<br />
- teoretically the mail queue should work if you try to send an email to more then 50 users, but it is untested</p>
<p>Wanna test? Drop a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/help-me-test-my-mailing-list-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make Your Titles Dynamic with PHP</title>
		<link>http://blog.zurka.us/make-your-titles-dynamic-with-php/</link>
		<comments>http://blog.zurka.us/make-your-titles-dynamic-with-php/#comments</comments>
		<pubDate>Tue, 26 May 2009 15:25:00 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Whatever]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=938</guid>
		<description><![CDATA[When developing your website, if you want to rank well in search engines it is crucial that you use different titles for every sub-page you&#8217;ve got online. This is because these search engines (Google, MSN etc) love your titles and categorize your site based on them. This is good for SEO. This is a simple [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fmake-your-titles-dynamic-with-php%2F&title=Make+Your+Titles+Dynamic+with+PHP&desc=When+developing+your+website%2C+if+you+want+to+rank+well+in+search+engines+it+is+crucial+that+you+use+different+titles+for+every+sub-page+you%27ve+got+online.+This+is+because+these+search+engines+%28Google%2C+MSN+etc%29+love+your+titles+and+categorize+your+site+based+on+them.+This+is+good+for+SEO.+This+is+a&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>When developing your website, if you want to <strong>rank well</strong> in search engines it is crucial that you use <strong>different titles for every sub-page</strong> you&#8217;ve got online. This is because these search engines (Google, MSN etc) <strong>love your titles</strong> and categorize your site based on them. This is <strong>good for SEO</strong>.</p>
<p>This is a simple thing to accomplish using PHP but it really is very effective. I will put dumb text into them but you should use titles rich with keywords related to your niche.</p>
<pre class="brush: php">
$title = &#039;Welcome to our website!&#039;;
if (key($_REQUEST) == &#039;register&#039;) { $title = &#039;Register now&#039;; }
if (key($_REQUEST) == &#039;404&#039;) { $title = &#039;Error 404: The page is unavailable&#039;; }
if (key($_REQUEST) == &#039;about&#039;) { $title = &#039;Who we are, what we do&#039;; }
if (key($_REQUEST) == &#039;news&#039;) { $title = &#039;Recent news&#039;; }
</pre>
<p>This would work if you are using urls like yoursite.com/?register, ?news etc. What it does is set a variable <strong>$title</strong> which will include the text your define according to the page we are watching. Now we need to display it in our browser.</p>
<pre class="brush: html">
&lt;head&gt;
    &lt;title&gt;&lt;?= $title; ?&gt; - Your Company Name&lt;/title&gt;
&lt;/head&gt;
</pre>
<p>Pretty easy, isn&#8217;t it?</p>
<p>Oh and today I&#8217;ve found a <a href="http://waka.us/nvyzbr"><strong>FREE</strong> product</a> that helps you make some money with google, all you have to pay is less then $3 for shipping and handling and they mail it to you. The offer is only valid for the US though. <a href="http://waka.us/nvyzbr">Click here</a> if you are interested. It can do no harm if you&#8217;re serious about making some money online and $3 really isn&#8217;t something you could not afford!</p>
<p>Have swing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/make-your-titles-dynamic-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use PHP to Fetch an Album Artwork From Amazon</title>
		<link>http://blog.zurka.us/use-php-fetch-artwork-cd-from-amazon/</link>
		<comments>http://blog.zurka.us/use-php-fetch-artwork-cd-from-amazon/#comments</comments>
		<pubDate>Sun, 17 May 2009 22:59:16 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Whatever]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=930</guid>
		<description><![CDATA[It&#8217;s actually pretty easy once you find out how to do it. By having the artist and album name you can fetch the album artwork from Amazon in three different sizes. With php5 it&#8217;s very easy since it has an integrated xml parser. All we have to do is this: $url = simplexml_load_file(&#039;http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&#38;AWSAccessKeyId=12DR2PGAQT303YTEWP02&#38;Operation=ItemSearch&#38;SearchIndex=Music&#38;Artist=ARTIST&#38;ResponseGroup=Images&#38;Keywords=ALBUMNAME&#039;); Please note [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fuse-php-fetch-artwork-cd-from-amazon%2F&title=Use+PHP+to+Fetch+an+Album+Artwork+From+Amazon&desc=It%27s+actually+pretty+easy+once+you+find+out+how+to+do+it.+By+having+the+artist+and+album+name+you+can+fetch+the+album+artwork+from+Amazon+in+three+different+sizes.+With+php5+it%27s+very+easy+since+it+has+an+integrated+xml+parser.+All+we+have+to+do+is+this%3A+%24url+%3D&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>It&#8217;s actually pretty easy once you find out how to do it. By having the artist and album name you can fetch the album artwork from Amazon in three different sizes.</p>
<p>With <strong>php5</strong> it&#8217;s very easy since it has an integrated xml parser. All we have to do is this:<br />
<span id="more-930"></span></p>
<pre class="brush: php">$url = simplexml_load_file(&#039;http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&amp;AWSAccessKeyId=12DR2PGAQT303YTEWP02&amp;Operation=ItemSearch&amp;SearchIndex=Music&amp;Artist=ARTIST&amp;ResponseGroup=Images&amp;Keywords=ALBUMNAME&#039;);</pre>
<p>Please note that in the url I&#8217;ve put <strong>ARTIST</strong> and <strong>ALBUMNAME</strong>, which you should <strong>replace</strong> with what you&#8217;re searching for. Doing so, we get an xml file from which we can display the image like this:</p>
<pre class="brush: php">echo &#039;&lt;img src=&quot;&#039; . $url-&gt;Items-&gt;Item[0]-&gt;LargeImage-&gt;URL . &#039;&quot; /&gt;&#039;;</pre>
<p>If we want the large one, that is. If we would like the medium one we would use MediumImage and SmallImage for the small one.</p>
<p>That&#8217;s it, it&#8217;s very useful if you are organizing your mp3 files or maybe building an online community or something.</p>
<p>Hope it helps somebody! If you find it useful, digg it!</p>
<p><em>ps: I forgot to mention that if you are using php4 this wont work, you will have to use another <a href="http://www.google.com/search?q=php4+xml+parser">xml parser</a> to fetch the image location from the xml provided by Amazon.</em></p>
<p>Have swing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/use-php-fetch-artwork-cd-from-amazon/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Check if A Number is Even or Odd with PHP</title>
		<link>http://blog.zurka.us/check-number-even-odd-php/</link>
		<comments>http://blog.zurka.us/check-number-even-odd-php/#comments</comments>
		<pubDate>Thu, 14 May 2009 15:04:29 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[webmaster]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=921</guid>
		<description><![CDATA[I&#8217;m going to show you a very simple method for finding out if a number is even or odd in php. You could use this for many things but usually this is mostly used when you have a, let&#8217;s say, table and you want to color the background of every second row differently. The php [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fcheck-number-even-odd-php%2F&title=Check+if+A+Number+is+Even+or+Odd+with+PHP&desc=I%27m+going+to+show+you+a+very+simple+method+for+finding+out+if+a+number+is+even+or+odd+in+php.+You+could+use+this+for+many+things+but+usually+this+is+mostly+used+when+you+have+a%2C+let%27s+say%2C+table+and+you+want+to+color+the+background+of+every+second+row+differently.+The+php+code+looks+like+this%3A+if&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>I&#8217;m going to show you a very simple method for finding out if a number is even or odd in php. You could use this for many things but usually this is mostly used when you have a, let&#8217;s say, table and you want to color the background of every second row differently.</p>
<p>The php code looks like this:</p>
<pre class="brush: php">
if ($number % 2) {
    echo &#039;The number is even&#039;;
} else {
    echo &#039;The number is odd&#039;;
}
</pre>
<p>In real life we would use something like this:</p>
<pre class="brush: php">
$i = 0;
while ($something = mysql_fetch_assoc($query)) {
    echo &#039;&lt;div style=&quot;padding: 5px; background: #&#039; . ($i % 2 ? &#039;eee&#039; : &#039;ddd&#039;) . &#039;;&quot;&gt;Content&lt;/div&gt;&#039;;
    $i++;
}
</pre>
<p>And of course, likewise you could check if a number is divisible by another number using this:</p>
<pre class="brush: php">
if ($number % 3 == 0) {
    echo &#039;The number is divisible by 3&#039;;
} else {
    echo &#039;The number is not divisible by 3&#039;;
}
</pre>
<p>Easy peasy, as always!<br />
Have swing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/check-number-even-odd-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Way of Implementing BBCode with PHP</title>
		<link>http://blog.zurka.us/simple-way-of-implementing-bbcode-with-php/</link>
		<comments>http://blog.zurka.us/simple-way-of-implementing-bbcode-with-php/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:46:06 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=916</guid>
		<description><![CDATA[When posting on forums, we usually use BBcode for styling our texts. When developing webpages, if we want to let our users style their profiles but don&#8217;t want to give them permission to style directly with CSS or html (&#60;strong&#62; etc..), we could simply use this piece of code to let them use those BBcodes. [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fsimple-way-of-implementing-bbcode-with-php%2F&title=Simple+Way+of+Implementing+BBCode+with+PHP&desc=When+posting+on+forums%2C+we+usually+use+BBcode+for+styling+our+texts.+When+developing+webpages%2C+if+we+want+to+let+our+users+style+their+profiles+but+don%27t+want+to+give+them+permission+to+style+directly+with+CSS+or+html+%28%26amp%3Blt%3Bstrong%26amp%3Bgt%3B+etc..%29%2C+we+could+simply+use+this+piece+of+code+to+let+them+use&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>When posting on forums, we usually use BBcode for styling our texts. When developing webpages, if we want to let our users style their profiles but don&#8217;t want to give them permission to style directly with CSS or html (&lt;strong&gt; etc..), we could simply use this piece of code to let them use those BBcodes.</p>
<p>Please note that we could do this using REGEX but as I used the word &#8216;simple&#8217; in the title of the post, I&#8217;m going to make it really simple <img src='http://blog.zurka.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The first thing we do is create an array with the tags we are going to use. In my case, my array is $bbcode and I&#8217;m going to use codes in square brackets, just as forum platforms do. Take a look at the code, you will see it really is simple.</p>
<pre class="brush: php">
$bbcode = array(
    &quot;[big]&quot; =&gt; &quot;&lt;big&gt;&quot;,
    &quot;[/big]&quot; =&gt; &quot;&lt;/big&gt;&quot;,
    &quot;[b]&quot; =&gt; &quot;&lt;strong&gt;&quot;,
    &quot;[/b]&quot; =&gt; &quot;&lt;/strong&gt;&quot;,
    &quot;[i]&quot; =&gt; &quot;&lt;em&gt;&quot;,
    &quot;[/i]&quot; =&gt; &quot;&lt;/em&gt;&quot;,
    &quot;[u]&quot; =&gt; &quot;&lt;u&gt;&quot;,
    &quot;[/u]&quot; =&gt; &quot;&lt;/u&gt;&quot;,
    &quot;[img]&quot; =&gt; &quot;&lt;img src=\&quot;&quot;,
    &quot;[/img]&quot; =&gt; &quot;\&quot; border=\&quot;0\&quot; /&gt;&quot;,
    &quot;[sup]&quot; =&gt; &quot;&lt;sup&gt;&quot;,
    &quot;[/sup]&quot; =&gt; &quot;&lt;/sup&gt;&quot;,
    &quot;[sub]&quot; =&gt; &quot;&lt;sub&gt;&quot;,
    &quot;[/sub]&quot; =&gt; &quot;&lt;/sub&gt;&quot;,
    &quot;[quote]&quot; =&gt; &quot;&lt;span class=\&quot;quote\&quot;&gt;&quot;,
    &quot;[/quote]&quot; =&gt; &quot;&lt;/span&gt;&quot;,
);
</pre>
<p>As you can see, for the quotes I use a SPAN element with class=&#8221;quote&#8221; but it could be a DIV as well, since I&#8217;m styling it as a block element in my CSS file.</p>
<p>Next, to change our text into the styled one, all we have to do is use the <a href="http://php.net/strtr">strtr</a> function and use our array as the &#8211; guess what &#8211; array with replace pairs.</p>
<pre class="brush: php">
echo strtr(&#039;Hello. I am [b]bolded[/b], I am [u]underlined[/u] and I am [big]big[/big]!&#039;, $bbcode);
</pre>
<p>That&#8217;s it! As Duke Nukem would say.. piece of cake.</p>
<p>Have swing!</p>
<p>ps. I know it doesn&#8217;t include the useful codes as [url] but for that we should already use regex.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/simple-way-of-implementing-bbcode-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2 Methods for Finding File Extensions in PHP</title>
		<link>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/</link>
		<comments>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:25:31 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=859</guid>
		<description><![CDATA[Two very simple methods for getting to know which is the file extension of the file, using two very simple PHP functions. 1. Method: function end The end function finds the last member of an array. So if we want to get the file extension, we will first explode our filename at the dots (.) [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2F2-methods-for-finding-file-extensions-in-php%2F&title=2+Methods+for+Finding+File+Extensions+in+PHP&desc=Two+very+simple+methods+for+getting+to+know+which+is+the+file+extension+of+the+file%2C+using+two+very+simple+PHP+functions.+1.+Method%3A+function+end+The+end+function+finds+the+last+member+of+an+array.+So+if+we+want+to+get+the+file+extension%2C+we+will+first+explode+our+filename+at+the+dots+%28.%29+and+then&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>Two very simple methods for getting to know which is the file extension of the file, using two very simple PHP functions.</p>
<p><strong>1. Method: function <a href="http://php.net/end">end</a></strong></p>
<p>The end function finds the last member of an array. So if we want to get the file extension, we will first <a href="http://php.net/explode">explode</a> our filename at the dots (.) and then use this function to get the last array object, which will obviouly be the extension.</p>
<p>Example:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
$explode = explode(&quot;.&quot;, $file);
echo end($explode); // will return jpg
?&gt;
</pre>
<p>Or shortened:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
echo end(explode(&quot;.&quot;, $file)); // will return jpg
?&gt;
</pre>
<p><strong>2. Method: function <a href="http://si.php.net/strrchr">strrchr</a></strong></p>
<p>This function finds the last occurrence of a character in a string. Using this function, our php code would look like this:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
echo substr(strrchr($file,&quot;.&quot;),1);
?&gt;
</pre>
<p>Easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Use PHP To Display Page Content (LMAWT part 2)</title>
		<link>http://blog.zurka.us/use-php-to-display-page-content-lmawt-part-2/</link>
		<comments>http://blog.zurka.us/use-php-to-display-page-content-lmawt-part-2/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 15:27:16 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Whatever]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=826</guid>
		<description><![CDATA[If you missed the previous posts, you can read the Introduction and First part to catch with us. What we are going to do today is make our links work and display the content depending on what link we click. First let&#8217;s make our links go live. In our final result of part 1, our [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fuse-php-to-display-page-content-lmawt-part-2%2F&title=Use+PHP+To+Display+Page+Content+%28LMAWT+part+2%29&desc=If+you+missed+the+previous+posts%2C+you+can+read+the+Introduction+and+First+part+to+catch+with+us.+What+we+are+going+to+do+today+is+make+our+links+work+and+display+the+content+depending+on+what+link+we+click.+First+let%27s+make+our+links+go+live.+In+our+final+result+of+part+1%2C+our+links+were+dead.+To&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>If you missed the previous posts, you can read the <a href="http://blog.zurka.us/lets-make-a-website-together/">Introduction</a> and <a href="http://blog.zurka.us/lets-make-a-website-together/">First part</a> to catch with us.</p>
<p>What we are going to do today is <strong>make our links work</strong> and display the content depending on what link we click.</p>
<p>First let&#8217;s make our links go live. In our <a href="http://blog.zurka.us/wp-content/uploads/2009/01/index41.html">final result</a> of part 1, our links were dead. To make a link work, we must use this syntax:</p>
<pre class="brush: html">
&lt;a href=&quot;./&quot;&gt;Home&lt;/a&gt;
&lt;a href=&quot;./?news&quot;&gt;News&lt;/a&gt;
&lt;a href=&quot;./?contact&quot;&gt;Contact&lt;/a&gt;
*** notice we use ?news for the news, ?contact for the contact page etc, will be explained later ***
</pre>
<p>So let&#8217;s change all of our links to this. Our final result will be <a href="http://blog.zurka.us/wp-content/uploads/2009/01/index51.html">this</a>. As you can see, the links are underlined and you can click on them. But if you click on them you will notice nothing really changes on the page, except for the URL in the browser.. that&#8217;s because we need our PHP code that will &#8220;read&#8221; the URL and display the content that comes along.</p>
<p>Let&#8217;s see the PHP code that we put into our <strong>#main-content</strong> div. To load different contents depending on what click we link on, we are going to use the <a href="http://php.net/switch" target="_blank">switch</a> function, which is not hard to understand, is very useful and works fast!</p>
<pre class="brush: php">
&lt;?php
switch (key($_REQUEST)) {

	case &#039;news&#039;:
		echo &#039;We will display our news here&#039;;
	break;

	case &#039;members&#039;:
		echo &#039;This will be the member list&#039;;
	break;

	// we continue like this for all our links
	// and finish with the default statement

	default:
	echo &#039;Welcome to my first website&#039;;

}
?&gt;
</pre>
<p>As I said before, put this code between inside your #main-content DIV.</p>
<p>&lt;div id=&#8221;main-content&#8221;&gt;<br />
&lt;?php switch () {} ?&gt;<br />
&lt;/div&gt;</p>
<p><strong>What will this piece of code do?</strong><br />
It will display different contents based on the page we are on. If, for example, we will click on our &#8220;news&#8221; link, the URL will change to &#8220;domain.com/?<strong>news</strong>&#8221; and the content that will be shown will be &#8220;<strong>news.php</strong>&#8220;, because of the &#8216;case&#8217; we wrote. In this case, what comes after the question mark in the URL is called a &#8220;query string&#8221; and we will work with these.</p>
<p>In this example we are using the &#8220;key($_REQUEST)&#8221; but we could change this to react to something like &#8220;domain.com/?page=news&#8221; and in this case we would use a different switch. Tell me if you want to know about it and I&#8217;ll write an example for this.</p>
<p>Anyway, check what we <a href="http://blog.zurka.us/wp-content/uploads/2009/01/page1.php">accomplished</a> now. We made our first working website, we could actually put whatever we would like inside, we are done. The content is changing and everything is working fine.</p>
<p>Any questions? Feel free to ask!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/use-php-to-display-page-content-lmawt-part-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
