@hash = (
"88002000f7ff00e6e6e68686944242747878789696d8", # D1_buttoncallnow_V3.gif
"88002100e67f009966ccf4f4f4f8f8f8ecececeeeeee", # D1_buttonarrangecallbusy_V3.gif
"88002200e67f00939393f0f0f05757cd343499dadada", # D1_buttoncallnowalertson_V3.gif
"88002200e67f00d3cbdbecececd6d5d5e6e6e6dfd7e6", # D1_buttonalertson_V3.gif
"88002400e67f009966ccf4f4f4f8f8f8eeeeee666666", # D1_buttonarrangecallaway_V3.gif
"88002400e60000888888ded5e5bbbbbbc4c4c4f8f8f8", # D1_buttonsendmail_V3.gif
"88002400e60000cbcbcce6e6e6d1d1d19772bce1e1e1", # D1_buttonlistennow_V3.gif
);
$hashElementLen = 22;
@files = (
"CALLNOW.gif",
"BUSY.gif",
"ALERTS.gif",
"ALERTSON.gif",
"ARRANGE.gif",
"SENDMAIL.gif",
"LISTEN.gif",
"BLANK.gif",
);
##############################################################################
### Set up objects
$q = new CGI;
$dt = localtime();
### parse sid from header into SID
# find SID, set to defaultSID if parameter not found
unless ($SID = $q->param('sid')) {
$SID = $defaultSID;
}
# if SID contains anything but numeric digits, set to default
if ($SID !~ /^\d+$/) {
$SID = $defaultSID;
}
### determine status of user
# get data
$url = "http://www.Niteflirt.com/calls/callimage.asp?sid=$SID&ImageType=1";
$statusGIF = get( $url );
die "Can't get $url -- ", $statusGIF->status_line
unless defined $statusGIF;
$status = -1;
$GIFheader = substr($statusGIF,0,$headerlen);
$GIFbody = unpack('H*',substr($statusGIF,$headerlen,$hashElementLen));
if ($header eq $GIFheader) {
$hashindex = 0;
$hashlen = @hash; # nr of elements
while (($hashindex < $hashlen) && ($status == -1)) {
if ($GIFbody eq $hash[$hashindex]) {
$status = $hashindex;
}
$hashindex = 1 + $hashindex;
}
}
###status has either been found, and set, or is -1
# -1 gives you the last element of the array, so this is where
# the default is stored
$imagefile = $files[$status];
print "Expires: now\n";
print "Pragma: no-cache\n";
print "Cache-control: no-cache\n";
# print "Content-Type: text/html\n";
print "Location: $basedir/$imagefile\n\n";