“I Can’t Access a Cookie I Set In PHP”

A lot of people (including me) experience problem accessing a cookie immediately after setting it. The thing is that you can’t access a cookie inside the same request that is used to set it....

Optimize PHP Script – Best Tips

Using PHP is great for dynamic website. However, more dynamic means more resource hungry. Here is a short list of tips you should follow to avoid putting the PHP interpreter in difficulty....

Credit Card Validation Function

Whethere you are building a shopping cart or just requesting your customer’s credit card number for some purpose, we are constantly faced with abusers that fill invalid or fake credit card numbe...

Simple Random Password Generator

This is a simple script that will generate a random alphanumeric password with customizeable lenght. [ad name=”In Post”] Usage is as follows: The example above will return a random passwor...

Set PHP Script Timeout

Most of the times the PHP script timeout is set by default by your hosting company to 30 seconds. This means that after 30 seconds of running, your script is immediately killed, which means that all t...

Simple PHP Script to Send Email with Mail()

There are three requirements for sending email through a PHP script: A form, an email processing script, and PHP’s mail() function to be enabled (most hosts have this enabled, but some shared ho...

How to Create a PHP Redirect?

Sometimes you want to hide an affiliate link, sometimes you may want to log each downloads of a file or just redirect the user to a site through your script. This is where PHP redirection comes handy....

Download Remote File Using CURL and PHP

Sometimes you need to download URL’s contents using the CURL library, included inside PHP (e.g if you want to use a web-based API, provided by service like TinyURL, Digg, Twitter). It’s ac...

PHP Script to Show Visitor’s IP Address

Sometimes you want to get the visitor’s IP address (e.g to show it to him or for logging purposes). This simple snippet does the job: $ip = $_SERVER['REMOTE_ADDR']; Also, if you have REGISTER_GL...

Top Online IDEs to Test Your PHP Code

Sometimes you don’t have an Apache server on your PC and you don’t want to go through the hassle of uploading your PHP script to your web hosting space just to test if your tweaks inside t...

Convert Text to Barcode Image

Thanks to a skilled PHP programmer, the internet has a ready made PHP script that takes a text string and returns an image representation in barcode format. Here’s the complete script: =1 to ena...