View Single Post
Old 01-30-2013, 12:28 AM   PM User | #11
iman
New Coder

 
Join Date: Jan 2013
Posts: 12
Thanks: 10
Thanked 0 Times in 0 Posts
iman is an unknown quantity at this point
I did but still not working...

that's what i did:
PHP Code:
<?php    
    $sDomain 
'mail.opi.yahoo.com';
    
$iTimeout 10;
    
$sStatus '00'// I'd actually recommend defaulting this to whatever the "offline" status is.
    
if (isset($_GET['id'], $_GET['img']))
    {
        if (
$fh = @fsockopen($sDomain80$errno$errstr$iTimeout))
        {
            
$sResult '';
            
$sWrite "GET /online?u={$_GET['id']}&m=a&t=1 HTTP/1.1\r\n";
            
$sWrite .= "Host: $sDomain\r\n";
            
$sWrite .= "Connection: Close\r\n\r\n";
            
fwrite($fh$sWrite);
            while (!
feof($fh))
            {
                
$sResult .= fread($fh128);
            }
            list(
$header$body) = explode("\r\n\r\n"$sResult);
            
$aHeaders explode("\r\n"$header); // optional, can scanf off of the regular string
            
sscanf($aHeaders[0], 'HTTP/1.1 %d %s'$code$httpStatus);
            if (
$code == 200)
            {
                
// Now, this is what I'm not sure about.  The status you have in the directories match this, but I'm not sure why it differs from the file_get_content.
                
$aBody explode("\n"$body);
                
$sStatus = isset($aBody[1]) ? $aBody[1] : '00';
            }
            
fclose($fh);
        }
        
        
$file './icon/'.$sStatus.'/'.$_GET['img'].'.gif'// This $_GET['img'] isn't really the most secure.  Perhaps a switch validation should be used.
        
if(is_file($file))
        {
            
header("Content-type: image/gif");
            
readfile($file);    
        }
    }
?>
iman is offline   Reply With Quote