Category Archives: PHP

HTTP authentication with PHP

December 30, 2012 2078 views 1 comments

It is possible to use the header() function to send an “Authentication Required” message to the client browser causing it to pop up a Username/Password input window. Once the user has filled in a username and a password, the URL containing the PHP script will be called again with the predefined variables PHP_AUTH_USER, PHP_AUTH_PW, and [...]

PHP Image and Text Watermark

December 30, 2012 39001 views 4 comments

I received many tutorial requests from clients that asked how to generate watermark image using PHP. In this post, I coded two functions such as watermark_text() and watermark_image() to generate text and images watermarks on images. Integrate this to your web project upload image system and produce copyright photos. Watermark with Text – watermark_text() Text [...]

Optimizing CSS. Five simple steps !

December 30, 2012 1389 views 0 comments

In the spirit of the optimization wave this post is about CSS optimization. There are some simple rules that you can apply. I’m pretty sure most of us have already been familiar with that list, but you never know. 1. Minify As the JavaScript the CSS also can be minified. This only strips every character [...]

Base64 Encoding for Images in PHP

December 30, 2012 7571 views 0 comments

Base64 is an encoding format that represent binary data. Google new feature instant previews are in text format, here Google requesting images(screen shots) are in string format to reduce server load time. In this post I will show you how to make images to strings with PHP. PHP images to strings PHP terminology there is [...]

5 tips and tools to develop php applications fast

December 30, 2012 3536 views 1 comments

When web applications like basecamp started appearing, a lot of attention started turning to Ruby on Rails. Suddenly small groups of technically driven people could release powerful applications in a month or two. With this awareness, the usability standards for web applications increased and so did the technical challenges for web developers and designers. This [...]

Server Side Form Validation using Regular Expressions

December 30, 2012 10472 views 1 comments

validation.php Contains PHP code. eregi — Case insensitive regular expression match. <?php if($_POST) { $name = $_POST['name']; $email = $_POST['email']; $username = $_POST['username']; $password = $_POST['password']; $gender = $_POST['gender']; // Full Name if (eregi(‘^[A-Za-z0-9 ]{3,20}$’,$name)) { $valid_name=$name; } else { $error_name=’Enter valid Name.’; } // Email if (eregi(‘^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$’, $email)) { $valid_email=$email; } else { $error_email=’Enter [...]

Prepared Statements in PHP and MySQLi

December 30, 2012 3903 views 2 comments

This article is intended for readers who have experience using PHP and MySQL. You should also have a general understanding of databases and programming (both procedural and object-oriented) as well as how to use PHP to execute a simple query to MySQL. I will not cover how to install PHP or MySQL, however at the [...]

Htaccess File Inside The Folder

December 30, 2012 1777 views 6 comments

How to use .htaccess file inside the folder. I’m using two .htaccess files in my hosting, one for and another for Just take a look at this post how I had implemented. (domain: Original URL : to Friendly URL : First .htaccess file This code redirects sub domain pointing [...]