admin-login.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // rather than have login pages spread throughout the site let's have one place for logging in
  3. // that's easy to remember
  4. require_once('include/cvs-auth.inc');
  5. commonHeader("Administration Login");
  6. print "<br />\n";
  7. if (!isset($_COOKIE['PHP-GTK'])) {
  8. if (isset($_POST['submit']) && isset($_POST['pass'])) {
  9. $user = verify_password(htmlentities($_POST['user']), htmlentities($_POST['pass']), $_SERVER['PHP_SELF']);
  10. } else {
  11. $user = null;
  12. ?>
  13. <h1>Administration Login</h1>
  14. <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = 'POST'>
  15. <table border='0' cellpadding='3' bgcolor='#e0e0e0' width=<?php echo isset($SIDEBAR_DATA) ? '50%' : '40%'; ?>>
  16. <tr>
  17. <td><br />User name:</td>
  18. <td><br /><input type = 'text' name = 'user' value = "<?php echo $user;?>"><br /></td>
  19. <tr>
  20. <td>Password:</td>
  21. <td><input type = 'password' name = 'pass' value = '' size = '12'><br /></td>
  22. <tr>
  23. <td colspan='2' align='right'><input type = 'submit' name = 'submit'></td>
  24. </tr>
  25. </table>
  26. </form>
  27. <?php
  28. print stretchPage(3);
  29. print "&nbsp;</div>\n";
  30. }
  31. } else {
  32. unset($user);
  33. unset($pass);
  34. print("
  35. <h1>You are logged in</h1>
  36. <br />
  37. <ul>
  38. <li>Applications Administration (currently offline)<br /></li>
  39. <li><a href='manual/browse-notes.php'>Notes Administration</a><br /></li>
  40. <li><a href='info.php'>Check phpinfo()</a><br /></li>
  41. <li><a href='manual/admin-notes.php?test'>Set up test environment</a>
  42. (restricted) <b>".(isset($_COOKIE[get_user()]) ? 'Test mode enabled' :
  43. 'Test mode disabled')."</b><br /></li>
  44. <li><a href='manual/admin-notes.php'>Switch public access to user notes
  45. <b>".(file_exists($okfile) ? 'off' : 'on')."</b></a> (restricted)<br /></li>
  46. <li><a href='manual/admin-notes.php?m'>Switch outgoing mail
  47. <b>".(file_exists($mailfile) ? 'off' : 'on')."</b></a> (restricted)<br /></li>
  48. <li><a href='admin-logout.php'>Log out</a></li>
  49. </ul>
  50. ");
  51. }
  52. print stretchPage(7);
  53. print "&nbsp;</div>\n";
  54. commonFooter();
  55. ?>