Stop WordPress Comment Spam

Yes, Akismet can be of huge help when fighting with comment spam, but it can’t help against the most sophisticated auto-commenting tools which make fake comments look very real....

How to Fix a “unexpected $end” Error

Sometimes you will get an error similar to this in PHP: Parse error: syntax error, unexpected $end in /index.php on line 36 This is most likely caused by a forgotten closing curly bracket (“}...

How to Set a Cookie to Never Expire

Sometimes, while working with Cookies in PHP you may want to make a cookie never expire (e.g. in a rating script where you set a cookie on user’s computers, although it’s not wise to use c...

PHP Login Script Example

This PHP login script example is a very simple login system which you can use as a base for your future projects. You should note that it needs to be secured before using on a live system. Some things...

Simple PHP HTTP Authentication

Sometimes you may want to hide the contents of a page (e.g. admin page) in a very simple manner. The best and simplest method is to use the PHP’s built in HTTP authentication. It’s both se...

“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....

Search and Replace in MySQL

Often your MySQL database is so large that if you want to find and replace a given entry, it will take days. This is when this simple snippet comes handy:...

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...