Advertisement
Guest User

Untitled

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