Archive for July, 2006

Random number in PHP

Posted in Programming  

Real quick little function to get a random number using PHP.

PHP:
  1. $x = rand(1,100);

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.

Get server operating system in PHP

Posted in Programming  

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 »

is_safe_mode function for PHP

Posted in Programming  

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 »

Get ImageMagick version with PHP

Posted in Programming  

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 »

robots.txt for SimpleMachines forum

Posted in Internet  

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.

CODE:
  1. User-Agent: *
  2. Disallow: /index.php?action=search
  3. Disallow: /index.php?action=calendar
  4. Disallow: /index.php?action=login
  5. Disallow: /index.php?action=register
  6. Disallow: /index.php?action=profile
  7. Disallow: /index.php?action=stats
  8. Disallow: /index.php?action=activate
  9. Disallow: /index.php?action=help
  10. Disallow: /index.php?action=admin
  11. Disallow: /index.php?action=pm
  12. Disallow: /index.php?action=mlist
  13. Disallow: /index.php?action=notify
  14. Disallow: /index.php?action=post
  15. Disallow: /index.php?action=markasread
  16. Disallow: /index.php?action=sendtopic
  17. Disallow: /index.php?action=printpage
  18. Disallow: /attachments/
  19. Disallow: /avatars/
  20. Disallow: /Packages/
  21. Disallow: /sitemaps/
  22. Disallow: /Smileys/
  23. Disallow: /Sources/
  24. Disallow: /Themes/

robots.txt for WordPress - short & sweet

Posted in Blogging  

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.

CODE:
  1. User-agent: *
  2. Disallow: /wp-

SEO company sending me spam

Posted in Internet, Programming  

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 »

Blocking AdSense ads on your own site

Posted in Internet, Programming  

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?

Read the rest of this entry »

file_get_contents function for PHP 4

Posted in Programming  

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 »

100,000,000 spam postings blocked

Posted in Blogging  

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.


Technorati : , ,
Del.icio.us : , ,
Ice Rocket : , ,

« Previous Entries