<?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>yalamber.com &#187; php</title>
	<atom:link href="http://blog.yalamber.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yalamber.com</link>
	<description>About me, my learnings and more..</description>
	<lastBuildDate>Thu, 02 Sep 2010 16:29:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Breadcrumb generator function</title>
		<link>http://blog.yalamber.com/2010/05/07/breadcrumb-generator-function/</link>
		<comments>http://blog.yalamber.com/2010/05/07/breadcrumb-generator-function/#comments</comments>
		<pubDate>Fri, 07 May 2010 13:01:54 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.yalamber.com/?p=227</guid>
		<description><![CDATA[Here is a piece of code i used for generating breadcrumbs for one of my project. Function for generating breadcrumb first parameter an array with key and values, value is used for link where as keys are used for link &#8230; <a href="http://blog.yalamber.com/2010/05/07/breadcrumb-generator-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a piece of code i used for generating breadcrumbs for one of my project.</p>
<p><strong>Function for generating breadcrumb</strong></p>
<p>first parameter an array with key and values, value is used for link where as keys are used for link name.</p>
<p>second optional parameter for sending class of ul in the breadcrumb listing.</p>
<pre class="brush: php">
&lt;?php
function breadcrumb_generate($paths = array(), $ul_class = &#039;breadcrumb&#039;)
{
	$forward_icon = &#039;&lt;img src=&quot;&#039;.base_url().&#039;images/front_img/icons/forward.png&quot; alt=&quot;&amp;raquo;&quot; /&gt;&#039;;
    $breadcrumb = &#039;&lt;ul class=&quot;&#039;.$ul_class.&#039;&quot;&gt;&#039;;
	$i=1;
	$total_paths = count($paths);
	foreach($paths as $path=&gt;$link)
	{
		if($link!=&#039;nolink&#039;)
		{
			$breadcrumb .= &#039;&lt;li&gt;&lt;span&gt;&lt;a href=&quot;&#039;.site_url($link).&#039;&quot;&gt;&#039;.$path.&#039;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&#039;;
		}
		else
		{
			$breadcrumb .= &#039;&lt;li&gt;&lt;span&gt;&#039;.$path.&#039;&lt;/span&gt;&lt;/li&gt;&#039;;
		}
		$i++;
	}
	$breadcrumb .= &#039;&lt;/ul&gt;&#039;;

	return $breadcrumb;
}
?&gt;
</pre>
<p><strong>usage</strong></p>
<pre class="brush: php">

&lt;?php echo breadcrumb_generate(array(&#039;Home&#039;=&gt;&#039;&#039;, &#039;Group&#039;=&gt;&#039;group/browse&#039;, ucfirst($row-&gt;name)=&gt;&#039;group/&#039;.$row-&gt;permalink, &#039;Forum&#039;=&gt;&#039;group/&#039;.$row-&gt;permalink.&#039;/topic&#039;, $topic_row-&gt;title=&gt;&#039;nolink&#039;), &#039;topicBreadcrumb&#039;);?&gt;
</pre>
<p>css styles for listing breadcrumbs</p>
<pre class="brush: css">
ul.breadcrumb{
	padding-top:5px;
	width:400px;
}
ul.breadcrumb li{
	float:left;
	list-style:none;
	background:url(../images/front_img/icons/forward.png) no-repeat 0.2em 0;
	padding-left:17px;
}
ul.breadcrumb li span{
	padding:5px;
}
ul.breadcrumb li span:hover{
	padding:4px;
	border:1px solid #090;
	-moz-border-radius:5px; -webkit-border-radius:5px;

}
ul.breadcrumb li:first-child{
	background:none;
	padding-left:0px;
}
</pre>
<p>This is just a rough usage of this function. you can hack it up and use as needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2010/05/07/breadcrumb-generator-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>yahoo smileys array for codeigniter</title>
		<link>http://blog.yalamber.com/2010/03/27/yahoo-smileys-array-for-codeigniter/</link>
		<comments>http://blog.yalamber.com/2010/03/27/yahoo-smileys-array-for-codeigniter/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 05:18:38 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.yalamber.com/?p=196</guid>
		<description><![CDATA[I needed to use yahoo like emoticons in my new project i am working. So i had to replace all existing array of smileys, So in order to make this painful process easier to other who are trying to use &#8230; <a href="http://blog.yalamber.com/2010/03/27/yahoo-smileys-array-for-codeigniter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I needed to use yahoo like emoticons in my new project i am working. So i had to replace all existing array of smileys, So in order to make this painful process easier to other who are trying to use yahoo like emoticons in their project. I have included the smileys image zip and config array with this post. I hope it will be use full. Please report any bug in the smileys array if you get one.</p>
<p><a href="http://blog.yalamber.com/smileys.zip">Download here</a></p>
<p>thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2010/03/27/yahoo-smileys-array-for-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>using youtube api to upload videos from your site</title>
		<link>http://blog.yalamber.com/2009/04/15/using-youtube-api-to-upload-videos-from-your-site/</link>
		<comments>http://blog.yalamber.com/2009/04/15/using-youtube-api-to-upload-videos-from-your-site/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 02:55:26 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpizabi]]></category>
		<category><![CDATA[socialnetwork]]></category>
		<category><![CDATA[youtube api]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=158</guid>
		<description><![CDATA[I wanted to create a video site but lacked the server resources to run it, I am using a shared server, it has ffmpeg but when converting a video it takes lot&#8217;s of system resources. I successfully made the fmpeg &#8230; <a href="http://blog.yalamber.com/2009/04/15/using-youtube-api-to-upload-videos-from-your-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted to create a video site but lacked the server resources to run it, I am using a shared server, it has ffmpeg but when converting a video it takes lot&#8217;s of system resources. I successfully made the fmpeg video site, But didn&#8217;t decide to use it. I searched for youtube APIs and i came to know we could simply use the youtube api to upload videos from our site to youtube. So i decided to use it for my video site. Below is step by step tutorial on using youtube api to upload videos from your site to youtube, I used the clientLogin method of youtube api to upload videos.</p>
<ol>
<li>First get the developer key for using youtube api.<br />
Go to http://code.google.com/apis/youtube/dashboard/ and regsiter a developer key<br />
You will be given client id and  developer key. Note it down, it will be used in your own application later.</li>
<li>Get the php client libraries, Go to http://framework.zend.com/download/gdata</li>
<li>extract it to your server. I assume you put the Zend direcctory in your server document root.</li>
<li>Create a form in your site as below which i assume will be pointed to upload.php file in your srver.</li>
</ol>
<pre class="brush: html">
&lt;form action=&quot;upload.php&quot;  method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;select name=&quot;videoCategory&quot;&gt;
&lt;option value=&quot;Autos&quot;&gt;Autos &amp;amp;amp; Vehicles&lt;/option&gt;
&lt;option value=&quot;Music&quot;&gt;Music&lt;/option&gt;
&lt;option value=&quot;Animals&quot;&gt;Pets &amp;amp;amp; Animals&lt;/option&gt;
&lt;option value=&quot;Sports&quot;&gt;Sports&lt;/option&gt;
&lt;option value=&quot;Travel&quot;&gt;Travel &amp;amp;amp; Events&lt;/option&gt;
&lt;option value=&quot;Games&quot;&gt;Gadgets &amp;amp;amp; Games&lt;/option&gt;
&lt;option value=&quot;Comedy&quot;&gt;Comedy&lt;/option&gt;
&lt;option value=&quot;People&quot;&gt;People &amp;amp;amp; Blogs&lt;/option&gt;
&lt;option value=&quot;News&quot;&gt;News &amp;amp;amp; Politics&lt;/option&gt;
&lt;option value=&quot;Entertainment&quot;&gt;Entertainment&lt;/option&gt;
&lt;option value=&quot;Education&quot;&gt;Education&lt;/option&gt;
&lt;option value=&quot;Howto&quot;&gt;Howto &amp;amp;amp; Style&lt;/option&gt;
&lt;option value=&quot;Nonprofit&quot;&gt;Nonprofit &amp;amp;amp; Activism&lt;/option&gt;
&lt;option value=&quot;Tech&quot;&gt;Science &amp;amp;amp; Technology&lt;/option&gt;
&lt;/select&gt;
&lt;label for=&quot;title&quot;&gt;Title&lt;/label&gt;
&lt;input id=&quot;title&quot; name=&quot;title&quot; type=&quot;text&quot;&gt;
&lt;label for=&quot;description&quot;&gt;Description&lt;/label&gt;
&lt;textarea id=&quot;description&quot; name=&quot;description&quot; rows=&quot;5&quot;&gt;&lt;/textarea&gt;
&lt;label for=&quot;keywords&quot;&gt;Kewords (use comma , to separate)&lt;/label&gt;
&lt;input id=&quot;keywords&quot; name=&quot;keywords&quot; value=&quot;&quot; type=&quot;text&quot;&gt;
&lt;br class=&quot;clr&quot; /&gt;
&lt;input value=&quot;Next -&gt; choose video&quot; name=&quot;add&quot; type=&quot;submit&quot; /&gt;
&lt;/form&gt;
</pre>
<p>Create upload.php</p>
<pre class="brush: php">

&lt;?php

if(isset($_POST[&#039;add&#039;],$_POST[&#039;videoCategory&#039;],$_POST[&#039;title&#039;],$_POST[&#039;description&#039;]))
{
//add the video meta data to session
$_SESSION[&#039;vidmeta&#039;][&#039;category&#039;] = $_POST[&#039;videoCategory&#039;];
$_SESSION[&#039;vidmeta&#039;][&#039;title&#039;] = $_POST[&#039;title&#039;];
$_SESSION[&#039;vidmeta&#039;][&#039;description&#039;] = $_POST[&#039;description&#039;];
$_SESSION[&#039;vidmeta&#039;][&#039;keywords&#039;] = $_POST[&#039;keywords&#039;];

//application id change this to our applicationId
$applicationId = &#039;onnepalvideosite&#039;;
//client id change this to our own client id
$clientId = &quot;ytapi-xxxxxx-xxxx-xxxxx&quot;;
//developer key change this to your own key
$developerKey = &quot;xxxxxxx-xxxxxxx-xxxxxxxxx-xxxxxxx&quot;;
//include zend loader
require_once(&#039;Zend/Loader.php&#039;); // the Zend dir must be in your include_path
//include youtube class
Zend_Loader::loadClass(&#039;Zend_Gdata_YouTube&#039;);
//include the client login class
Zend_Loader::loadClass(&#039;Zend_Gdata_ClientLogin&#039;);
//Client login
$authenticationURL= &#039;https://www.google.com/youtube/accounts/ClientLogin&#039;;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = &#039;your username here&#039;,
$password = &#039;our password here&#039;,
$service = &#039;youtube&#039;,
$client = null,
$source = &#039;onnepal&#039;, // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);

$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();

$myVideoEntry-&gt;setVideoTitle($_POST[&#039;title&#039;]);
$myVideoEntry-&gt;setVideoDescription($_POST[&#039;description&#039;]);
// The category must be a valid YouTube category!
$myVideoEntry-&gt;setVideoCategory($_POST[&#039;videoCategory&#039;]);

// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry-&gt;SetVideoTags($_POST[&#039;keywords&#039;]);

$tokenHandlerUrl = &#039;http://gdata.youtube.com/action/GetUploadToken&#039;;
$tokenArray = $yt-&gt;getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
$tokenValue = $tokenArray[&#039;token&#039;];
$postUrl = $tokenArray[&#039;url&#039;];
$nextUrl = &#039;http://www.yoursite.com/yt.php&#039;;
print &lt;&lt;&lt; END
&lt;br /&gt;&lt;form action=&quot;${postUrl}?nexturl=${nextUrl}&quot;
method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;input name=&quot;file&quot; type=&quot;file&quot;/&gt;
&lt;input name=&quot;token&quot; type=&quot;hidden&quot; value=&quot;${tokenValue}&quot;/&gt;
&lt;input value=&quot;Upload Video File&quot; type=&quot;submit&quot; /&gt;
&lt;/form&gt;
END;
}
?&gt;
</pre>
<p>This code takes the category, title, description and keywords from the form and generates a form to upload video to youtube. You can then upload video to youtube using the form.<br />
Next make yt.php file which is the $nexturl file, $nexturl is the location to which youtube will redirect after the upload is complete. YouTube appends <code>id</code> and <code>status</code> parameters to the URL as shown in the following example</p>
<pre>http://www.yoursite.com/yt.php?status=200&amp;id=JPF-DXF7hzc</pre>
<p>Afterou get the youtube video id in your yt.php file you can add it to your own database to show videos in your site. You can do anything you wish with the variables you get through yt.php.I hope it will be help ful to all wishing to use youtube apis to upload video.</p>
<p>This can also be implemented to phpizabi sites.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2009/04/15/using-youtube-api-to-upload-videos-from-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>toksta chat integration to your website [phpizabi, socialnetwork]</title>
		<link>http://blog.yalamber.com/2009/03/20/toksta-chat-integration-to-your-website-phpizabi-socialnetwork/</link>
		<comments>http://blog.yalamber.com/2009/03/20/toksta-chat-integration-to-your-website-phpizabi-socialnetwork/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 16:41:07 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpizabi]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=137</guid>
		<description><![CDATA[I was looking for a decent chat script and i found much better hosted solution toksta. It&#8217;s a hosted chat aplication. You can add instant chat messenger in your site with a couple of&#160; lines of codes. I just installed &#8230; <a href="http://blog.yalamber.com/2009/03/20/toksta-chat-integration-to-your-website-phpizabi-socialnetwork/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was looking for a decent chat script and i found much better hosted solution toksta. It&#8217;s a hosted chat aplication. You can add instant chat messenger in your site with a couple of&nbsp; lines of codes. I just installed it in phpizabi site and my custom script site at www.visualthailand.com and www.kiratisaathi.com You can find more information at www.toksta.com<br mce_bogus="1"></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2009/03/20/toksta-chat-integration-to-your-website-phpizabi-socialnetwork/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Socialnetwork platforms in php</title>
		<link>http://blog.yalamber.com/2008/11/26/socialnetwork-platforms-in-php/</link>
		<comments>http://blog.yalamber.com/2008/11/26/socialnetwork-platforms-in-php/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 15:51:22 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpizabi]]></category>
		<category><![CDATA[socialnetwork]]></category>
		<category><![CDATA[platforms]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=81</guid>
		<description><![CDATA[socialnetwork is the most popular destination for the netizens. Today most of the people spend time on socialnetwork like facebook, hi5, linkedin, myspace. Many people also want to build there own social network which focus on special subject matter of &#8230; <a href="http://blog.yalamber.com/2008/11/26/socialnetwork-platforms-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>socialnetwork is the most popular destination for the netizens. Today most of the people spend time on socialnetwork like facebook, hi5, linkedin, myspace. Many people also want to build there own social network which focus on special subject matter of their interest. In building such network, there are many platforms available today to help you build your own social network out of the box. The most preferred programming language today in php for the web applications. So i will be mentioning only platforms based in php and mysql. There are also online webapplications available like ning, and kickapps which help you build socialnetwork. you don&#8217;t need to get hosting or domain name. you can get the socialnetwork just by filling out some form. But as these don&#8217;t provide much flexibility i willnot be focusing on such services.</p>
<p>Below are some of the platform i have reviewed and will recommend you to try it out.</p>
<ol>
<li>socialengine</li>
<p>-Of all the platforms i find this one as a real platform of choice, It&#8217;s a total socialnetowk out of the box.  But&#8217;s it&#8217;s not a free, it costs $250 for core and $40 each for the plugins. Once you get the socialengine installed and go through it&#8217;s codes you can start developing your socialnetwork. I recommed this as the best platform. The tamplating system used is smarty so you can easily change the look and feel of your site. you can go to the site <a title="socialengine" href="http://socialengine.net" target="_blank">here</a></p>
<li>phpizabi</li>
<p>-The easiest to modify socialnetwork framework. Specially theme designing is easy with this socialnetwork framework. It&#8217;s free and opensource framework. But was regarded as the looser in the socialnetwork framework battle due to the fact that, it could not handle more users. Scalability was the issue with this framework. But I personally liked this framework. Cleanely coded, own theme engine, easy to modify was the pros of this framework. Why i mention this framework here is because with some modifications we can make it work better and make a robust social network out of it. It just need some rehaul in the coding and it can handle everything needed for the socialnetwork. To go to the site <a href="http://phpizabi.net">click here</a></p>
<li>boonex dolphin</li>
<p>-The socialnetwork framework with lot&#8217;s of features. They have reay done good job in their latest releases. It&#8217;s soon getting pace in it&#8217;s development and they have also announced of their future releases they are working on and they hype that it is going to be the best choice among all other. I hope to get the releases soon. <a href="http://boonex.com">click here</a></p>
<li>phpfox</li>
<p>-The most popular platform i think. It costs $300 for full liscence. With it you get 6 month of support and upgrades. There are several modules available for this platform. Installation and modification service is also available in the site. It&#8217;s also a out of the box socialnetwork platform <a href="http://phpfox.com">click here</a></ol>
<p>There are many platforms available for socialnetwork. you can also use joomla, wordpress, drupal to build a socialnetwork, but the best will be to start coding your own custom platform so that you can make it work as you want. As for other who want to make their own socialnetwork rapidly above are the platforms they should consider.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/11/26/socialnetwork-platforms-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>buddypress for socialnetworking site</title>
		<link>http://blog.yalamber.com/2008/09/06/buddypress-for-socialnetworking-site/</link>
		<comments>http://blog.yalamber.com/2008/09/06/buddypress-for-socialnetworking-site/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 08:41:02 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[site review]]></category>
		<category><![CDATA[buddypress]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=67</guid>
		<description><![CDATA[Hello, I was trying to setup the wordpress mu for my site www.mundhu.com. I successfully set it up. Now i wanted to make it more social and found out about buddypress. According to the site buddypress will transform a vanilla &#8230; <a href="http://blog.yalamber.com/2008/09/06/buddypress-for-socialnetworking-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hello, I was trying to setup the wordpress mu for my site www.mundhu.com. I successfully set it up. Now i wanted to make it more social and found out about <a href="http://www.buddypress.org/" target="_blank">buddypress</a>. According to the site buddypress will transform a vanilla installation of wordpress mu in to the socialnetwork platform. So I thought to give it a try. I was glad I did give a try to it. It was awesome. I am still playing with it. See a demo at <a href="http://www.mundhum.com" target="_blank">www.mundhum.com</a>. If you guys need any help regarding the installation of buddypress you can contact me. WIll try to help you..</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/09/06/buddypress-for-socialnetworking-site/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting stock information from yahoo.</title>
		<link>http://blog.yalamber.com/2008/09/04/getting-stock-information-from-yahoo/</link>
		<comments>http://blog.yalamber.com/2008/09/04/getting-stock-information-from-yahoo/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 11:24:55 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=63</guid>
		<description><![CDATA[Here is a function to get stock quote information from yahoo: function getquote($symbol) { if (empty($symbol)) { $symbol = &#039;^dji&#039;; } $fields = &#039;sl1d1t1c1ohgv&#039;; // we use yahoo to get the quotes //http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&#38;f=sl1d1t1c1ohgv&#38;e=.csv $host = &#039;http://download.finance.yahoo.com&#039;; // construct the url &#8230; <a href="http://blog.yalamber.com/2008/09/04/getting-stock-information-from-yahoo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a function to get stock quote information from yahoo:</p>
<pre class="brush: php">

function getquote($symbol)
{
if (empty($symbol)) {
$symbol = &#039;^dji&#039;;
}
$fields = &#039;sl1d1t1c1ohgv&#039;;
// we use yahoo to get the quotes
//http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&amp;f=sl1d1t1c1ohgv&amp;e=.csv
$host = &#039;http://download.finance.yahoo.com&#039;;
// construct the url
$url = $host . &#039;/d/quotes.csv?s=&#039;. urlencode($symbol) .&#039;&amp;f=&#039;.$fields.&#039;&amp;e=.csv&#039;;
// ask yahoo for the .csv file
$csv = fopen($url, &quot;r&quot;);
$data = fgetcsv($csv,10000,&quot;,&quot;);
return $data;
}
</pre>
<p>How to use the above function:</p>
<p>Forst of all include the above function in your script then for the symbol you want to watch the stock information use it:</p>
<p>for ex:</p>
<p>for symbol ^DJI:</p>
<pre class="brush: php">

$data = getquote(&quot;^DJI&quot;);
</pre>
<p>It will return an array of data in below form:</p>
<p>$data[0]= symbol.</p>
<p>$data[1]= lastprice</p>
<p>$data[2]= date</p>
<p>$data[3]= time</p>
<p>$data[4]= change</p>
<p>$data[5]= open</p>
<p>$datat[6]= high</p>
<p>$data[7]= low</p>
<p>$data[8]= volume</p>
<p>So you can now echo them to get the desired information.</p>
<p>I hopw it will be useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/09/04/getting-stock-information-from-yahoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing unpk/pk function to database based in phpizabi</title>
		<link>http://blog.yalamber.com/2008/09/04/form-unpk-pk-to-db-based/</link>
		<comments>http://blog.yalamber.com/2008/09/04/form-unpk-pk-to-db-based/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 10:42:58 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpizabi]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=51</guid>
		<description><![CDATA[ok here is some ideas to do it. I have done it. But i don&#8217;t use phpizabi any more. I have developed my own script. And i had transferred the users, contacts, user gallery to my new script using this &#8230; <a href="http://blog.yalamber.com/2008/09/04/form-unpk-pk-to-db-based/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ok here is some ideas to do it. I have done it. But i don&#8217;t use phpizabi any more. I have developed my own script. And i had transferred the users, contacts, user gallery to my new script using this method so it can be used by you to convert the phpizabi contact, gallery system to database based.<br />
Below is how databse structure will be like for contact and gallery system:</p>
<pre class="brush: sql">
CREATE TABLE IF NOT EXISTS `phpizabi_contact` (
`id` int(9) NOT NULL auto_increment,
`user` int(9) NOT NULL,
`friend` int(9) NOT NULL,
`date` int(32) NOT NULL,
`is_blocked` tinyint(1) NOT NULL default &#039;0&#039;,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;

CREATE TABLE IF NOT EXISTS `phpizabi_contact_request` (
`id` int(9) NOT NULL auto_increment,
`for_user` int(9) NOT NULL,
`from_user` int(9) NOT NULL,
`date` int(32) NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;

-- --------------------------------------------------------

--
-- Table structure for table `phpizabi_gallery`
--

CREATE TABLE IF NOT EXISTS `phpizabi_gallery` (
`id` int(11) NOT NULL auto_increment,
`user` int(10) NOT NULL default &#039;0&#039;,
`img` varchar(100) NOT NULL default &#039;0&#039;,
`date` int(32) NOT NULL,
`album_id` int(32) NOT NULL default &#039;0&#039;,
`title` varchar(250) NOT NULL default &#039;&#039;,
`description` longtext NOT NULL,
`views` int(10) NOT NULL default &#039;0&#039;,
`comments` int(10) NOT NULL default &#039;0&#039;,
`rating` float NOT NULL default &#039;0&#039;,
`votes` int(11) NOT NULL default &#039;0&#039;,
`is_mainpicture` tinyint(1) NOT NULL default &#039;0&#039;,
PRIMARY KEY `id` (`id`),
FULLTEXT KEY `title` (`title`,`description`)
) ENGINE=MyISAM ;

CREATE TABLE IF NOT EXISTS `phpizabi_gallery_album` (
`id` int(11) NOT NULL auto_increment,
`user` int(10) NOT NULL default &#039;0&#039;,
`date` int(64) NOT NULL default &#039;0&#039;,
`cover_img` varchar(64) NOT NULL,
`album_name` varchar(20) NOT NULL default &#039;&#039;,
`album_description` text NOT NULL,
PRIMARY KEY `id` (`id`),
FULLTEXT KEY `album_name` (`album_name`,`album_description`)
) ENGINE=MyISAM ;
</pre>
<p>Now to load the contents of the users from the old phpizabi database to new tables we can use the following script.<br />
Inserting pictures to new gallery table.</p>
<pre class="brush: php">
$sql = myQ(&quot;SELECT `id`,`pictures`, `username` FROM `[x]users`&quot;);
while($row = myF($sql)){
$pictures = unpk($row[&quot;pictures&quot;]);
if (!is_array($pictures)) $pictures = array();

foreach ($pictures as $pic) {
myQ(&quot;
INSERT INTO `[x]gallery` (`user`,`img`,`date`,`title`,`description`,`is_mainpicture`)
VALUES
(&#039;{$row[&quot;id&quot;]}&#039;,&#039;{$pic[&quot;FILE&quot;]}&#039;,&#039;&quot;.time().&quot;&#039;,&#039;{$pic[&quot;NAME&quot;]}&#039;,&#039;{$pic[&quot;DESCRIPTION&quot;]}&#039;,&#039;{$pic[&quot;MAIN&quot;]}&#039;)
&quot;);
}
}
</pre>
<p>Inserting contacts to new table:</p>
<pre class="brush: php">
$sql = myQ(&quot;SELECT `id`,`contacts` FROM `[x]users`&quot;);
while($row = myF($sql)){
$contacts = unpk($row[&quot;contacts&quot;]);
if (!is_array($contacts)) $contacts = array();

foreach ($contacts as $groupName =&amp;amp;amp;gt; $usersArray) {

if (is_array($usersArray)) foreach ($usersArray as $userArrayKey =&amp;amp;amp;gt; $userEntity) {
myQ(&quot;
INSERT INTO `[x]contact` (`user`,`friend`,`date`)
VALUES
(&#039;{$row[&quot;id&quot;]}&#039;,&#039;{$userEntity}&#039;,&#039;&quot;.time().&quot;&#039;)
&quot;);

}
}
</pre>
<p>This should now transfer all the contacts and gallery pictures to the new table. I think i have covered the main part where you were confused about. After you get the informations in a table. You can code php to function with contact and gallery system. i hope it will be helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/09/04/form-unpk-pk-to-db-based/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Storing your session to database in php</title>
		<link>http://blog.yalamber.com/2008/08/29/storing-your-session-to-database-in-php/</link>
		<comments>http://blog.yalamber.com/2008/08/29/storing-your-session-to-database-in-php/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 19:19:20 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=45</guid>
		<description><![CDATA[I am developing a custom solutions for my projects. I was finding solution to secure my php applications. As security is top concerned when I develop my applications. I had to develop a solution for a shared hosting environment and &#8230; <a href="http://blog.yalamber.com/2008/08/29/storing-your-session-to-database-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am developing a custom solutions for my projects. I was finding solution to secure my php applications.  As security is top concerned when I develop my applications. I had to develop a solution for  a shared hosting environment and found out that the session hijacking was a big problem while on shared server. The best solution was to store the session in some where secured place. I Researched about it and fund out that there was already a solution in php to do it. we could actually use session_set_save_handler() function to do it. And for the location to store session database was the suitable place. As database has it&#8217;s own authentication layer. So i decided to use it for my applications.</p>
<p>First create a databse table with following sql in you application datatbase:</p>
<pre class="brush: sql">

CREATE TABLE IF NOT EXISTS `yourAppPrefix_sessions` (
`id` varchar(32) NOT NULL,
`access` int(10) unsigned default NULL,
`data` text,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM;
</pre>
<p>Below i wil provide you the code to use it on your own application:</p>
<pre class="brush: php">

session_set_save_handler(&#039;_open&#039;,
&#039;_close&#039;,
&#039;_read&#039;,
&#039;_write&#039;,
&#039;_destroy&#039;,
&#039;_clean&#039;);

function _open()
{
return true;
}

function _close()
{

return true;
}

function _read($id)
{

$id = mysql_real_escape_string($id);

$sql = &quot;SELECT data
FROM   `[p]sessions`
WHERE  id = &#039;$id&#039;&quot;;

if ($result = mysql_query($sql))
{
if (mysql_num_rows($result))
{
$record = mysql_fetch_array($result);

return $record[&#039;data&#039;];
}
}

return &#039;&#039;;
}

function _write($id, $data)
{

$access = time();

$id = mysql_real_escape_string($id);
$access = mysql_real_escape_string($access);
$data = mysql_real_escape_string($data);

$sql = &quot;REPLACE
INTO    `[p]sessions`
VALUES  (&#039;$id&#039;, &#039;$access&#039;, &#039;$data&#039;)&quot;;

return mysql_query($sql);
}

function _destroy($id)
{

$id = mysql_real_escape_string($id);

$sql = &quot;DELETE
FROM   `[p]sessions`
WHERE id = &#039;$id&#039;&quot;;

return mysql_query($sql);
}

function _clean($max)
{

$old = time() - $max;
$old = mysql_real_escape_string($old);

$sql = &quot;DELETE
FROM   `[p]sessions`
WHERE  access &amp;amp;lt; &#039;$old&#039;&quot;;

return mysql_query($sql);
}
</pre>
<p>Save the above code and name it session.php or anything you want.</p>
<p>After this where you want to use session in your application. just add following to start session:</p>
<pre class="brush: php">

//Store session to database
require_once(&quot;path_to/session.php&quot;);
session_start();
</pre>
<p>Also be sure you have already connected your database before the above code in your applicaiton as it uses database to store session.</p>
<p>Now after this is done you can use session as usual. This just changes the place where your session is stored i.e in database. Other things are as same as you would store session in the local machine. I hope it will make you clear about what I am talking about.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/08/29/storing-your-session-to-database-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mundhum.com released</title>
		<link>http://blog.yalamber.com/2008/06/06/mundhumcom-released/</link>
		<comments>http://blog.yalamber.com/2008/06/06/mundhumcom-released/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 06:29:45 +0000</pubDate>
		<dc:creator>yalamber</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpizabi]]></category>
		<category><![CDATA[mundhum]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://yalamber.com/?p=29</guid>
		<description><![CDATA[This is a phpbb3 based site. In this site, I have disabled the default registration and account management system of phpbb3 and provided access to users from kiratisaathi.com which is a phpizabi based site. I have changed some theme of &#8230; <a href="http://blog.yalamber.com/2008/06/06/mundhumcom-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a phpbb3 based site. In this site, I have disabled the default registration and account management system of phpbb3 and provided access to users from kiratisaathi.com which is a phpizabi based site. I have changed some theme of default prosilver to match the look of my site.</p>
<p>The tutorials i got useful for developing this site are linked below:</p>
<p><a href="http://www.startrekguide.com/community/viewtopic.php?f=50&amp;t=4576&amp;start=0&amp;st=0&amp;sk=t&amp;sd=a&amp;sid=007dc0848e3943ff58e8a2410f83fae8" target="_blank">How to integrate phpbb3 template, session and other system to your site.</a></p>
<p>and  <a href="http://polr.co.uk/online-marketing/index.php/integration-with-phpbb3-forum-system/" target="_blank">Integrating with phpbb3 forum system</a></p>
<p>These tutorials were helpful for me to integrate the users from kiratisaathi.com(phpizabi) to mundhum.com(phpbb3). As it provides a useful class aswell. Since the password hashing is different in phpizabi and phpbb3 it was difficult to integrate both system, but thanks to this tutorial it got me working someway out.</p>
<p>visit this site at <a href="http://www.mundhum.com" target="_blank">www.mundhum.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yalamber.com/2008/06/06/mundhumcom-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
