<?php
session_name("s".base64_decode($_COOKIE[register]));
session_start ();
$sesspass = "base64_decode($_COOKIE[register])";
if (session_id() == "" and $_SESSION[$sesspass] != session_id()) 
{
	session_unset ();
	session_destroy ();
	header ("location: ../index.php?n=503");
}
if (!session_is_registered("s".base64_decode($_COOKIE[register]))) 
{
	session_unset ();
	session_destroy ();
	header ("location: ../index.php?n=503");
}
if($_POST[submit]){
		file_put_contents(codeeditor($_GET[t],$_GET[i], $_GET[s], "code"),stripslashes($_POST[output]));
} 



?>
<h1><?php echo $l[editor];?></h1>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
  <tr>
    <td width="25%" align="left" valign="top"><?php echo $l[files];?></td>
    <td width="75%" align="left" valign="top"><?php echo $l[editor];?></td>
  </tr>
  <tr>
    <td width="25%" align="left" valign="top"><ul>
      <?php echo codeeditor($_GET[t],$_GET[i], $_GET[s], "tree"); ?>
    </ul></td>
    <td width="75%" align="left" valign="top"><form id="codeeditor" name="codeeditor" method="post" action="" class="form" onsubmit="submitForm()">
      <textarea name="code" rows="20" id="code" style="width:99%;"><?php echo file_get_contents(codeeditor($_GET[t],$_GET[i], $_GET[s], "code"), "FILE_USE_INCLUDE_PATH"); ?></textarea>
      <input name="submit" type="hidden" id="submit" value="true" />
      <input type="hidden" name="output" id="output" />
      <input name="save" type="submit" value="<?php echo $l[save];?>" id="submit" class="save" onclick="save();" /></form>
    </td>
  </tr>
</table>
