<?php

date_default_timezone_set('Europe/Bucharest'); 		//Change this to your time/zone
$datafile = "data.txt";								//How is named the txt file?
$pswd = "changeme";									//The password set in rdj options

if ((isset($_POST["xpwd"])) && (isset($_POST["title"]))) {
   $xpwd= stripcslashes($_POST["xpwd"]);
   if ($xpwd == $pswd) { //please change the password here and in now playing info plugin!
      $data = stripcslashes($_POST["title"]);

      $Handle = fopen($datafile, 'w');
      fwrite($Handle, date('H:i') . " " . $data . "\n");
      fclose($Handle);
   }
} Else {
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Recently Played Tracks</title>
  </head>
  <body>
	<div id="main">
    <?php
        $str= file_get_contents($datafile);
		$str = nl2br($str, true); // for XHMTL (in other words <br />). Use false for <br>. i.e $str = nl2br($str, false);
		echo $str;
    ?>
    </div>
  </body>
</html>

<?php
}
?>