function get_blathed_files($who)
{
// returns array of files, indexed by page name that $who has blathed to
// get html page for $who
if($_GET['edition']=="red")
{
$edition = "/edition=red";
} else {
$edition = "";
}
$who_blathes = file("http://blather.newdream.net/cgi-bin/blather".$edition."?who;name=".urlencode($who));
$lines = Array();
foreach($who_blathes as $line)
{
if(strpos($line,''));
// and the name of the page
$page_name = substr($line,strrpos($line,'/')+1);
$page_name = substr($page_name,0,strpos($page_name,'.html'));
// and assign the array space.
$lines[$page_name] = $line;
}
}
return $lines;
}
if(!empty($_GET['who']) && !empty($_GET['xref']))
{
// get list of files that $who has blathed to
$who_blathes = get_blathed_files($_GET['who']);
// get list of files that $xref has blathed to
$xref_blathes = get_blathed_files($_GET['xref']);
// remove non-duplicates
$both_blathed = array_intersect($who_blathes,$xref_blathes);
// how many do we have?
echo $_GET['who'].' and '.$_GET['xref'].' share '.count($both_blathed).' blathes in '.$_GET['edition'].'
';
// echo the links
foreach($both_blathed as $page_name=>$address)
{
echo "".$page_name."
";
}
}
?>