Category Archives: Code Snippets

Here you will find various snippets and code examples that I have used to make some thing in my life a little easier to deal with.

Missing IP address in email reports with (D)DoS-Deflate 0.6

First let me say that the guys over at Media Layer did a great job with (D)DoS-Deflate.

We installed the utility by following their installation instructions on the above linked page. We made on modification to the script by lowering the number of connections allowed to 50 thinking it would be acceptable for normal traffic. Shortly after, we were locked out of our own server… duh. After rebooting our DSL modem to get a new IP address, we quickly logged in and reverted to the suggested count of 150. From our experience, take the advice of the team that wrote the script 😉

The notification emails starting coming through letting us know when IP addresses were being blocked because they had more than 150 connections to our server at one time. After which we noticed the script was reporting the connection count as both the count and IP address.

Continue reading

.htaccess redirect query string using mod_rewrite to another query string

I recently had the need to redirect one query string to another query string. The reason for this was we created a new item in our Zen Cart software that took the place of 3 other items. To make sure the search engines and our visitors reached the new product instead of the old ones, the following code was used to redirect them accordingly.

Continue reading

Urchin Stopped Reporting Statistics

Earlier today, one of our hosting customers notified me that there Urchin stats stopped reporting traffic around the beginning of May. Of course my first questions was “why did you wait until now to tell me?” After which I started Googling the problem. I found the solution regarding How do I recover from ‘Unable to open database for writing since it has been archived’ error?.

Continue reading