Archive for the ‘PHP’ Category

Cpanel Backup scheduler :: Phpclasses Contribution

November 3, 2009 Leave a comment

This class can be used to schedule a backup of a Cpanel hosting account.

It accesses the control Web server of a Cpanel installation and sends an HTTP request to schedule a backup with given parameters.

Currently it supports parameters for specifying the FTP account to where the backup files should be uploaded and the e-mail address to where the notifications should be sent.

The class displays the result page of backup schedule request using a given theme.

PHPClass Innovation Award-Sanjoy Ganguly

PHPClass Innovation Award-January 2009

Download Now

Categories: PHP

PHP CAPTCHA with Refresh :: Phpclasses Contribution

November 3, 2009 Leave a comment

This class can be used to generate CAPTCHA validation images.

It generates an image with a given width and height display a random validation text with a given length. The generated random text is stored in a session variable for posterior validation.

The generated image is obfuscated by a given background image before being served as the current script output in JPEG format.
Categories: PHP

What Is PHP

October 20, 2009 Leave a comment

PHP, which stands for PHP Hypertext Preprocessor, is a server-side  scripting language. In non-technical terms: a PHP processor is run on the server (Windows, or a flavor of UNIX). When a page is requested that contains PHP, the processor translates and executes all the commands in the page, and then outputs the result to the browser as regular HTML. Because this translation occurs on the server, a page written with PHP is viewable with any browser, on any operation system.

Like most other scripting languages, PHP can be embedded directly into HTML. PHP code is separated from HTML by Start and End entities. When a document is parsed, the PHP processor only interprets the demarked areas, and outputs the results in the same position.

Ironically, PHP also includes the ability to almost completely separate code from HTML. For larger, collaborative projects this method is ideal because it allows designers to work on the layout of the page without interfering with the code aspects.

A Little History

PHP was introduced in 1994 as a loose collection of freeware scripts based on Perl and dubbed “Personal Home Page” Tools. The author, Rasmus Lerdorf, received surprising interest in the package from the professional and developer communities. By 1995, a mailing list had been established where other developers could provide feedback, bug-fixes and code ideas on the scripts.

Encouraged to expand the original package with additional features, Lerdorf released PHP-FI (or PHP2) in 1995. This version included the ability take the information submitted by forms on the web and convert it to usable variables. What was so important about this function was that it enabled user input to be captured and acted upon, allowing more complex and interactive web applications to be developed.

It was around this time that PHP changed from being a one-man project to one with a group of 7 core developers. Together, they refined the syntax of the language, added additional functions and methods, and the ability for other programmers to extend the capabilities of the language by plugging in modules.

With the release of version 3 in 1998, PHP had finally grown into its own. Like C and Perl, PHP is a structured programming language with variables, functions and classes. Its similarity to these languages encouraged experienced programmers to migrate to PHP and its ease of use rapidly won new users.

By version 3, PHP also included database support for a wide variety of platforms including mysql, mSQL, ODBC, Oracle and Sybase. It also was able to work with images, files, FTP, XML, and a host of other technologies.

The latest release of PHP is version 4. Rebuilt with a more powerful core processor, the new PHP engine (the Zend parsing engine) offers significant speed improvements over previous versions. PHP4 also includes sessions support (an easier way of working with cookies), and numerous smaller additions and improvements.

To date, PHP is still free and a frontrunner in the open source movement. However, unlike many open source projects, it’s becoming more and more mainstream as an increasing number of businesses and organizations are making the switch to it.

For professional developers, one of the most exciting things has been the release of the Zend Encoder, which allows PHP source code to be encrypted. The Encoder carries a hefty price tag, but it holds the promise of more built in value for those selling custom scripts.

Why PHP?

It’s no secret that there are alternatives to PHP: ASP, Cold Fusion, and Perl, to name just a few. While each of these languages has differences in syntax and structure, when it comes down to it, they can all produce the same results.

So, why would you choose PHP over other options?

Simplicity. For people new to programming, this is frequently the strongest appeal. Even those with little or no programming experience can quickly get up to speed and begin creating full-fledged applications. Because it was specifically designed for creating web applications, PHP has a host of built-in functions to handle common needs.

PHP is Open Source. Because PHP’s source code is freely available, a community of developers is always working to improve, add to, and find bugs in the language. Open Source means you never need to rely on the manufacturer to release the next version if something doesn’t work or pay for expensive upgrades.

Stability, and compatibility. Currently, PHP runs stable on a range of operating systems including most flavors of UNIX, Windows and Macs and integrates well with most popular servers including IIS and apache.

PHP is also endowed with other goodies, like native support for many popular databases, an extensible architecture, and a processor that not only uses fewer resources on the server than many of its competitors, but also displays pages in record time.


This article is the first in a series, covering everything from the basics of PHP to advanced topics and including information on related subjects such as databases and XML, as they apply to PHP.

Generally, PHP is a very easy language to learn. If you have worked with another structured programming language like C, or Perl, some of PHP will seem very familiar to you, and you’ll find the language very easy to pick up. But keep in mind that previous experience in programming is not a pre-requisite for learning PHP or for understanding the concepts presented in this series. The only thing that is required is a desire to make the leap to server-side programming, and a thorough understanding of HTML.

About every week or so, we’ll be taking a look at a new concept or theory of the language. The emphasis will be on providing the tools needed to start programming real, usable applications as quickly as possible. Cumulative, real-world examples will provide a taste of how to structure your own scripts, as well as present solutions to situations you will often encounter in your own work.

Whether you began reading because you needed to complete a specific project, or because you were just curious, by the end of this series you can expect to know what’s involved in building dynamic data-drive sites. You will also have a virtual toolbox of code snippets and script design tricks you can pull out when needed.

Most importantly, you will have the knowledge to successfully develop your own projects from start to finish.

Categories: PHP Tags: