<?
$filename
= '/tmp/lastsong.txt';

if (
$_POST["code"] == "") # Put the code here..
{
$somecontent = "".$_POST["song"];
#$somecontent .= " - ".$_POST["songinfo"];
   
if (!$handle = fopen($filename, 'w')) {
         exit;
   }

   
// Write $somecontent to our opened file.
   
if (fwrite($handle, $somecontent) === FALSE) {
       exit;
   }
   
fclose($handle);
}

$pat[] = "/ETN.fm/"; $rep[] = '<a href="http://www.etn.fm/">ETN.fm</a>';
$pat[] = "/D I G I T A L L Y - I M P O R T E D - Vocal Trance.*/"; $rep[] = '<a href="http://www.di.fm/">di.fm/vocaltrance</a>)';
$pat[] = "/D I G I T A L L Y - I M P O R T E D.*/"; $rep[] = '<a href="http://www.di.fm/">di.fm</a>)';
$pat[] = "/\\\\'/"; $rep[] = "'";

# $pat[] = "//"; $rep[] = ''; # tom - template
if (file_exists($filename)) {
$ret = file_get_contents($filename);
$ret = preg_replace($pat, $rep, $ret);
$tid = time() - filemtime($filename);
if (
$tid > 3600*4) { $tid = ""; $stid = "not updated"; } else {
    
$tid=round($tid/60);
    
$stid = " min since";
    if (
$tid>60) {
        
$tid=round($tid/60);
        
$stid = " hour(s) since";
    }
}
$ret = $ret . " [".$tid." ".$stid."]";
}

print
$ret; # or something...
?>