1. <?php
  2. session_start();
  3.  
  4. if($_SESSION['username'])
  5.  
  6. {
  7.  
  8. echo '<p>Välkommen, du är inloggad som ' . $_SESSION['username'] . '!</p>';
  9.  
  10. @$file = $_POST['file'];
  11.  
  12. @$script = $_POST['script'];
  13.  
  14. if($file&&$script)
  15.  
  16. {
  17.  
  18. $fp=fopen($file, "w");
  19.  
  20. fwrite($fp,stripslashes($script));
  21.  
  22. fclose($fp);
  23.  
  24. }
  25.  
  26.  
  27.  
  28. if ($handle = opendir('../inc/txt/')) {
  29.  
  30. echo "Filer som kan ändras:</br>";
  31.  
  32.  
  33.  
  34. while (false !== ($file = readdir($handle)))
  35.  
  36. {
  37.  
  38. echo "</br>";
  39.  
  40. echo "$file";
  41.  
  42. $link = "editor.php?file=$file";
  43.  
  44. echo "<a href=$link>Ändra</a></br>";
  45.  
  46. }
  47.  
  48.  
  49.  
  50. closedir($handle);
  51.  
  52. }
  53.  
  54.  
  55.  
  56. echo '<p><a href="logout.php">Logga ut</a></p>';
  57.  
  58.  
  59.  
  60. }
  61.  
  62. else
  63. {
  64. echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
  65.  
  66. }
  67.  
  68.  
  69.  
  70. ?>
  71.