Kohana PHP Framework and CodeIgniter PHP Framework

Kohana PHP FrameworkCodeIgniter is a powerful PHP framework. I have been working on CodeIgniter for more than 2 years. I suggested lot of my friends to learn CodeIgniter. Few months back I started working on Kohana PHP framework. The slogan of Kohana is nice – “The Swift PHP Framework”. I liked Kohana at the first sight.

I developed several web application using Kohana and became a big fan of Kohana. Here I would like to show you some code segments of both frameworks. CodeIgniter

How to load view in CodeIgniter

To load a view in CodeIgniter you have to write

$this->load->view('home', $data);

How to load view in Kohana

$this->template->content = new View('home');

I like the Kohana’s technique best. CodeIngiter is not fully object oriented. Helper functions of CodeIgniter are not object oriented. But in Kohana, everything is object oriented. Say of example- here is a helper class and function to redirect to a particular function in Kohana.

url::redirect('some_controller/some_function');

But in CodeIgniter the helper function is something like this-

redirect(‘some_controller/some_function’);

I would like to share my opinion.

CodeIgniter:

  • Easy to learn
  • Fast and light weight
  • Good documentation
  • Not fully object oriented

Kohana:

  • Easy to learn
  • Fast and light weight
  • Documentation is not good
  • Fully object oriented

PHP Security Tips and Tools

Powerful Security

Powerful Security

I was reading on the topic “php security” using Google Reader. I hope it helps everyone to defining PHP security and it’s uses. Here I would like to quote some paragraphs from the original post on noupe.com

PHP is the most popular web programming languages in use today due in large part to the fact that it’s a highly flexible syntax that can perform many functions while working flawlessly in conjunction with html – Plus it’s relatively easy to learn for beginners, yet it’s powerful enough for advanced users as well. It also works exceptionally well with open source tools, such as the Apache web server and MySQL database. In other words, its versatility is unsurpassed when compared to other scripting languages, making it the language of choice for many programmers.

There are various types of attacks that PHP is particularly vulnerable to. The two main types of attacks are human attacks and automated attacks – Both of which can potentially devastate a website. The goal of PHP security is to minimize, and ultimately eliminate, the potential for both human and automated attacks by putting into place strategic lines of defense to eliminate access to your site by unverified users. The way you go about doing this is to target the most common types of PHP security breaches first, so that you make your website airtight against malicious attacks. So what are the most common types of PHP security breaches?

Most Common PHP Security Vulnerabilities

1. Register_Globals

Register_Globals makes writing PHP applications simple and convenient for the developer, but it also poses a potential security risk. This setting is located in PHP’s configuration file, which is php.ini, and it can be either turned on or off. When turned on, it allows unverified users to inject variables into an application to gain administrative access to your website. Most, if not all, PHP security experts recommend turning register_globals off. Read the rest of this entry »

Open Flash Chart :: amazing chart generating application

Now a days I am working in Open Flash Chart (OFC). I found this amazing, easy to generate chart and use in web applications. Flash produces high quality graphics. OFC generates high resolution charts, I think you like this very much. Lets take a look into a screenshot.

OFC generated chart

OFC generated chart

Click on the thumbnail to view actual size. You may visit OFC homepage, try the tutorial to lean how to make chart using open flash chart. Here your find some sample charts. OFC has two sets of chart library, version 1 and version 2. I think version 2 is better than version 1. Here is the download link of OFC version 2. OFC tutorial is very much easy to understand.

OFC includes some other tools, swfobject, and JSON for data files. And also includes Server Side Helper Libraries for PHP, Perl, Python, Ruby, .NET, Google Web Toolkit and JAVA to generate hassle free JSON formatted data.

I hope you enjoy OFC.

Talking with PHP

Talking with PHP

Talking with PHP

I need the current time then I call the php function – time() and get the current Unix timestamp. Then function time() returns the second measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). Say for, in my website users can register for free for one year. I need to calculate an account expiration time after one year. How can I calculate the expiration time. I need to add one year with the account creation time. We may get the the date and time of account expiration using following code.

$expiration = date( 'Y-m-d H:i:s', time() + (365 * 24 * 60 * 60) );

I have another easy solution. See bellow.

$expiration = date('Y-m-d H:i:s', strtotime( 'now + 1 year' ) );

Everyone knows PHP is a flexible language. In the second statement, it seems I am talking with php. ha ha ha

Posted in PHP. 3 Comments »

CakePHP Manual in PDF Format

“Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.”

Manual for CakePHP is available here – http://manual.cakephp.org/ in HTML format. I converted that into PDF. This will help those who likes more to read PDF than HTML.
Download CakePHP Manual in PDF Format

Cheers

Thanks Hasin Vai, I am including your links here

http://cakeforge.org/frs/download.php/281/cake-manual.chm

http://cakeforge.org/frs/download.php/280/cake-manual.pdf

http://cakeforge.org/frs/download.php/279/many-pages-html.zip

Document to PDF Conversion :: Any Idea ?

Hi All,
Now a days I am working on Document to PDF Conversion using PHP. I got a few tutorial on it, but not complete solution. Have you any idea ?
Thanks.

Another osCommerce Contribution

Hi all,

Today I fixed a simple bug of GuestBook module for osCommerce.

You can download the module from here.

http://www.oscommerce.com/community/contributions,138

Cheers

My first osCommerce contribution

Hi all,

Now a days I am working on osCommerce. Recently I am working on Online Calling Card /Phonecard Selling. I developed it in osCommerce (the leading opensource online shopping cart tools in php). I used a module named Unique Virtual Products.

I modified it a littlebit and posted to osCommerce contribution section.

You may download it from here Unique Virtual Products 0.7.

Cheers !