<?php 
$n 
50// this is the number of images displayed on the page, the maximum is 250

// The following is needed to comply with LJ's bot policy (livejournal.com/bots/)
$s 'http://www.yourdomain.com/your_lj_script.php'// the address of your page
$e 'your_email@yourdomain.com'// your email address

// ignore domains
$ig = array(
     
"batfweb.com"
    
,"bliksat.info"
    
,"elepass.info"
    
,"flubweb.com"
    
,"fredaser.info"
    
,"gohonet.info"
    
,"hontar.info"
    
,"kladfuje.info"
    
,"kvaworld.com"
    
,"lewismarine.com"
    
,"ljplus.ru"
    
,"ploskinger.info"
    
,"screendepo.com"
    
,"witahot.info"
    
,"worldck.com"
    
,"worldmi.com"
    
,"worldyo.com"
    
,"yaskaler.info"
    
,"youporn.com"
    
,"zamaneka.info"
);

$fp fsockopen('www.livejournal.com'80$errno$errstr15);
if (
$fp) {
    
fputs($fp"GET /stats/latest-img.bml HTTP/1.0\r\n" .
        
"Host: www.livejournal.com\r\n".
        
"User-Agent: ".$s."; ".$e."\r\n\r\n");
    
$data '';
    while(!
feof($fp)) {
        
$data .= fgets($fp);
    }
    
fclose($fp);

    
// pull all image data with associated LJ links
    
preg_match_all("<recent-image img=\'([^\']+)\' url=\'([^\']+)\' />"$data$out);

    for (
$i=0$i<$n$i++) {
        
// get the full url of the image, then extract out individual parts
        
$full_url parse_url$out[1][$i] );
        
$url_parts explode('.'$full_url['host']);

        
$url_size sizeof($url_parts);
        
// if array size == 2, e.g. "example.com"
        
if ($url_size == 2) {
            
$sld $full_url['host'];
        } else {
            
// otherwise, e.g. "www.example.com" -> "example.com"
            
$sld $url_parts[$url_size 2] . "." $url_parts[$url_size 1];
        }

        
// ignore, reset count (so we still see 50 images), proceed
        
if (in_array($sld$ig)) {
            
$n++;
            continue;
        }

        echo 
'<div class="ljimageblock">' "\n";
        echo 
"\t" '<a target="_blank" href="' $out[2][$i] . '" title="' $sld '"><img class="ljimage" src="' $out[1][$i] . '" alt=""></a>' "\n";
        echo 
'</div>' "\n";
    }
} else {
    echo 
'<p><em><strong>Error: connection to LiveJournal failed.</strong><br>' $errstr ' (' $errno ')</em></p>'
}
?>