Cracking PHP rand()

Webapps occasionaly need to create tokens that are hard to guess. For example for session tokens or CSRF tokens, or in forgot password functionality where you get a token mailed to reset your password. These tokens should be cryptographically secure, but are often made by calling rand() multiple times and transforming the output to a string. This post will explore how hard it is to predict a token made with rand().

How to add conditional analytics tracking code in WordPress Multisite

In my WordPress multisite, I use one theme for three sites and a tracking code for analytics on my websites. Whether it is Google Analytics or Piwik doesn't matter. Here is how you can conditionally add tracking codes to your WordPress Multisite: Use a condition in functions.php to add the tracking code for Piwik/Matomo Analytics or Google Analytics.

Convert PHP ext/mysql to MySQLi

Learn how to convert PHP mysql functions to PHP MySQLi extension. The old ext/mysql extension is deprecated as of PHP 5.5.0 and therefore it's a must to migrate away from using it and towards MySQLi or PHP Data Object (PDO). This post will show you how.
get current PHP realpath_cache_size value

How to set a good PHP realpath_cache_size

Learn how to set a good PHP realpath_cache_size and optimize your PHP performance. . Increasing realpath_cache_size might greatly improve PHP performance, as PHP states: "this value should be increased on systems where PHP opens many files." Setting a correct value for PHP realpath_cache_size can greatly improve PHP performance and optimize WordPress - and other CMS's - websites.

Display commas in WordPress tags

Sometimes you may want to display commas in tag names. For example if you have a business directory listing and want to create one single taxonomy (tag name) "cafe, restaurant, bar". This post shows you how to create a filter in your functions.php file to display WordPress tags with a comma, enjoy!