www.quake3world.com/cgi-bin/Ultimate.cgi has an example, the rank create cgi is just a simple rank coder, just upload it and call it to see how it looks like.
Okay, here I go again, this script allows the user to code his own icon, and! to upload an icon. It uses Ythan's image upload script. I've included inside Spawns documentation of the original image upload hack incase you wanna use the script for both things.
Oh, and it's pretty secure, it checks the rank and icon fields for HTML and does a censor check too. Maximum limit of 18 characters for the rank, which is easily changed =)