<?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>TECHiE TALKS &#187; PHP</title>
	<atom:link href="http://www.icpep.org/category/programming/php-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icpep.org</link>
	<description>Just another techie stuff</description>
	<lastBuildDate>Fri, 23 Jul 2010 04:53:01 +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>Slackware PHP GD Error</title>
		<link>http://www.icpep.org/slackware-php-gd-error/</link>
		<comments>http://www.icpep.org/slackware-php-gd-error/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 01:13:29 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Linux Webserver]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1072</guid>
		<description><![CDATA[In the past months I was able to handle a LAMP server, this is my second time to handle a UNIX based web server but this time its a lot different because I will will be the one to install and configure the web server.  Our System administrator was the one who installed the latest [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-1074 aligncenter" title="slackware" src="http://www.icpep.org/wp-content/uploads/2010/06/slackware.png" alt="" width="342" height="359" /></p>
<p style="text-align: justify;">In the past months I was able to handle a LAMP server, this is my second time to handle a UNIX based web server but this time its a lot different because I will will be the one to install and configure the web server.  Our System administrator was the one who installed the latest version of slackware which is 13.1 on the machine, so all I need to do is have the web server up and running.</p>
<p style="text-align: justify;">Our system administrator did include the x packages when he installed slackware and this caused me a problem in running PHP because it gave me several errors in GD support.  The error I get was,</p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">PHP Warning:  PHP Startup: Unable to load dynamic library &#8216;/usr/lib/php/extensions/gd.so&#8217; &#8211; libxcb-xlib.so.0: cannot open shared object file: No such file or directory in Unknown on line 0</div>
<p>I was able to solve the problem with the following steps taken and was based from a <a href="http://www.linuxquestions.org/questions/linux-general-1/php-gd-problems-missing-libx11-so-6-%3D-how-to-get-it-577217/">linux forum</a> I really loved.<span id="more-1072"></span><br />
Download the packages by entering the following commands,</p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">
<ul>
<li> root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/xtrans-1.0.3-noarch-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libXdmcp-1.0.2-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libXau-1.0.3-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libX11-1.1.1-i486-4.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libXt-1.0.5-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libSM-1.0.3-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libICE-1.0.3-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libXpm-3.5.6-i486-1.tgz</li>
<li>root@icpep:~# wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.0/slackware/x/libxcb-1.0-i486-2.tgz</li>
</ul>
</div>
<p>After downloading the files I installed them using <strong>pkgtool</strong> and select install packages from current directory and by there it will display the packages downloaded. Here is a sample of how to install it using <strong>pkgtool</strong>,</p>
<p style="text-align: center;"><img class="size-full wp-image-1073 aligncenter" title="slackon" src="http://www.icpep.org/wp-content/uploads/2010/06/slackon.jpg" alt="" width="529" height="605" /></p>
<p>After installing the packages restart your apache and PHP GD support should be working. To check type this command,</p>
<div style="border: 2px solid #CECECE; padding: 5px; background: #F1F1F1;">root@icpep:~#php -m</div>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Slackware PHP GD Error" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Slackware+PHP+GD+Error" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/slackware-php-gd-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Main Domain</title>
		<link>http://www.icpep.org/getting-main-domain/</link>
		<comments>http://www.icpep.org/getting-main-domain/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 18:04:13 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=1046</guid>
		<description><![CDATA[Do you want to extract the main domain of a URL?  Here is a function that works well and can be modified easily.  I found this function while searching for a good Regular Expression to fulfill such result. &#60;?php function get_base_domain($url)  { $debug = 0; $base_domain = ''; $G_TLD = array( 'biz','com','edu','gov','info','int','mil','name','net','org','aero','asia','cat','coop','jobs','mobi','museum', 'pro','tel','travel','arpa','root','berlin','bzh','cym','gal','geo','kid','kids','lat','mail','nyc','post','sco','web','xxx', 'nato','example','invalid','localhost','test','bitnet','csnet','ip','local','onion','uucp', 'co' [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify; padding-left: 30px;"><img class="size-full wp-image-1047 aligncenter" title="php" src="http://www.icpep.org/wp-content/uploads/2010/04/php.jpg" alt="" width="300" height="225" /></p>
<p style="text-align: justify;">Do you want to extract the main domain of a URL?  Here is a function that works well and can be modified easily.  I found this function while searching for a good Regular Expression to fulfill such result.</p>
<pre class="php"><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpFunctionKeyword">function</span><span class="htmlText"> get_base_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$debug <span class="phpOperator">=</span> 0;
$base_domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
$G_TLD <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span>
<span class="phpString">'biz'</span>,<span class="phpString">'com'</span>,<span class="phpString">'edu'</span>,<span class="phpString">'gov'</span>,<span class="phpString">'info'</span>,<span class="phpString">'int'</span>,<span class="phpString">'mil'</span>,<span class="phpString">'name'</span>,<span class="phpString">'net'</span>,<span class="phpString">'org'</span>,<span class="phpString">'aero'</span>,<span class="phpString">'asia'</span>,<span class="phpString">'cat'</span>,<span class="phpString">'coop'</span>,<span class="phpString">'jobs'</span>,<span class="phpString">'mobi'</span>,<span class="phpString">'museum'</span>,
<span class="phpString">'pro'</span>,<span class="phpString">'tel'</span>,<span class="phpString">'travel'</span>,<span class="phpString">'arpa'</span>,<span class="phpString">'root'</span>,<span class="phpString">'berlin'</span>,<span class="phpString">'bzh'</span>,<span class="phpString">'cym'</span>,<span class="phpString">'gal'</span>,<span class="phpString">'geo'</span>,<span class="phpString">'kid'</span>,<span class="phpString">'kids'</span>,<span class="phpString">'lat'</span>,<span class="phpString">'mail'</span>,<span class="phpString">'nyc'</span>,<span class="phpString">'post'</span>,<span class="phpString">'sco'</span>,<span class="phpString">'web'</span>,<span class="phpString">'xxx'</span>,
<span class="phpString">'nato'</span>,<span class="phpString">'example'</span>,<span class="phpString">'invalid'</span>,<span class="phpString">'localhost'</span>,<span class="phpString">'test'</span>,<span class="phpString">'bitnet'</span>,<span class="phpString">'csnet'</span>,<span class="phpString">'ip'</span>,<span class="phpString">'local'</span>,<span class="phpString">'onion'</span>,<span class="phpString">'uucp'</span>,
<span class="phpString">'co'</span> <span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// country tlds <span class="phpOperator">(</span><span class="htmlText">source</span><span class="phpOperator">:</span><span class="htmlText"> http</span><span class="phpOperator">:</span>//en<span class="phpOperator">.</span>wikipedia.org/wiki/Country_code_top-level_domain<span class="phpOperator">)</span>
</span>$C_TLD <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span>
<span class="phpString">'ac'</span>,<span class="phpString">'ad'</span>,<span class="phpString">'ae'</span>,<span class="phpString">'af'</span>,<span class="phpString">'ag'</span>,<span class="phpString">'ai'</span>,<span class="phpString">'al'</span>,<span class="phpString">'am'</span>,<span class="phpString">'an'</span>,<span class="phpString">'ao'</span>,<span class="phpString">'aq'</span>,<span class="phpString">'ar'</span>,<span class="phpString"><span class="phpKeyword">'as'</span></span>,<span class="phpString">'at'</span>,<span class="phpString">'au'</span>,<span class="phpString">'aw'</span>,<span class="phpString">'ax'</span>,<span class="phpString">'az'</span>,
<span class="phpString">'ba'</span>,<span class="phpString">'bb'</span>,<span class="phpString">'bd'</span>,<span class="phpString">'be'</span>,<span class="phpString">'bf'</span>,<span class="phpString">'bg'</span>,<span class="phpString">'bh'</span>,<span class="phpString">'bi'</span>,<span class="phpString">'bj'</span>,<span class="phpString">'bm'</span>,<span class="phpString">'bn'</span>,<span class="phpString">'bo'</span>,<span class="phpString">'br'</span>,<span class="phpString">'bs'</span>,<span class="phpString">'bt'</span>,<span class="phpString">'bw'</span>,<span class="phpString">'by'</span>,<span class="phpString">'bz'</span>,
<span class="phpString">'ca'</span>,<span class="phpString">'cc'</span>,<span class="phpString">'cd'</span>,<span class="phpString">'cf'</span>,<span class="phpString">'cg'</span>,<span class="phpString">'ch'</span>,<span class="phpString">'ci'</span>,<span class="phpString">'ck'</span>,<span class="phpString">'cl'</span>,<span class="phpString">'cm'</span>,<span class="phpString">'cn'</span>,<span class="phpString">'co'</span>,<span class="phpString">'cr'</span>,<span class="phpString">'cu'</span>,<span class="phpString">'cv'</span>,<span class="phpString">'cx'</span>,<span class="phpString">'cy'</span>,<span class="phpString">'cz'</span>,
<span class="phpString">'de'</span>,<span class="phpString">'dj'</span>,<span class="phpString">'dk'</span>,<span class="phpString">'dm'</span>,<span class="phpString"><span class="phpKeyword">'do'</span></span>,<span class="phpString">'dz'</span>,<span class="phpString">'ec'</span>,<span class="phpString">'ee'</span>,<span class="phpString">'eg'</span>,<span class="phpString">'er'</span>,<span class="phpString">'es'</span>,<span class="phpString">'et'</span>,<span class="phpString">'eu'</span>,<span class="phpString">'fi'</span>,<span class="phpString">'fj'</span>,<span class="phpString">'fk'</span>,<span class="phpString">'fm'</span>,<span class="phpString">'fo'</span>,
<span class="phpString">'fr'</span>,<span class="phpString">'ga'</span>,<span class="phpString">'gd'</span>,<span class="phpString">'ge'</span>,<span class="phpString">'gf'</span>,<span class="phpString">'gg'</span>,<span class="phpString">'gh'</span>,<span class="phpString">'gi'</span>,<span class="phpString">'gl'</span>,<span class="phpString">'gm'</span>,<span class="phpString">'gn'</span>,<span class="phpString">'gp'</span>,<span class="phpString">'gq'</span>,<span class="phpString">'gr'</span>,<span class="phpString">'gs'</span>,<span class="phpString">'gt'</span>,<span class="phpString">'gu'</span>,<span class="phpString">'gw'</span>,
<span class="phpString">'gy'</span>,<span class="phpString">'hk'</span>,<span class="phpString">'hm'</span>,<span class="phpString">'hn'</span>,<span class="phpString">'hr'</span>,<span class="phpString">'ht'</span>,<span class="phpString">'hu'</span>,<span class="phpString">'id'</span>,<span class="phpString">'ie'</span>,<span class="phpString">'il'</span>,<span class="phpString">'im'</span>,<span class="phpString">'in'</span>,<span class="phpString">'io'</span>,<span class="phpString">'iq'</span>,<span class="phpString">'ir'</span>,<span class="phpString">'is'</span>,<span class="phpString">'it'</span>,<span class="phpString">'je'</span>,
<span class="phpString">'jm'</span>,<span class="phpString">'jo'</span>,<span class="phpString">'jp'</span>,<span class="phpString">'ke'</span>,<span class="phpString">'kg'</span>,<span class="phpString">'kh'</span>,<span class="phpString">'ki'</span>,<span class="phpString">'km'</span>,<span class="phpString">'kn'</span>,<span class="phpString">'kr'</span>,<span class="phpString">'kw'</span>,<span class="phpString">'ky'</span>,<span class="phpString">'kz'</span>,<span class="phpString">'la'</span>,<span class="phpString">'lb'</span>,<span class="phpString">'lc'</span>,<span class="phpString">'li'</span>,<span class="phpString">'lk'</span>,
<span class="phpString">'lr'</span>,<span class="phpString">'ls'</span>,<span class="phpString">'lt'</span>,<span class="phpString">'lu'</span>,<span class="phpString">'lv'</span>,<span class="phpString">'ly'</span>,<span class="phpString">'ma'</span>,<span class="phpString">'mc'</span>,<span class="phpString">'md'</span>,<span class="phpString">'mg'</span>,<span class="phpString">'mh'</span>,<span class="phpString">'mk'</span>,<span class="phpString">'ml'</span>,<span class="phpString">'mm'</span>,<span class="phpString">'mn'</span>,<span class="phpString">'mo'</span>,<span class="phpString">'mp'</span>,<span class="phpString">'mq'</span>,
<span class="phpString">'mr'</span>,<span class="phpString">'ms'</span>,<span class="phpString">'mt'</span>,<span class="phpString">'mu'</span>,<span class="phpString">'mv'</span>,<span class="phpString">'mw'</span>,<span class="phpString">'mx'</span>,<span class="phpString">'my'</span>,<span class="phpString">'mz'</span>,<span class="phpString">'na'</span>,<span class="phpString">'nc'</span>,<span class="phpString">'ne'</span>,<span class="phpString">'nf'</span>,<span class="phpString">'ng'</span>,<span class="phpString">'ni'</span>,<span class="phpString">'nl'</span>,<span class="phpString">'no'</span>,<span class="phpString">'np'</span>,
<span class="phpString">'nr'</span>,<span class="phpString">'nu'</span>,<span class="phpString">'nz'</span>,<span class="phpString">'om'</span>,<span class="phpString">'pa'</span>,<span class="phpString">'pe'</span>,<span class="phpString">'pf'</span>,<span class="phpString">'pg'</span>,<span class="phpString">'ph'</span>,<span class="phpString">'pk'</span>,<span class="phpString">'pl'</span>,<span class="phpString">'pn'</span>,<span class="phpString">'pr'</span>,<span class="phpString">'ps'</span>,<span class="phpString">'pt'</span>,<span class="phpString">'pw'</span>,<span class="phpString">'py'</span>,<span class="phpString">'qa'</span>,
<span class="phpString">'re'</span>,<span class="phpString">'ro'</span>,<span class="phpString">'ru'</span>,<span class="phpString">'rw'</span>,<span class="phpString">'sa'</span>,<span class="phpString">'sb'</span>,<span class="phpString">'sc'</span>,<span class="phpString">'sd'</span>,<span class="phpString">'se'</span>,<span class="phpString">'sg'</span>,<span class="phpString">'sh'</span>,<span class="phpString">'si'</span>,<span class="phpString">'sk'</span>,<span class="phpString">'sl'</span>,<span class="phpString">'sm'</span>,<span class="phpString">'sn'</span>,<span class="phpString">'sr'</span>,<span class="phpString">'st'</span>,
<span class="phpString">'sv'</span>,<span class="phpString">'sy'</span>,<span class="phpString">'sz'</span>,<span class="phpString">'tc'</span>,<span class="phpString">'td'</span>,<span class="phpString">'tf'</span>,<span class="phpString">'tg'</span>,<span class="phpString">'th'</span>,<span class="phpString">'tj'</span>,<span class="phpString">'tk'</span>,<span class="phpString">'tl'</span>,<span class="phpString">'tm'</span>,<span class="phpString">'tn'</span>,<span class="phpString">'to'</span>,<span class="phpString">'tr'</span>,<span class="phpString">'tt'</span>,<span class="phpString">'tv'</span>,<span class="phpString">'tw'</span>,
<span class="phpString">'tz'</span>,<span class="phpString">'ua'</span>,<span class="phpString">'ug'</span>,<span class="phpString">'uk'</span>,<span class="phpString">'us'</span>,<span class="phpString">'uy'</span>,<span class="phpString">'uz'</span>,<span class="phpString">'va'</span>,<span class="phpString">'vc'</span>,<span class="phpString">'ve'</span>,<span class="phpString">'vg'</span>,<span class="phpString">'vi'</span>,<span class="phpString">'vn'</span>,<span class="phpString">'vu'</span>,<span class="phpString">'wf'</span>,<span class="phpString">'ws'</span>,<span class="phpString">'ye'</span>,<span class="phpString">'yu'</span>,
<span class="phpString">'za'</span>,<span class="phpString">'zm'</span>,<span class="phpString">'zw'</span>,<span class="phpString">'eh'</span>,<span class="phpString">'kp'</span>,<span class="phpString">'me'</span>,<span class="phpString">'rs'</span>,<span class="phpString">'um'</span>,<span class="phpString">'bv'</span>,<span class="phpString">'gb'</span>,<span class="phpString">'pm'</span>,<span class="phpString">'sj'</span>,<span class="phpString">'so'</span>,<span class="phpString">'yt'</span>,<span class="phpString">'su'</span>,<span class="phpString">'tp'</span>,<span class="phpString">'bu'</span>,<span class="phpString">'cs'</span>,<span class="phpString">'dd'</span>,<span class="phpString">'zr'</span>
<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// get domain
</span>>if <span class="phpOperator">(</span> <span class="phpOperator">!</span>$full_domain <span class="phpOperator">=</span><span class="htmlText"> get_url_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
return </span>$base_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpComment">// now the fun
</span><span class="phpComment">//<span class="phpKeyword"> break </span>up domain, reverse
</span>$DOMAIN <span class="phpOperator">=</span> <span class="phpFunction">explode</span><span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">.</span>'</span>, $full_domain<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span> $debug <span class="phpOperator">)</span> <span class="phpFunction">print_r</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
$DOMAIN <span class="phpOperator">=</span> <span class="phpFunction">array_reverse</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span> $debug <span class="phpOperator">)</span> <span class="phpFunction">print_r</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// first check<span class="phpKeyword"> for </span>ip address
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">count</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpNumber">4</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> <span class="phpFunction">is_numeric</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> <span class="phpFunction">is_numeric</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">3</span><span class="phpOperator">]</span><span class="phpOperator">)</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
return </span>$full_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpComment">//<span class="phpKeyword"> if </span><span class="htmlText">only </span><span class="phpNumber">2</span> domain parts, that must be our domain
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">count</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">)</span> <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> <span class="phpNumber">2</span> <span class="phpOperator">)</span><span class="phpKeyword"> return </span>$full_domain<span class="phpText">;</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span><span class="htmlText"> in_</span><span class="phpFunction">array</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span>, $C_TLD<span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span><span class="htmlText"> in_</span><span class="phpFunction">array</span><span class="phpOperator">(</span>$DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span>, $G_TLD<span class="phpOperator">)</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">2</span><span class="phpOperator">]</span> <span class="phpOperator">!</span><span class="phpOperator">=</span> <span class="phpString">'www'</span> <span class="phpOperator">)</span> <span class="phpOperator">{</span>
$full_domain <span class="phpOperator">=</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">2</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
else </span><span class="phpOperator">{</span>
$full_domain <span class="phpOperator">=</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">.</span>'</span> <span class="phpOperator">.</span> $DOMAIN<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span><span class="phpText">;</span>;
<span class="phpOperator">}</span>
<span class="phpComment">// did we succeed<span class="phpOperator">?</span>
</span>>return $full_domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpFunctionKeyword">function</span><span class="htmlText"> get_url_domain</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
$_URL <span class="phpOperator">=</span> <span class="phpFunction">parse_url</span><span class="phpOperator">(</span>$url<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// sanity check
</span>>if <span class="phpOperator">(</span> <span class="phpFunction">empty</span><span class="phpOperator">(</span>$_URL<span class="phpOperator">)</span> <span class="phpOperator">|</span><span class="phpOperator">|</span> <span class="phpFunction">empty</span><span class="phpOperator">(</span>$_URL<span class="phpOperator">[</span><span class="phpString">'host'</span><span class="phpOperator">]</span><span class="phpOperator">)</span> <span class="phpOperator">)</span>  <span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
else </span><span class="phpOperator">{</span>
$domain <span class="phpOperator">=</span> $_URL<span class="phpOperator">[</span><span class="phpString">'host'</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpKeyword">
return </span>$domain<span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span></pre>
<p>To test the code we can use the function,</p>
<pre class="php">$url  <span class="phpOperator">=</span> <span class="phpString">'http<span class="phpOperator">:</span><span class="phpComment">//www<span class="phpOperator">.</span>icpep.org'</span><span class="phpText">;</span>
</span><span class="phpFunction">echo</span> get_base_domain<span class="phpOperator">(</span>$url<span class="phpOperator">)</span> <span class="phpText">;</span> // icpep.org</pre>
<p><a href="http://icpep.org/wp-content/uploads/files/get.main.domain.txt">Click here to download</a>.</p>
<p style="text-align: justify;">This code really helped me a lot.  There are a lot of Regular expressions out there but this simple approach can break all those head breaking expressions.  Btw, this function is free of use and is under GNU licensing.   Hope this functions is of big help to you also, happy coding!</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Getting Main Domain" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Getting+Main+Domain" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/getting-main-domain/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHPMyAdmin Importing Large Data</title>
		<link>http://www.icpep.org/phpmyadmin-importing-large-data/</link>
		<comments>http://www.icpep.org/phpmyadmin-importing-large-data/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 07:06:41 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ap]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=970</guid>
		<description><![CDATA[By Default phpmyadmin can import data on your mysql database up to 2MB of data and beyond that will be an error.  This has been a big problem  by most webmasters and sometimes this can be a barrier to stop improving the sites.  Before I kept on searching what to use to import a large [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-971 aligncenter" title="logo_phpmyadmin" src="http://www.icpep.org/wp-content/uploads/2009/11/logo_phpmyadmin.gif" alt="logo_phpmyadmin" width="200" height="180" /></p>
<p style="text-align: justify;">By Default phpmyadmin can import data on your mysql database up to 2MB of data and beyond that will be an error.  This has been a big problem  by most webmasters and sometimes this can be a barrier to stop improving the sites.  Before I kept on searching what to use to import a large data on my MySQL database and all I can see is BigDump.  It is a software used for large and very large MySQL Dumps which is also an option to import large data on your database.</p>
<p style="text-align: justify;">If you find BigDump a pain in the head then another way to solve the problem is to edit your php.ini file.  All you need to do is open your php.ini file and edit the line</p>
<div style="border: 2px solid #cecece; padding: 5px; background: #f1f1f1 none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">upload_max_filesize = 2M</div>
<p>Setting 2M to a larger size will fix the problem.  One problem with this is that it will affect the web server&#8217;s runtime limit and could throw an error if you dump a very large data.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for PHPMyAdmin Importing Large Data" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+PHPMyAdmin+Importing+Large+Data" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/phpmyadmin-importing-large-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Curl</title>
		<link>http://www.icpep.org/php-curl/</link>
		<comments>http://www.icpep.org/php-curl/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 19:09:37 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=922</guid>
		<description><![CDATA[If you are a web developer and having problems on Installing PHP Curl on Apache with PHP installed on Windows Operating System, below is my version of tonyspecer&#8217;s &#8220;cURL with PHP and Apache on Windows&#8220;.  The steps are simple and direct to the point. I have windows apache version 2.2.14 and PHP Version 5.2.10 installed [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-923 aligncenter" title="PHP Curl" src="http://www.icpep.org/wp-content/uploads/2009/10/PHP-Curl.jpg" alt="PHP Curl" width="453" height="419" /></p>
<p>If you are a  web developer and having problems on Installing PHP Curl on Apache with PHP installed on Windows Operating System, below is my version of <a href="http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/">tonyspecer&#8217;s</a> &#8220;<strong>cURL with PHP and Apache on Windows</strong>&#8220;.  The steps are simple and direct to the point.</p>
<p>I have windows <a href="http://httpd.apache.org/">apache</a> version 2.2.14 and <a href="http://www.php.net/downloads.php">PHP</a> Version 5.2.10 installed on my Laptop using the installers provided on the respective sites.</p>
<p>1.  Install APACHE and PHP (<em>I installed my APACHE on C:\apache and PHP on C:\php directories</em> )<br />
2.  Edit the php.ini file found in the PHP directory.<span id="more-922"></span></p>
<ul>
<li>Near line  546 set the extension directory extension_dir = &#8220;C:\php\ext&#8221;.  In my case I have my extensions files inside the ext folder. You can use any folder name as long as you set it in the php.ini file.</li>
<li>Near line 472 set register_globals = On</li>
<li>Near line 630 set session.save_path=&#8221;C:\WINDOWS\Temp&#8221; or you can set any directory</li>
</ul>
<p>3.  On the PHP folder (<em>in my case C:\php\</em>) copy the php5ts.dll file to the bin folder of your Apache (<em>C:\apache\bin</em>\)<br />
4.  On the PHP folder (<em>C:\php\</em>) copy libeay32.dll and ssleay32.dll to &#8221; C:\WINDOWS\system32&#8243;  folder<br />
5.  Download CURL for Windows found at <a href="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</a> and put it on the PHP folder (C:\php\curl)<br />
6.  Download OpenSSL for Windows found at <a href="http://www.shininglightpro.com/products/Win32OpenSSL.html">http://www.shininglightpro.com/products/Win32OpenSSL.html</a>, for me I downloaded 7MB <span>OpenSSL v0.9.8k Installer<br />
</span></p>
<ul>
<li>To some Windows Visual c++ Redistributable is recommended before OpenSSL is installed.  The windows Visual c++ Redistributable can be downloaded at Microsoft website in the link:  <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&amp;displayLang=en">http://www.microsoft.com/downloads/thankyou.aspx?familyId=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&amp;displayLang=en</a></li>
</ul>
<p>7.  Check to see if you have the following file: c:\windows\system32\msvcr70.dll. If not, search for it in Google and download it to system32.  If you can&#8217;t find it in that directory click this <a href="http://www.dll-files.com/dllindex/dll-files.shtml?msvcr70">link</a> to download the file from www.dllfiles.com.  Extract the zipped file and put it in the &#8220;c:\windows\system32\&#8221;  folder.<br />
8.  Uncomment the curl line in your php.ini file to enable curl:  extension=php_curl.dll but in my case I just added the line because it is not found in my php.ini file</p>
<p>9.  Edit the Apache httpd.conf file to enable php:</p>
<ul>
<li>For newer version of Apache add at the bottom
<ul>
<li>LoadModule php5_module &#8220;C:/php/php5apache2_2.dll&#8221;</li>
</ul>
</li>
<li>Then below add Line: AddType application/x-httpd-php .php</li>
</ul>
<p>10.  Restart Apache and your curl should be working now.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for PHP Curl" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+PHP+Curl" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/php-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPMailer</title>
		<link>http://www.icpep.org/phpmailer/</link>
		<comments>http://www.icpep.org/phpmailer/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 19:47:01 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=917</guid>
		<description><![CDATA[Sending E-Mail with PHP can be simple, or it can be very complex depending on what you want to do.  PHPmailer is a free PHP software used for sending emails or should I say used for &#8220;spamming&#8221;.  Though the software has been provided for free, many developers has gone beyond its real purpose.  With a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-918 aligncenter" title="PHPmailer" src="http://www.icpep.org/wp-content/uploads/2009/10/PHPmailer.jpg" alt="PHPmailer" width="403" height="302" /></p>
<p style="text-align: justify;">Sending E-Mail with PHP can be simple, or it can be very complex depending on what you want to do.  <a href="http://sourceforge.net/projects/phpmailer/">PHPmailer</a> is a free PHP software used for sending emails or should I say used for &#8220;spamming&#8221;.  Though the software has been provided for free, many developers has gone beyond its real purpose.  With a block of IP Address , a <a href="http://www.icpep.org/install-apache-tomcat/">web server</a> with PHP installed in it is a perfect set-up for spamming. I have been using this free PHP software  also and it has saved me a lot of work and headaches.</p>
<p style="text-align: justify;">What is in PHPmailer that makes it a good tool for sending emails? Does it only support a private host or is it capable of using gmail or any other public webmail services?<span id="more-917"></span></p>
<p style="text-align: justify;">PHPMailer is an <a href="http://www.icpep.org/object-oriented-php-samples">OOP PHP</a> script designed for sending emails.  Some of the &#8220;G&#8221; features of phpmailer are:</p>
<ul>
<li>Redundant SMTP servers.</li>
<li>Supports  8bit, base64, binary, and quoted-printable encoding.</li>
<li>Supports text and HTML type of email.</li>
<li>Can send emails with multiple TOs, CCs, BCCs and REPLY-TOs.</li>
<li>Capable of Word wrap.</li>
<li>Tested on multiple SMTP servers: Gmail, Sendmail, qmail, Postfix, Imail, Exchange, Mercury, Courier.</li>
<li>Works on any win32 or &#8220;nix&#8221; platforms.</li>
<li>Capable of handling and embedded image.</li>
<li>Capable of handling multiple attachments.</li>
<li>SMTP authentication.</li>
</ul>
<p>This are only few of the capabilities of a PHPMailer.  Above all the email handlers I used PHPmailer is number one on my list because of the ease of use.  It requires less skills with amazing performance, it is  a fully featured email transfer class for PHP.  Its indeed a thumbs up for the developers!</p>
<p style="text-align: justify;">
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for PHPMailer" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+PHPMailer" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/phpmailer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code Igniter Query</title>
		<link>http://www.icpep.org/code-igniter-query/</link>
		<comments>http://www.icpep.org/code-igniter-query/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 06:36:53 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=869</guid>
		<description><![CDATA[Code Igniter is one of the best PHP framework available today.  It is free to download and user guide can be found together with the package. In Code Igniter the class that has the database queries or the methods that deals with getting the data on the database is placed inside the MODEL folder.  Just [...]]]></description>
			<content:encoded><![CDATA[<p align="center">
<img src="http://www.icpep.org/wp-content/uploads/2009/10/php-code.jpg" alt="php code" title="php code" width="360" height="288" class="alignnone size-full wp-image-875" />
</p>
<p><a href="http://www.icpep.org/code-igniter-installation-and-first-run/">Code Igniter</a> is one of the best PHP framework available today.  It is free to download and user guide can be found together with the package.</p>
<p>In Code Igniter the class that has the database queries or the methods that deals with getting the data on the database is placed inside the MODEL folder.  Just remember the &#8220;D&#8221; which tells us that Database methods are placed in this folder as what Jeffrey Way said in his tutorials.</p>
<p>Here are different Methods to query the database which is based in <a href="http://net.tutsplus.com">Nettuts+</a> tutorials.</p>
<p>Inside my Model folder I created a file Mydb.php, so the name of my class should be the same as the filename I created.<br />
<span id="more-869"></span></p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$this->db->select('title,content'); #where title and content are fields
		$sql = $this->db->get('data');  #data is a database table
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
        }
}
?>
</pre>
<p>In this method the line <em>$this->db->select(&#8216;title,content&#8217;);</em> is using code igniter &#8220;active records&#8221; where I stated the fields I need but if you want to get all the data just remove this line.  The line <em>$sql = $this->db->get(&#8216;data&#8217;);</em> tells the name of the table where I want to get the fields title and content.  To make sure I have something to work on the line <em>$sql->num_rows() > 0</em> is placed and the data is placed inside the array $data[].</p>
<p>To be more specific in using code igniter active records,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$this->db->select('title,content');
		$this->db->from('data');
		$this->db->where('id',1);
		$sql = $this->db->get();
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
        }
}
?>
</pre>
<p>Another way of querying is:</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = $this->db->query('SELECT * FROM data');
		if($sql->num_rows() > 0) {
			foreach($sql->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>The line<em> $sql = $this->db->query(&#8216;SELECT * FROM data&#8217;);</em> is simply putting the query inside the predefined method in Code Igniter $this->db->query(&#8216;[query]&#8216;).  Still the data returned is an array.</p>
<p>To query with a user input,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = "select * from data where id=?";
		$val = $this->db->query($sql, 2);
		if($val->num_rows() > 0) {
			foreach($val->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>The line <em>$sql = &#8220;select * from data where id=?&#8221;;</em> is our database query where ? is any value passed to it.  The line <em>$val = $this->db->query($sql, 2);</em> is where we execute our query and the value passed to &#8220;?&#8221; is 2. But what if we have more than 1 condition in our query,</p>
<pre>
< ?php
class Mydb extends Model {
	function getData() {
		$sql = "select * from data where id=? and author = ?";
		$val = $this->db->query($sql, array(1, 'Allan'));
		if($val->num_rows() > 0) {
			foreach($val->result() as $row) {
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>
</pre>
<p>If we have more than one condition in our query we just use an array stating the value for our conditions.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Code Igniter Query" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Code+Igniter+Query" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/code-igniter-query/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Object Oriented PHP Samples</title>
		<link>http://www.icpep.org/object-oriented-php-samples/</link>
		<comments>http://www.icpep.org/object-oriented-php-samples/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 11:00:43 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=760</guid>
		<description><![CDATA[PHP is one of the mostly used language on the net. Why is it preferred by most web developers? Well, to give a brief reason why I love PHP most and why it is widely used I am sure of and few of the reasons why I love PHP: It is free, easy to use, [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">PHP is one of the mostly used language on the net.  Why is it preferred by most web developers? Well, to give a brief reason why I love PHP most and why it is widely used I am sure of and few of the reasons why I love PHP:  It is free, easy to use, secure and extremely fast.  PHP before and today have a very big difference since PHP today is on Object Oriented approach though some other ways can still be used but the best thing is that in PHP&#8217;s handling of objects has been completely rewritten, allowing for better performance and more features. Using Object Oriented PHP is a lot way more easier and easier to trace codes rather that putting all together the codes in on PHP file.
</p>
<p>
To have a better look on which is easier to use here is one simple Object Oriented PHP sample:
</p>
<p><pre>
< ?php
$x = 1000;
$y = 2000;
$z = $x + $y;
echo $z;
?>
</pre>
</p>
<p>Before, programming is done this way and it really is a very big pain especially when the same operation is needed on another PHP file.  So I need to re-declare again the values and the operation needed in order to achieve the same result.  Compare the big difference between the two:<span id="more-760"></span></p>
<pre>
< ?php
class operation{
  function add($x,$y){
    $z = $x + $y;
       return $z;
  }
}
$op = new operation();
echo $op->add(5,7);
?>
</pre>
<p align="justify">
Easy right? So every now and then all I need to do is include the file which contains the class and the functions.  For example if we name the file as class.operation.php and we want to use the functions in that class all we need.  This will play a very big difference to all the programmers out who wanted to develop web based software and gain some extra income.
</p>
<p align="justify">
Anyway speaking of programming contest, I saw this site while I was surfing on the net searching for extra income.  Well I got lucky when I came across this site that gives $1O,OOO for a &#8220;Super Sexy&#8221; Mortgage Calculator.  I will just grab this chance to share to all the programmers to join this <a href="http://www.mortgageloanplace.com/mortgage-calculator.php">mortgage calculator contest</a> in the <a href="http://www.mortgageloanplace.com/">Mortgage Loan Place</a>.  What is in this calculator that makes it Super Sexy?  Each mortgage calculator should contain a minimum amount of functionality. Mortgage calculators traditionally compute the value of a monthly payment based on principal, interest, taxes and insurance. To have a clearer view of what the contest is all about you can visit their site on the link given above.  This is also not a problem if you don&#8217;t know how to create one, all you need to do is refer them and gain $1000.  Easy money, isn&#8217;t it?  </p></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Object Oriented PHP Samples" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Object+Oriented+PHP+Samples" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/object-oriented-php-samples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session Authentication</title>
		<link>http://www.icpep.org/session-authentication/</link>
		<comments>http://www.icpep.org/session-authentication/#comments</comments>
		<pubDate>Wed, 20 May 2009 12:25:56 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=609</guid>
		<description><![CDATA[One problem in creating a PHP Session Authentication is that when you are logged in and suddenly logs out and click the back button you will be returned to the page where you kast visited.   Isn&#8217;t this a problem especially when you have important data in that page.  So if you have problem with this [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-610 aligncenter" title="phpsession" src="http://www.icpep.org/wp-content/uploads/2009/05/phpsession.jpg" alt="phpsession" width="446" height="210" /></p>
<p style="text-align: justify;">One problem in creating a PHP Session Authentication is that when you are logged in and suddenly logs out and click the back button you will be returned to the page where you kast visited.   Isn&#8217;t this a problem especially when you have important data in that page.  So if you have problem with this let me share a code that will surely eleminate the problem.  In this code there is no need for javascripts to disable the back button(what if js is disabled on the browser?).</p>
<p style="text-align: justify;">The code uses session and when the user logs out the user is redirected to the login page and when he clicks the back button it will redirect back to the login page.  This is one trick for PHP Security Authentication.</p>
<p style="text-align: center;">
<pre>#create a function to redirect the user to login page
#this should be on your php functions
function redirect($url){
	echo "&lt;script type='text/javascript'&gt;";
	echo "window.location.href='$url'";
	echo "&lt;/script&gt;";
}
#this should be in your page where you authenticate the user
session_start();
$sql = mysql_query("select * from user
       where username=\"$username\" and userpassword=\"$password\"");
if(mysql_num_rows($sql) &gt; 0) {
 $_SESSION['auth'] = true;
} else{
  redirect('login.php');
}
#so on the logout file there should be
session_destroy();
redirect('login.php');</pre>
<p align="justify"><span id="more-609"></span>Before starting in any of your PHP file you need to put this codes so that every now and the session is well monitored.</p>
<pre>if( $_SESSION['auth'] == true) {
#PHP code here ...
} else{
redirect('login.php');
}</pre>
<p style="text-align: justify;">So in this code if the session is not true the user is redirected to the login page.  So when the user press that back button the user is always redirected to login page because the session created was destroyed.  I hope this code will help a lot especially those who just started their PHP programming.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for Session Authentication" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+Session+Authentication" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/session-authentication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>File Extension VOB</title>
		<link>http://www.icpep.org/file-extension-vob/</link>
		<comments>http://www.icpep.org/file-extension-vob/#comments</comments>
		<pubDate>Sun, 10 May 2009 05:15:29 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[File Extension]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=561</guid>
		<description><![CDATA[Yesterday I was walking on the mall and I saw this movie, it was entitled The Knowing.  When I got home I searched for the movie over the net and I saw the trailer and it was something that I should see.  It tells about how the feature will be if we keep this foolishness [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-562 aligncenter" title="dvd" src="http://www.icpep.org/wp-content/uploads/2009/05/dvd.jpg" alt="dvd" width="300" height="200" /></p>
<p style="text-align: justify;">Yesterday I was walking on the mall and I saw this movie, it was entitled The Knowing.  When I got home I searched for the movie over the net and I saw the trailer and it was something that I should see.  It tells about how the feature will be if we keep this foolishness that we are doing.  I love the environment so much that it hurt me a lot of what it has become now.  I bought a <a href="http://www.ifileextensionvob.com/">DVD</a> copy an d opened it over the computer.  When I opened the DVD there were two folders inside it.  One folder is the Audio_ts and the other is Video_ts.  Obviously the movie should be in the video_ts folder.  I saw this file VTS_01_1.VOB and I wonder what the <a href="http://www.ifileextensionvob.com/">File Extension VOB</a> means.  If you don&#8217;t know what VOB is its a Video Object file used commonly on DVD videos.</p>
<p style="text-align: justify;">These VOB files  are the files          on a DVD that contain          the actual video, audio,          subtitles, and menus for          the DVD. On my previous DVD movies it was in chapters and now this one I just bought don&#8217;t have and this was something new.  There and then I have read that the  <a href="http://www.ifileextensionvob.com/">File Extension VOB</a> has two types.  One that is subdivided into chapters and the other one is not.  </p>
<p><span id="more-561"></span></p>
<p style="text-align: justify;">VOB files that are subdivided into chapters are commonly used for DVD movies that are series movies such as Prison Break or Heroes.  each chapter may contain the episodes of the movie.  What is the reason behind subdividing it into chapters?  It is divided into chapter for our convenience and ease.  It was made for easy navigation of chapters and episodes for playback.  If dividing it to chapters is not favorable for you then we can convert it to new single file.</p>
<p style="text-align: justify;">VOB files without chapter contains  only one video              stream.  Though it is also capable of being played again but you can never pinpoint the exact chapter that you want to play again.  This on disadvantage of having a DVD copy without any subdivision of chapters.</p>
<p style="text-align: justify;">This VOB file can be converted to different file extension you can just use a converter that produces high quality.  Converting the file might cause errors on the movie, this is a disadvantage for converting files to other formats.  The quality can be destroyed so make sure to use trusted software to keep away from any dangeroues files.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for File Extension VOB" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+File+Extension+VOB" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/file-extension-vob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Displaying On the Browser</title>
		<link>http://www.icpep.org/php-displaying-on-the-browser/</link>
		<comments>http://www.icpep.org/php-displaying-on-the-browser/#comments</comments>
		<pubDate>Sat, 02 May 2009 02:32:57 +0000</pubDate>
		<dc:creator>paparts</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.icpep.org/?p=533</guid>
		<description><![CDATA[When its your first time to code HTML , the tendency of opening the file is by clicking it twice and yes the expected result is displaying.  And from that point on, they can view their web page/website as it was intended to be viewed.  Above image is one example of an HTML file viewed [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="aligncenter size-full wp-image-536" title="html" src="http://www.icpep.org/wp-content/uploads/2009/05/html.jpg" alt="html" width="569" height="50" /></p>
<p style="text-align: justify;">When its your first time to code HTML , the tendency of opening the file is by clicking it twice and yes the expected result is displaying.   And from that point on, they can view their web page/website as it was intended to be viewed.  Above image is one example of an HTML file viewed by double clicking on the file. But when you have a web server things are different.</p>
<p style="text-align: justify;">Last night I have this friend who was programming a system using PHP and she was asking me why all the PHP codes are displaying on the browser.  I was thinking that the host or PHP was down and it bothered me a lot since there are also other developers  and other clients using the web server and this would be a bigger delay on the business.   It was relieved with what I saw because the problem was what she entered on the browser.<span id="more-533"></span></p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-537" title="wrong-php1" src="http://www.icpep.org/wp-content/uploads/2009/05/wrong-php1.jpg" alt="wrong-php1" width="519" height="78" /></p>
<p style="text-align: justify;">This is one problem in opening a PHP file.  You shold use the name of your server or IP then the PHP file name like http://127.0.0.1/fortest.php or if you are using localhost then that would be http://localhost/fortest.php.  If you are using your domain that is being hosted by a certain web hosting<a href="http://webhostingrating.com/"> </a>company then you can use http://www.mydomainname.com/fortest.php.  But if after putting the domain name and the PHP codes are displayed one possible problem would be the PHP is down.</p>
<p style="text-align: justify;">If you are having troubles where to find the best Web hosting company then better look for a site that does <a href="http://webhostingrating.com/">web hosting rating</a> this would surely help you in finding the best web hosting company for your business.There you can see the top rated web hosting company that has been serving the net for years.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="allajosephcagadas@gmail.com" /><input type="hidden" name="return" value="" /><input type="hidden" name="item_name" value="Can You Buy Me a Beer? for PHP Displaying On the Browser " /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="amount" value="" /><input type="image" src="http://www.icpep.org/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="Buy Me a Beer" title="Buy Me a Beer" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=allajosephcagadas@gmail.com&amp;currency_code=USD&amp;amount=&amp;return=&amp;item_name=Can+You+Buy+Me+a+Beer?+for+PHP+Displaying+On+the+Browser+" target="paypal">Did find the post very useful? Maybe you want to buy me a glass of beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.icpep.org/php-displaying-on-the-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
