|
Tony on MySpace











|
My source code page
I am not a programmer. I know programmers, and I am not one.
Programmers spend at least 40 hours a week writing code. Programmers
get paid for their work. These do not describe me. I was a
professional programmer for a while, and even then, I wasn't very good.
I write scripts only when I can't find a program to do what I want. I
don't comment my code. I don't declare my variables, or use naming
conventions. I use nested IF statements instead of switch/case
statements. I hard code things that should be variables. I look
at other people's code and copy and paste it into my own. I stop
working as soon as it does what I want.
Okay, with that said, I get people asking me for my code. Since I
steal most of it from other people, it doesn't seem right for me to keep it
to myself. So maybe you can learn from the scripts that I've put
together. If you use something,
send me a note and let me know. If you have questions, please
ask me.
AOL Instant Messenger Scripts
|
| AIM Gateway for phones that speak
do AOL Instant Messenger over SMS (in Perl) |
This script was the first AIM bot that I wrote. My cell phone
can exchange messages with the AOL Instant Messenger network, but it
can't accept messages over 200-something characters in length. So
I wrote this script to allow my phone to talk with SmarterChild, a
useful AIM bot. |
| AIM-to-SMTP Gateway (in Perl) |
This perl script works with IIS' SMTP server to exchange messages
between AIM and SMTP. This enables mobile phone/pager users who
can read and write messages to chat with people on the AOL Instant
Messenger network More information here. |
Photo Album Stuff
Everything in this section requires
this access database, and accesses it through an ODBC DSN named
'comments'. I use .HTM and .ASP extensions, but either way, it's
actually an ASP/VBScript. The code here is really, really bad, but
it's at least reasonably stable because I get about 40,000 page views
per month, and at least one of these scripts execute on every page.
It seems "fast enough" on my old computer.
It is not secure at all (none of this is). |
| Ratings engine (right-click, pick
Save Target As) (ASP VBScript) |
This is the code that makes the 'Rate this picture' thing
at the top of every picture in my
photo album. The concept was stolen from
hotornot,
photo.net, and like dozens of other
sites that do the same thing. I include the entire file using an
ASP include into each picture of my photo album (which is generated with
the Arles Image Web Page Creator, more info below). It inserts the
results into the tblRatings table of the
main Microsoft Access database
that this site uses. You'll notice that it inserts the ASP Session
ID into the tblRatings, too--this is to prevent people from rating the
same picture more than once in a single session. I added this
because people (you guessed it) rated the same page more than once in a
single session by clicking the Back button in their browser. No
big deal, they just wanted to change their rating. After someone
rates their second picture, they get sent to the picture with the fewest
ratings in the same category, so that pictures within a single category
get fairly even numbers of ratings. After you rate a picture, the
next picture includes a thumbnail of the picture you just rated, the new
rating, and the number of ratings (again, stolen from
hotornot). If they have
rated every picture within a category, they get directed to the /crap/category
folder, if it exists (this is an example of how I hard code things into
my code). If they've rated everything in the category and /crap/category
folder, they get sent back to the main picture index to pick a different
picture. |
| Page that lists last 100 ratings
(right-click, pick Save Target As) (ASP VBScript) |
Pretty simple stuff. I just use it for my own reference.
You can see it in action here. |
| Comments include engine
(right-click, pick Save Target As) (ASP VBScript) |
Like the ratings engine above, I insert this into every page on my
site. The form posts to the comments add engine (right below
this), which inserts the comment into the database and redirects the
user back to the page they came from. I copied most of this from
someone else. The person I copied it from was building something
that looked like a forum script, and included names and e-mail addresses
for the people posting. I found out that people wouldn't post if I
required e-mail addresses and full names, so I just made it anonymous.
Of course, now people write things like "animals having sex animals
having sex", but it still strikes me as funny, so I'm okay with it.
You can see this in action at the bottom of this (and every) page. |
| Comments add engine |
The script right above posts to this script, which adds the comment
to the database and redirects the user to the page they came from. |
| Page that lists the comments
(right-click, pick Save Target As) |
As seen here. |
| Perl script that parses Arles Image Web
Page Creator files |
This script parses
Arles Image Web Page Creator html files, and adds the JPG filenames,
descriptions, etc. into the access database that my photo album uses.
Yes, I know this is a bizarre way to do things. Why would I put my
photo descriptions into Arles proprietary format, use Arles to produce
very simple HTML, and then extract the descriptions back from the result
HTML files? Just legacy... I used Arles when I was looking for a
very quick photo album solution, and I haven't yet switched away.
Obviously nobody would start a photo album application this way.
Anyway, I had to write this script, because I had written descriptions
for like a 1000 photos and didn't want to type them in again.
I have to run this every time I re-run Arles, because it is
the only way to pick up changes to the HTML. I copied most of this
script from another script. |
| Photo Album Index Page Template
(right-click, pick Save Target As) |
This is an ASP VBScript (ignore the .HTM extension) that shows an
index of all the photos in the current folder and their ratings.
It has my header and toolbar includes. Like I said, I'm really
lazy about this. |
| Perl script that copies the
Photo Album Index Page Template |
Right above this, I describe a photo album index page that works
regardless of the folder that you drop it in. This script copies
the template to every folder described in the database. |
| Top rated pictures page (right-click,
pick Save Target As) (ASP VBScript) |
You can see it in action here.
This includes all my include files, because I'm too lazy to strip them
out. That's up to you. |
| Bottom rated pictures page
(right-click, pick Save Target As) (ASP VBScript) |
You can see it in action here.
It's the same as the top rated pictures page, but sorts in the opposite
direction. This is not brain science. This includes all my
include files, because I'm too lazy to strip them out. That's up
to you. |
| Redirects to an HTML page based on the
JPG filename (ASP VBScript) |
One of the problems with Arles is that it names HTML files
numerically. So the first picture in a folder gets the name
photo1.html, then photo2.html, etc. If you add or remove folders
from a folder, photo1.html will actually be a different picture.
So, every link will point to the wrong picture. This script allow
me to give a URL like:
http://www.northrup.org/viewpic.asp?pic=/photos/Sammy/low/DSCN0222.JPG
and have it always link to the right photo, even if Arles changes the
HTML names around on me. I do this in my
photo equipment reviews. |
| My Arles Image Web Page Creator
config files |
There are four versions of my photo album:
low-resolution without frames,
low-resolution with frames,
high-resolution without frames,
high-resolution with frames.
Within Arles, I open all four (in separate Arles windows). I do
multi-folder processing for each of the four configs. On low-res
without frames and high-res without frames, I do the full processing
(creates HTML, thumbnails, and images). On low-res with frames and
low-res without frames, I only create the HTML (because they use the
same thumbnails and images, see?). The result files include
references to my ASP scripts, available for download in this section.
A more detailed description of how these work, from an e-mail I wrote to
a friend: the way I have it set up, each category gets its own
directory. So, animals are in /photos/animals/, pictures of my cat are
in /photos/sammy/. All HTML files go into this directory, but no image
files. For the HTML files, I run Arles 4 times. Once for no-frames,
small size (the default on my site), another for no-frames, big size,
frames small, frames big. I prefix the HTML files (configured within
Arles) with nl- (which stands for noframes, low bandwidth), nh- (noframes,
high bandwidth), fl- (frames, low) and fh- (frames high).
Within each folder are two subdirectories: /low/ and /high/. So, there
is a /photos/sammy/high/ which contains all the .jpg files (both
thumbnails and regular size). The nl- and fl- HTML pages link to the
images in /low/ and the nh- and fh- pages link to /high/.
I save the Arles configuration each way, and have to run all four each
time I add pictures. To make the pages link to each other ("bigger pics",
"with frames") I customize the HTML within Arles. It has to be different
for each of the four different profiles. Actually, that's the way I used
to do it--now I do it using ASP VBScript, to make it easier to maintain. |
| Photo Album/Comments Microsoft
Access Database |
I've been a database administrator, so you'd think I would take a
little more pride. This is a terrible database design. I
have lots of tables and queries in here that the application does not
use. Also, the database I'm making available for download is my
actual database, complete with data. So you're going to need to
replace it with your own. But I'm too lazy to strip out all the
rows, so that is up to you. |
Other Scripts
|
| Search Engine Hack, and index
build script |
These scripts (which must be used together) are hacked up versions
of the
Xavatoria search engine. They're probably only useful to me.
The one thing I've done which might be useful to someone is add
thumbnails to the search results, which work with the database described
above. To try it, search my site for a
phrase like
lion. I'm not making all of
Xavatoria
available for download, just the parts that I've changed, so download
Xavatoria
first, then look at my scripts. |
| AWStats Code Red/Nimda Virus tracking
hack |
Back when Code Red/Nimda were major problems, I hacked up
AWStats (the tool I use
for my regular usage analysis) to show me
how many attacks I was getting from Nimda.
You can see it in use here. The
number of attacks I'm getting has dropped drastically, largely because
my ISP has shut down the systems on my network that were infected.
I packaged up the whole directory, because you'll need to use both the
config file and the modied awstats.pl file. You should familiarize
yourself with AWStats
before diving into this. |
| Toolbar code (right-click, pick
Save Target As) (ASP VBScript) |
Yeah, there are lots of open-source packages that will let you make
a navigation bar. I wrote my own from scratch only because it
started out as static HTML. Gradually I added some
context-sensitivity to it, hoping to help the random users who pop into
my sight from search engines. I can't imagine why someone would
want this, but here it is. |
|
|
| Check this:
,Check this: (1/15/2007, 8:11 AM) | | Look this:
Thanks!,Look this:
Thanks! (10/20/2006, 7:35 PM) | | There are some links for you:
,There are some links for you: (10/18/2006, 10:50 AM) | | please, follow this links,please, follow this links,please, follow this links (9/14/2006, 1:46 PM) | | just what i was looking for...but your add comment script that you give doesnt work, but this one does... wtf???? (5/12/2006, 5:31 PM) | | dont insult people u dont know. (2/17/2004, 1:02 PM) | | good webpage, but maybe you should do some tutorials opr something.. that might be a good idea.. (2/17/2004, 1:01 PM) | | Hmm you steal source,publish and recive comments with 'Great' and 'Well done!' you are a very sad person. (12/6/2003, 2:55 AM) | | hi thanks! (7/8/2003, 1:31 PM) | | random comment (3/10/2003, 6:04 PM) | | Bah. Why can't there be a Perl version of the comment board? This is exactly what I want, but I can't make it work with AHTML.exe as asp-engine to my Sambar-server. =( Any suggestions? user@telia.com (11/14/2002, 9:49 PM) | | some of your pictures are nice... (10/31/2002, 5:12 AM) | | modified awstats script rocks!
-m0h (8/17/2002, 11:43 AM) | | i need help developing preciousornot.com will you help? mindwipe28@aol.com I want to rate babies pics and throw in dead baby pictures to freak people out... thanks (8/3/2002, 12:58 AM) | | some of this stuff is cool! (7/30/2002, 12:19 PM) |
|