MySQL log files are taking a lot of disk space – How to disable and delete them?

I have WAMP server installed on my local computer for PHP and MySQL development. After using it for a while, the MySQL installation folder has run up some seriously huge log files that are taking enormous amount of disk space. We are talking 10s of GB here. The file names are like ibdata1, mysql-bin.000017, etc.. …

MySQL log files are taking a lot of disk space – How to disable and delete them? Read More »

MySQL: Change Default Character Set or Default Collation in phpMyAdmin

It can be annoying when MySQL imports your UTF8 database (which contains exotic characters other than those in English) in the default character set of latin1_swedish_ci, jeopardizing the text content. It is also annoying when phpMyAdmin does the same and when you forgot to set the collation to utf8_general_ci for the new database which is …

MySQL: Change Default Character Set or Default Collation in phpMyAdmin Read More »

Regular Expression for Date and Time Strings

Often we need the users to enter a valid string of date or time in the form. But how do you validate the strings with regular expressions? In PHP, you can use these functions and regular expressions. RegExp and function to validate against date string: // Default: YYYY-MM-DD function isDate($subject, $separator = ‘-‘) { return …

Regular Expression for Date and Time Strings Read More »

Regular Expressions for Natural Numbers or Positive Integers (1, 2, 3, …), Negative Integers and Non-negative Integers

When I’m developing the online form creator that enables the users to create form fields that accept only certain type of numbers, I need to verify if a given string is a valid natural number such as 1, 2, 3, 4, …. I’m writing the code / functions in PHP but you can literally use …

Regular Expressions for Natural Numbers or Positive Integers (1, 2, 3, …), Negative Integers and Non-negative Integers Read More »

PHP: True empty() function to check if a string is empty or zero in length

The strange thing is that the native empty() function of PHP treats a string of ‘0’ as empty: $str = ‘0’; echo empty($str) ? ’empty’ : ‘non-empty’; And it will output ’empty’. Therefore if you need to examine if a string is truly an empty string with zero length, you have to use: echo strlen($str) …

PHP: True empty() function to check if a string is empty or zero in length Read More »

PHP: Checking Text Strings against Reserved or Censored Words

I created a free online web form builder a while back and since it went well in search engine rankings, spammers and phishers found it and started to use it creating forms to collect email account usernames and passwords through phishing attempts. I’ve got to do something before my host closes down my site because …

PHP: Checking Text Strings against Reserved or Censored Words Read More »

How to create / generate .htpasswd password with PHP dynamically?

The easy way to add a username and password pair in the .htpasswd file is to use an online password generator tool that converts the clear text password into its hash, a.k.a. the encrypted password. The problem with this approach is that you have to manually create the pair and append it to .htpasswd. Is …

How to create / generate .htpasswd password with PHP dynamically? Read More »

Check how much memory your PHP script is using. (PHP script memory usage)

Depending on the web server software you use, your PHP script will be consuming significantly different amount of memory (RAM). If you are using Apache without proper optimization, the simplest request that does nothing but returns a status code will need 150kB of memory. Multiply this by 2000 visits per day and by 10 sites …

Check how much memory your PHP script is using. (PHP script memory usage) Read More »

Shady GoDaddy: How to cancel private registration for your domain renewals?

If you accepted GoDaddy’s offer of the first-year-free private registration service for your domain, you would not be so happy when you are renewing the domain for more years because you will find the private registration is bound to that domain. You can either renew the domain WITH the private registration which costs an extra …

Shady GoDaddy: How to cancel private registration for your domain renewals? Read More »

How to hide and force the visitor to click your referral or affiliate link?

There are primarily 2 ways for merchants to set up an affiliate program, one is to offer coupons that are assigned to the affiliates and can be spread out. When someone uses that coupon, the merchant knows it’s a referral by that affiliate. The other is to create dedicated links with the affiliate ID in …

How to hide and force the visitor to click your referral or affiliate link? Read More »

Amazon Associate (Affiliate) Program Review: Why I love them

Go to Amazon.com: http://www.amazon.com There are tens of thousands of different affiliate programs out there you can use to monetize your traffic. A few of the biggest players are ClickBank, eBay, Amazon, CJ and Google Affiliate Network. Unlike CJ and Google Affiliate Network who are simply brokers of merchants and affiliates, Amazon and eBay are independent …

Amazon Associate (Affiliate) Program Review: Why I love them Read More »

Godaddy $7.69 .org domain registration coupon promo code

Update: Here’s the latest coupon code of Godaddy – $1.49 / year .com God knows why they have raised the .org registration fee to $14.99. I don’t know if it’s temporary or just the way it will be for a long time to come but it’s outrageous. Fortunately I have found this .org domain registration …

Godaddy $7.69 .org domain registration coupon promo code Read More »

Scroll to Top