Random number in PHP
Real quick little function to get a random number using PHP.
The variable $x will contain a random number between 1 and 100.
It's rand(min, max) if you don't want to use 1 and 100 as your limits.
Real quick little function to get a random number using PHP.
The variable $x will contain a random number between 1 and 100.
It's rand(min, max) if you don't want to use 1 and 100 as your limits.
This function returns 'win' if running on a Windows server and 'linux' if not running on a Windows server. It should be pretty easy to extend it to match other server operating systems, but this is all I needed. Read the rest of this entry »
The following function will return TRUE if the server is running PHP in safe mode. It uses the function ini_get, which may be disabled. If ini_get is disabled then the function also returns TRUE since the assumption that any server disabling functions would probably also be running in safe mode. Read the rest of this entry »
Knowing what version of ImageMagick is usually important if you're going to be shelling to it to perform tasks. For me it was the --sepia-tone option that was added in either 6.2.1 or 6.2.2. Prior to that, using that option caused the conversion to fail.
The following function will return the numeric version of ImageMagick you have installed. Read the rest of this entry »
Wanting to keep pages out of the SERPS that I felt shouldn't be there I started using the following robots.txt file on a SimpleMachines forum site of mine.
On my first Wordpress site I went and added all of the files I didn't want search engines indexing to my robots.txt file thinking that it was necessary to keep them out of the SERPS. But Wordpress makes it easier than I was trying to make it by starting almost every file in the root, and all subfolders, with 'wp-'. With a 2 line robots.txt file you can block most everything that needs to be blocked.
You know, I've pretty well accepted that I'm going to have email spam get through to my inbox. Even with Thunderbird's spam filtering, it still gets through. But today I got a spam message from an SEO company called The Search Doctors and it just hit the wrong nerve. Read the rest of this entry »
One of the fears of AdSense users is that they will accidentally click on an ad on their own site and get banned by Google. I've always assumed that these fears are a little over-hyped. I just can't see one accidental click causing you to get dropped. Of course you certainly don't want to make a habit out of "accidental" clicks.
But there is another reason to not have AdSense ads shown to you on your own sites. By having them visible you can really skew your stats. So what can you do?
One of the functions added in PHP 5 is file_get_contents. This function allows you to just pass a file name and it will return the entire contents of the file. That's all well and good if you're using PHP5, but PHP4 is still very common. Read the rest of this entry »
Akismet recently passed the 100,000,000 mark on spam messages blocked. Based on the assumption that you spend 1 second per spam message that hits your blog, they estimate that they have save blog authors 27,777 hours by blocking these postings.
Of course as I'm writing this the count just keeps increasing. In fact, the counter is almost to 102 million, with 1.1 million blocked just today. What shocked me is that 94% of all messages are spam, although it really shouldn't be shocking.