<?php
$id=$_GET["id"];
$on=$_GET["on"];
$off=$_GET["off"];
$id="your id";// id khodetoon ro inja vared konid
$defON ="pton.gif";
$defOFF="ptOff.gif";
$on=$defON;
$off=$defOFF;
$onsrc='http://us.i1.yimg.com/us.yimg.com/i/mesg/online.gif';
$offsrc='http://us.i1.yimg.com/us.yimg.com/i/mesg/notonline.gif';
$idsrc1='http://opi.yahoo.com/online?u=';
$idsrc2='&m=g&t=0';
if ($id!=""){
$ImgSrcOn=imagecreatefromgif ($onsrc);
$ImgSrcOff=imagecreatefromgif ($offsrc);
$ImgID =imagecreatefromgif ($idsrc1.$id.$idsrc2);
if (imagecompare(&$ImgSrcOn,&$ImgID)){
output($on);
}
else{
output($off);
}
}
else{
print "<h3>Invalid command.</h3><b>Usage:</b><br>
support.php&id=YAHOO_ID<br>or<br>
support.php?id=YAHOO_ID&mod=2<br>or<br>
support.php?id=YAHOO_ID&on=http://my.com/myon.gif&off=http://my.com/myoff.gif";
}
function imagecompare( &$img1,&$img2 ) {
if (imagesx($img1)!=imagesx($img2) OR imagesy($img1)!=imagesy($img2)){
return False;
break;
}
for( $x=0; $x<imagesx($img1 ); $x++ ){
for ($y=0; $y<imagesy($img1); $y++) {
if(imagecolorat($img1,$x,$y)!=imagecolorat($img2,$x,$y)){
return False;
break;
}
}
}
return True;
break;
}
function output($imgpath)
{
$ext= getExtension($imgpath);
$func1="imagecreatefrom".$ext;
$img=$func1($imgpath);
header("Content-type: image/".$ext);
$func2="image".$ext;
$func2($img);
imagedestroy($img);
}
// This function is borrowed from:
// GetExtension ( Copyright (C) 2002 Andrew Collington, http://php.amnuts.com/)
function getExtension($filename)
{
$ext = strtolower(substr($filename, (strrpos($filename, '.') ? strrpos($filename, '.') + 1 : strlen($filename)), strlen($filename)));
if ($ext == 'jpg') $ext = 'jpeg';
return $ext;
}
?>