Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_REQUEST['logout'])) {
  4. session_start();
  5. }
  6.  
  7. if (isset($_POST['submitUpdate'])) {
  8. if (get_magic_quotes_gpc()) {
  9. $_POST = array_map('stripslashes',$_POST);
  10. }
  11. $fc = file_get_contents($_POST['file']);
  12. // truncate file
  13. $fw = fopen($_POST['file'], 'w+');
  14. $text = explode("<!-- EDITABLE -->",$fc);
  15. $newText = $text[0]."<!-- EDITABLE -->".htmlentities($_POST['content'])."<!--EDITABLE ->".$text[2];
  16. if (fwrite($fw, $newText)===FALSE) {
  17. die("Cannot write to file.");
  18. }
  19. fclose($fw);
  20. exit("<div><span class='redText'>The file has been updated. Click <a href=\"admin.php\">here</a> to go back to admin page.</div>");
  21. }
  22.  
  23. if (isset($_POST['Submit'])) {
  24. if (($_POST['username'] == 'admin') && ($_POST['passwd'] == 'x638cdk')) {
  25. $_SESSION['username'] = 'login';
  26. }
  27. else {
  28. echo "<b>Your login details are not correct. Please try again</b>";
  29. }
  30. }
  31.  
  32. if ($_SESSION['username']=='login') {
  33. if (isset($_REQUEST['file'])) {
  34. $fc = file_get_contents($_REQUEST['file']);
  35. $text = explode("<!– EDITABLE –>",$fc);
  36. echo "<form method='post' action=''><textarea name='content' cols=\"150\" rows=\"30\">$text[1]</textarea>";
  37. echo "<p><input type='hidden' name='file' value='".$_REQUEST['file']."' /><input name='submitUpdate' type='submit' class='btn' value='Update Page'></form>";
  38. }
  39. else {
  40. // edit to link to your own static html files
  41. echo "
  42. <h1><a href=\"/\">View Site</a> | <a href=\"?logout\">Logout</a></h1>
  43. <em>Click on the links below to edit the files.</em><br/><br/>
  44. <p align='left'>
  45. <a href=\"?file=../home/pages/home.php\">Home Page</a><br/>
  46. <hr>
  47. <a href=\"?file=../home/pages/welcome/home.php\">Welcome Home</a><br/>
  48. <a href=\"?file=../home/pages/welcome/about.php\">About Ruach</a><br/>
  49. <a href=\"?file=../home/pages/welcome/declaration-of-faith.php\">Declaration of Faith</a><br/>
  50. <a href=\"?file=../home/pages/welcome/governance.php\">Governance</a><br/>
  51. <a href=\"?file=../home/pages/welcome/partnership.php\">Partnership</a><br/>
  52. <hr>
  53. <a href=\"?file=../home/pages/ministries/aol.php\">Academy of Learning</a><br/>
  54. <a href=\"?file=../home/pages/ministries/creative-arts.php\">Creative Arts</a><br/>
  55. <a href=\"?file=../home/pages/ministries/global.php\">Global Ministry</a><br/>
  56. <a href=\"?file=../home/pages/ministries/hospitality.php\">Hospitality Ministry</a><br/>
  57. <a href=\"?file=../home/pages/ministries/outreach.php\">Outreach Ministry</a><br/>
  58. <a href=\"?file=../home/pages/ministries/social-care.php\">Social Care Ministry</a><br/>
  59. <a href=\"?file=../home/pages/ministries/spiritual-mediation.php\">Spiritual Mediation</a><br/>
  60. <a href=\"?file=../home/pages/ministries/youth.php\">Youth Ministry</a><br/>
  61. <hr>
  62. <a href=\"?file=../home/pages/contact/home.php\">Contact Home</a><br/>
  63. <a href=\"?file=../home/pages/contact/directions.php\">Directions</a><br/>
  64. <hr>
  65. <a href=\"?file=/home/pages/missions/home.php\">Missions</a>
  66. </p>";
  67. }
  68. }
  69. ?>
  70.  
  71. <div align="center"><img src="images/cms-title.png" border="0" alt=""></div>
  72. <form method="post" action="">
  73. <table width="400" border="0" align="center" cellpadding="2" cellspacing="2">
  74. <tr>
  75. <td width="73">Username: </td>
  76. <td width="313"><input type="text" name="username"></td>
  77. </tr>
  78. <tr>
  79. <td>Password: </td>
  80. <td><input type="password" name="passwd"></td>
  81. </tr>
  82. <tr>
  83. <td>&nbsp;</td>
  84. <td><input type="submit" name="Submit" class="btn" value="Submit">&nbsp;&nbsp; <input type="reset" name="reset" class="btn" value="Reset">
  85. </td>
  86. </tr>
  87. </table>
  88. </form>
  89.  
  90. <style>
  91. body{
  92. font-family: Arial, Helvetica, sans-serif;
  93. font-size: 12px;
  94. color: #000000;
  95. margin-top: 20px;
  96. }
  97.  
  98. a{
  99. color: #639;
  100. text-decoration: underline;
  101. }
  102.  
  103. a:hover{
  104. text-decoration: none;
  105. }
  106.  
  107. h1{
  108. font-size: 16px;
  109. }
  110.  
  111. table{
  112. font-family: Arial, Helvetica, sans-serif;
  113. font-size: 12px;
  114. color: #000000;
  115. margin-top: 20px;
  116. }
  117.  
  118. input{
  119. width: 300px;
  120. height: 25px;
  121. background: #FFFFFF;
  122. border: 1px solid #999;
  123. padding: 5px;
  124. }
  125.  
  126. .btn{
  127. width: auto;
  128. background: #CCC;
  129. }
  130.  
  131. hr{
  132. color: #fff;
  133. background-color: #fff;
  134. height: 1px;
  135. border: 0;
  136. }
  137. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement