<?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>Decrypt Web &#187; PHP</title>
	<atom:link href="http://blog.decryptweb.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.decryptweb.com</link>
	<description>Open Source Web Solutions</description>
	<lastBuildDate>Sat, 24 Jul 2010 05:58:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Delete Directory in PHP</title>
		<link>http://blog.decryptweb.com/delete-directory-in-php/</link>
		<comments>http://blog.decryptweb.com/delete-directory-in-php/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 05:56:20 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[Path]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=184</guid>
		<description><![CDATA[This post will be helpful to those who work with directories and files.
I am writing here the PHP code for deleting the directory.

&#60;?php

$extract_dir = 'path'; //physical path of the directory

if(deleteDirectory($extract_dir)) //delete directory
{
	$msg = &#34;$extract_dir was deleted&#34;;
	echo $msg.&#34;&#60;br/&#62;&#34;;
}
else
{
	$msg = &#34;$extract_dir was not deleted&#34;;
	echo $msg.&#34;&#60;br/&#62;&#34;;
}

//delete directory and files inside it
//start
function deleteDirectory($dir)
{
       [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/delete-directory-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing by Reference</title>
		<link>http://blog.decryptweb.com/passing-by-reference/</link>
		<comments>http://blog.decryptweb.com/passing-by-reference/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 07:51:35 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=158</guid>
		<description><![CDATA[I am listing here a simple example to explain &#8216;passing by reference&#8217; in PHP.
I hope it is helpful.

&#60;?php

$a = 5;
echo 'A1-&#62;'.$a.'&#60;br/&#62;';
$b = 6;
$a =&#38; $b;
echo 'A2-&#62;'.$a.'&#60;br/&#62;B1-&#62;'.$b.'&#60;br/&#62;';
global $var;
function foo(&#38;$var)
{
    $var++;
}

$a=5;
echo 'A3-&#62;'.$a.'&#60;br/&#62;';
foo($a);
echo 'A4-&#62;'.$a.'&#60;br/&#62;Var-&#62;'.$var;

?&#62;


For further information kindly visit Passing by Reference





		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Share this on Reddit
		
		
			Stumble upon something good? Share it on StumbleUpon
		
		
			Share [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/passing-by-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insert and Retrieve file with MySQL</title>
		<link>http://blog.decryptweb.com/insert-file-mysql/</link>
		<comments>http://blog.decryptweb.com/insert-file-mysql/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 13:30:46 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=128</guid>
		<description><![CDATA[Some of you might be knowing that there is a functionality in MySQL database for storing files and retrieving the same.
This is mainly used when we need to reduce response time for retrieving and using files in our application.
I am listing here the method for inserting image file in and retrieving image file from MySQL [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/insert-file-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mail in PHP</title>
		<link>http://blog.decryptweb.com/mail-in-php/</link>
		<comments>http://blog.decryptweb.com/mail-in-php/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 17:31:11 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=113</guid>
		<description><![CDATA[I am listing here the method for sending mail using PHP code. This will be useful in many ways, for example when you want to sent mail after say a form is submitted.
Note: This may work in local , but I am suggesting you to execute on live server.


&#60;?php

ini_set(&#34;SMTP&#34;,&#34;mail.yoursitename.com&#34;); //this is in general case, put [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/mail-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extracting String</title>
		<link>http://blog.decryptweb.com/extracting-string/</link>
		<comments>http://blog.decryptweb.com/extracting-string/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:14:32 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=106</guid>
		<description><![CDATA[This is small but very useful script.
I have shown example for extracting only &#8217;src&#8217; value from the &#8216;img&#8217;  tag, but you can modify and use as per your requirement using &#8216;preg_match_all&#8217; function.

&#60;?php

$src= '&#60;img height=&#34;120&#34; width=&#34;120&#34; border=&#34;0&#34; src=&#34;http://www.somesite.com/abc.jpg&#34; class=&#34;image&#34;/&#62;';

preg_match_all('/(src)=(&#34;[^&#34;]*&#34;)/i',$src, $matches);	

echo str_replace('&#34;','',$matches[2][0]);	

?&#62;

Output will be &#8216;http://www.somesite.com/abc.jpg&#8217;





		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Share this on Reddit
		
		
			Stumble upon something good? Share [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/extracting-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Page Redirect</title>
		<link>http://blog.decryptweb.com/page-redirect/</link>
		<comments>http://blog.decryptweb.com/page-redirect/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:08:31 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=104</guid>
		<description><![CDATA[I have written a script for getting the files list from directory and redirecting the page on selecting option from the select box.
So you will get the script for fetching all the files from current directory and redirecting page on selection.

&#60;h&#62;Please select option&#60;/h&#62;
&#60;?php
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']; //current directory physical path

$dir_handle = @opendir($path) or die(&#34;Unable to open [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/page-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Backup</title>
		<link>http://blog.decryptweb.com/database-backup/</link>
		<comments>http://blog.decryptweb.com/database-backup/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 17:12:03 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=99</guid>
		<description><![CDATA[I am listing here the PHP script to generate backup of database.

&#60;?php
/* Database Backup */
$username = &#34;dbusername&#34;;  //database username
$password = 'dbpass';   //database password
$hostname = &#34;localhost&#34;;  //host
$dbname = &#34;dbname&#34;; //databse name
$sConnString = mysql_connect($hostname, $username, $password)
or die(&#34;Unable to connect to MySQL&#34;);

$name = '/pathtodirectory/db'.date('d-m-Y').'.sql.gz'; //give full path of the directory where the backup should [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/database-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get IP Address in PHP</title>
		<link>http://blog.decryptweb.com/ip-address-php/</link>
		<comments>http://blog.decryptweb.com/ip-address-php/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 11:08:40 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=85</guid>
		<description><![CDATA[Many times we need the IP Address of the User visiting our website in our Application.
I am listing here the method to get the User IP Address, hope it might be useful to many of you.

//function for getting IP
//start
function getuserip()
{

    if (isset($_SERVER))
   {
        [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/ip-address-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Assign PHP Array to Javascript Array</title>
		<link>http://blog.decryptweb.com/php-array-javascript-array/</link>
		<comments>http://blog.decryptweb.com/php-array-javascript-array/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 12:15:09 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=79</guid>
		<description><![CDATA[I am describing here a very useful method for getting the values of a PHP array in JavaScript.
For this we need to assign the PHP array values to a array in JavaScript.

&#60;?php
$a = array('A','B','C');
?&#62;
&#60;html&#62;
&#60;head&#62;
&#60;title&#62;Assign PHP Array to Javascript Array&#60;/title&#62;
&#60;script language=&#34;javascript&#34;&#62;
	function showValues(){
		var a=new Array;
	&#60;?php
		for($i=0;$i&#60;count($a); $i++)
            [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/php-array-javascript-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Copy Directory</title>
		<link>http://blog.decryptweb.com/copy-directory/</link>
		<comments>http://blog.decryptweb.com/copy-directory/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 17:20:18 +0000</pubDate>
		<dc:creator>DWRoot</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Copy]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.decryptweb.com/?p=74</guid>
		<description><![CDATA[I am listing here the method to copy full Directories with all sub-directories and files.

&#60;?php

$source = 'f1'; //folder name
$target = 'f2'; //folder name , if target folder does not exists, it will be created

//echo 'src-&#62;'.$source.'&#60;br/&#62;';
//echo 'tar-&#62;'.$target.'&#60;br/&#62;';

if(is_dir($source))
{

	full_copy($source,$target);
	echo 'Folder copied';
}
else
{
	echo 'Not copied';
}

function full_copy( $source, $target )
    {
        [...]]]></description>
		<wfw:commentRss>http://blog.decryptweb.com/copy-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
