background preloader


Facebook Twitter

55 Awesome PHP Tutorials for Noobs. Upload File – Send HTML Format Email with Attachment Using PHP - Email Systems - php Magic Book. How to create chained select with PHP and jQuery. In this article we’ll talk about the chaining of select also called select cascade.

How to create chained select with PHP and jQuery

It is a procedure that we often find on the web and it consists in giving the user the possibility to find a specific data through a few passages: practically choosing a category in the first select, the second one will be populated with the results related with the category selected. We imagine, for example, a first select where it is possible to choose between motorcycles and cars; once we selected the car category , the second select will be populated with the brands of the cars available.

Then selecting a brand, the third select will be populated with the models available of this brand. Check your PHP code at every level with unit tests. It's 3 a.m.

Check your PHP code at every level with unit tests

Do you know if your code is still working? Web applications run 24x7, and wondering whether my application is still running has kept me up at night. Unit testing has helped me gain significant confidence in my code -- and get a good night's sleep. Unit tests are a framework for writing tests on code and running those tests automatically. Test-driven development is a unit test methodology that says that you first write the test and verify that tests find the errors, then write the code required for the tests to pass. PHP unit tests For PHP, the unit test framework is PHPUnit2.

After you've installed the framework, you can begin writing unit tests by creating test classes that derive from PHPUnit2_Framework_TestCase. Learn PHP Online Free. PHP Method Chaining, plus Magic Setters (similar to jQuery) Send Text Messages with PHP. Kids these days, I tell ya.

Send Text Messages with PHP

All they care about is the technology. The video games. PHP: Dynamic Image Generation. Creating images on the fly can be a very useful skill.

PHP: Dynamic Image Generation

PHP has some built-in image generation functions, further more, to generate new images or edit existing images on the fly using PHP, we need to have the GD library installed. In this tutorial we will show you how to get quite interesting and useful effects using image handling functions. We will review two practical tasks: creating security images (captcha) on the fly and building a bar chart using numerical values retrieved from MySQL database. Creating security images on the fly At first, have a look at the following script that creates captcha image. Create_image(); exit(); function create_image() { $md5 = md5(rand(0,999)); $pass = substr($md5, 10, 5); $width = 100; $height = 20; $image = ImageCreate($width, $height);

Building a Bulletproof Contact Form with PHP. The web professional's online magazine of choice.

Building a Bulletproof Contact Form with PHP

In: Articles By Matthew Pennell Published on October 15, 2007 The humble contact form: It’s the cornerstone of nearly every website, from the humble personal blog right up to the corporate megasite—and a billion small business sites in-between. In the early years of operating a website, we were happy to put our shiny new email address out there for anyone to mailto, but the rise of the spammer has made us justifiably wary of publicizing our contact details—enter the contact form. Setting the Groundwork By entering malicious data into our innocent contact form, hackers or spammers can fool the PHP script into doing something that you didn’t intend it to do. Our contact form will actually consist of three separate files: form.html containing a standard HTML form to collect the data process-form.php which handles the submitted data, and success.html to display a simple thank you message First, we have form.html.

SQL Injection. Many web developers are unaware of how SQL queries can be tampered with, and assume that an SQL query is a trusted command.

SQL Injection

It means that SQL queries are able to circumvent access controls, thereby bypassing standard authentication and authorization checks, and sometimes SQL queries even may allow access to host operating system level commands. Direct SQL Command Injection is a technique where an attacker creates or alters existing SQL commands to expose hidden data, or to override valuable ones, or even to execute dangerous system level commands on the database host. This is accomplished by the application taking user input and combining it with static parameters to build an SQL query.

The following examples are based on true stories, unfortunately. Owing to the lack of input validation and connecting to the database on behalf of a superuser or the one who can create users, the attacker may create a superuser in your database. PHP Payment Library for Paypal, and 2Checkout. Update: This library has gone through full re-write and the uploaded version can be found here.

PHP Payment Library for Paypal, and 2Checkout

If you are like me, whenever you need to work with a 3rd party API or a gateway, you’d first search in Google for a possible wrapper for it in PHP. When it comes to supporting payment gateways, you get bunch of libraries in the search results who are fundamentally different. Some of them are old PHP 3/4 ones, some are new, some may need PEAR, etc. As they were not required together in one single project, I used them whenever needed. But in one project, I needed them all. So, here is an abstract PaymentGateway library which is being extended to be used for three popular payment gateways (Paypal,, and 2Checkout) in order to provide you with a similar way of using them. DownloadNo download available for this version. Paypal. PHP AJAX example: asynchronous file upload. Practical PHP Programming.

43 Must Read PHP Articles and Resources. Extremely useful PHP classes. PHP PSD Reader A few weeks ago, I wrote an article about this PHP which allow you to display any Adobe PSD file on screen.

extremely useful PHP classes

Very usefull to create preview of PSDs designed for clients, for example.Download Browser detect One of the most common (and boring) problem for front-end developers is definitely cross-browser compatibility. This PHP class will detect almost all browsers and simplify your cross-browser work.Download. PHP for Beginners: Building Your First Simple CMS.