Computer Science Canada

aim script.

Author:  Amailer [ Sat Apr 10, 2004 3:51 pm ]
Post subject:  aim script.

code:

<?php

if(empty($_GET['aim'])) {
        die('Sorry, you must enter your AIM/AOL name');
}

$AIMname = $_GET['aim']; // Your AIM/AOL username

if(eregi(" ",$AIMname)) {
die('No spaces allowed in your AIM/AOL name');
}

$ip = $_SERVER['REMOTE_ADDR'];
$port = $_SERVER['REMOTE_PORT'];
$iptxt = "Your ip is $ip";
if(!isset($disp)) {
$disp = 5;
}
$statfile1 = "http://www.the-server.net/osi3/aim/".$AIMname."/onurl=www.s91276774.onlinehome.us/online.txt/offurl=www.s91276774.onlinehome.us/offline.txt"; // Don't touch any of the lines below, unless you know what your doing
$statfile2 = "http://www.eliott-ness.com:2324/aim/".$AIMname."/onurl=www.s91276774.onlinehome.us/online.txt/offurl=www.s91276774.onlinehome.us/offline.txt";
$statfile3 = "http://mightymichelob.tcworks.net:8080/aim/".$AIMname."/onurl=www.s91276774.onlinehome.us/online.txt/offurl=www.s91276774.onlinehome.us/offline.txt"; 
$status = file($statfile1);
$AIMname = ucfirst(strtolower($AIMname));
$header = $AIMname."'s current stats:";
if ( $status[0] == NULL ) { // Due to the unreliability of the stat sites, i put in a few backups :)
$status = file($statfile2);
if ( $status[0] == NULL ) {
$status = file($statfile3);
}
}
if ($disp < strlen($iptxt)) {
$width = strlen($iptxt) * 9 + 16; // Count how many characters need to be displayed, and change the width accordingly
}
else{
$width = $disp * 9 + 16; // Same as above..
}
$img_disp = imagecreate($width,80); // Create the image

if ( $status[0] == NULL ) {
$onoff = "Error";
$onoffcolor = ImageColorAllocate($img_disp, 128, 0, 0);
}
if ( $status[0] == '1' ) {
$onoff = "Online";
$onoffcolor = ImageColorAllocate($img_disp, 0, 128, 0);
}
elseif ( $status[0] == '0' ) {
$onoff = "Offline";
$onoffcolor = ImageColorAllocate($img_disp, 178, 34, 34);
}


$main_font = 'C:/windows/fonts/arial.ttf';
$second_font = 'C:/windows/fonts/verdana.ttf';
$white = ImageColorAllocate($img_disp, 255, 255, 255);
$black = ImageColorAllocate($img_disp, 0, 0, 0);
$darkred = ImageColorAllocate($img_disp, 128, 0, 0);

$prebackcolor = imagecolorallocate($img_disp,255,255,255); // Assign the background color

$backcolor = imagecolortransparent($img_disp,$prebackcolor); // Make the bg transparent, if the page is alone, make it black

imagefill($img_disp,0,0,$backcolor); // Fill the image with the background color

imagettftext($img_disp, 9, 0, 10, 20, $black, $second_font, $header);
imagettftext($img_disp, 9, 0, 10, 40, $black, $second_font, 'AIM online status: ');
imagettftext($img_disp, 9, 0, 120, 40, $onoffcolor, $second_font, $onoff);
imagettftext($img_disp, 9, 0, 10, 60, $black, $second_font, $iptxt);


header("Content-type: image/png");
imagepng($img_disp); // Draw the image
imagedestroy($img_disp); // Delete the image from the server's memory
?>


I was helping this guy out with his aim script, i fixed it and got it to work on my server, but it doesn't work on his... it just says it's loading and nothing else.. what's wrong?


: