<?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/tag/php/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>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>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>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>
