folder_new.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once ("./header.php");
  3. logged_in_only ();
  4. $foldername = set_post_foldername ();
  5. $public = set_post_bool_var ("public", false);
  6. if ($foldername == "") {
  7. ?>
  8. <h2 class="title">New Folder</h2>
  9. <form action="<?php echo $_SERVER['SCRIPT_NAME'] . "?folderid=" . $folderid; ?>" id="fnew" method="POST">
  10. <p><input type=text name="foldername" size="50" value="<?php echo $foldername; ?>"></p>
  11. <p><input type="checkbox" name="public"> Public</p>
  12. <input type="submit" value=" OK ">
  13. <input type="button" value=" Cancel " onClick="self.close()">
  14. </form>
  15. <script>
  16. this.focus();
  17. document.getElementById('fnew').foldername.focus();
  18. </script>
  19. <?php
  20. }
  21. else {
  22. $query = sprintf ("INSERT INTO folder (childof, name, public, user) values ('%d', '%s', '%d', '%s')",
  23. $mysql->escape ($folderid),
  24. $mysql->escape ($foldername),
  25. $mysql->escape ($public),
  26. $mysql->escape ($username));
  27. if ($mysql->query ($query)) {
  28. echo "Folder successfully created<br>\n";
  29. echo '<script language="JavaScript">reloadclose();</script>';
  30. }
  31. else {
  32. message ($mysql->error);
  33. }
  34. }
  35. require_once (ABSOLUTE_PATH . "footer.php");
  36. ?>