April 22, 2008

Write ASP and need a way to block IP’s from your site?

This demonstrates how to ban a single IP address, later, I’ll show how to ban whole networks but chances are you will be able to work that out for yourself anyway after reading this anyway.

If global.asa does not exist then create it and add the following:

sub session_onstart
 
  ip = request.servervariables("Remote_Addr")
 
  select case ip
    case "111.111.111.111", "111.111.111.112", "111.111.111.123"
      response.redirect "http://www.example.com"
  end select
 
end sub

Replace 111.111.111.11x with the IP addresses you wish to ban, note they are comma separated and the last one is not followed with a comma.

You can change the redirection to a page on your site that informs them they are no longer allowed (a bit vindictive), to a blank page is probably best or you could even forward them on to a competitor :D

November 29, 2007

Mass Category Adder Plugin for Wordpress

If you create a lot of Wordpress blogs you probably like to prepare a list of categories for inclusion.  This plugin simplifies the process by allowing you to add them all at once.

Mass Category Adder Plugin for Wordpress

Add one category per line then click the “Add Categories” button.  All categories will be created for you turning a 30 minute job into a 5 second one :)

Installation

Upload the masscats folder to your plugin folder.  Activate the plugin and then locate the “Mass Category Adder” menu in the Wordpress “Manage” menu.

Download Mass Category Adder Plugin

August 1, 2007

Send mail from the command line

Ever need to send a one-line email from a DOS/CMD batch file? If your PC or Server has .Net 2 installed you can use this application.

It’s straightforward. Place the cmdSendmail.exe in your path or working directory and then type something like this at the command line:-

cmdSendMail you@emailtest.com~you@somewherelse.com~The Subject~The main text of the message~you@somewherelse.com~pass123~mail.somewherelse.com

Usage

cmdSemdMail {command string delimited by tilde}

To send an email create a single string with all the paramters of your message. Use the tilde (~) to delimit the paramters of your email.

cmdSendMail Download

August 1, 2007

Two ways to call a URL from a batch

Sometimes it’s useful to extract a web page to a file from a Windows batch.

For example I have a batch file that downloads financial figures every day, processes them and updates a database.

vbcurl http://myfinancialfigures.com/something.php >mydatafile.htm

If you don’t have a copy of Opera handy use a statement like the following to read the source from a page that blocks right click:-

vbcurl http://annoyingwebsitesthat.com/blockrightclicks.php >secret_source.htm

Vbcurl

July 24, 2007

Encrypt PayPal or AlertPay button code

Encrypt HTML

Click the above link to download a small tool for encrypting small chunks of HTML such as PayPal and AlertPay buttons. It doesn’t actually encrypt code it obfuscates it which is a fancy way of saying it jumbles it up a bit. It’s enough to deter the casual thief from checking out the successful return URL where he might find your goodies.

It’s a VB6 application (Google site:microsoft.com vb6 runtimes if you don’t have them already).

Free to use but usual disclaimers, use at your own risk etc..