Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_GET['logout']))
- {
- session_destroy();
- session_start();
- }
- if (isset($_POST['submitUpdate'])) {
- if (get_magic_quotes_gpc()) {
- $_POST = array_map('stripslashes',$_POST);
- }
- $fc = file_get_contents($_POST['file']);
- // truncate file
- $fw = fopen($_POST['file'], 'w+');
- $text = explode("<!-- EDITABLE -->",$fc);
- $newText = $text[0]."<!-- EDITABLE -->".htmlentities($_POST['content'])."<!--EDITABLE ->".$text[2];
- if (fwrite($fw, $newText)===FALSE) {
- die("Cannot write to file.");
- }
- fclose($fw);
- exit("<div><span class='redText'>The file has been updated. Click <a href=\"admin.php\">here</a> to go back to admin page.</div>");
- }
- if (isset($_POST['Submit'])) {
- if (($_POST['username'] == 'admin') && ($_POST['passwd'] == 'x638cdk')) {
- $_SESSION['username'] = 'login';
- }
- else {
- echo "<b>Your login details are not correct. Please try again</b>";
- }
- }
- if ($_SESSION['username']=='login') {
- if (isset($_REQUEST['file'])) {
- $fc = file_get_contents($_REQUEST['file']);
- $text = explode("<!– EDITABLE –>",$fc);
- echo "<form method='post' action=''><textarea name='content' cols=\"150\" rows=\"30\">$text[1]</textarea>";
- echo "<p><input type='hidden' name='file' value='".$_REQUEST['file']."' /><input name='submitUpdate' type='submit' class='btn' value='Update Page'></form>";
- }
- else {
- // edit to link to your own static html files
- echo "
- <h1><a href=\"/\">View Site</a> | <a href=\"?logout\">Logout</a></h1>
- <em>Click on the links below to edit the files.</em><br/><br/>
- <p align='left'>
- <a href=\"?file=../home/pages/home.php\">Home Page</a><br/>
- <hr>
- <a href=\"?file=../home/pages/welcome/home.php\">Welcome Home</a><br/>
- <a href=\"?file=../home/pages/welcome/about.php\">About Ruach</a><br/>
- <a href=\"?file=../home/pages/welcome/declaration-of-faith.php\">Declaration of Faith</a><br/>
- <a href=\"?file=../home/pages/welcome/governance.php\">Governance</a><br/>
- <a href=\"?file=../home/pages/welcome/partnership.php\">Partnership</a><br/>
- <hr>
- <a href=\"?file=../home/pages/ministries/aol.php\">Academy of Learning</a><br/>
- <a href=\"?file=../home/pages/ministries/creative-arts.php\">Creative Arts</a><br/>
- <a href=\"?file=../home/pages/ministries/global.php\">Global Ministry</a><br/>
- <a href=\"?file=../home/pages/ministries/hospitality.php\">Hospitality Ministry</a><br/>
- <a href=\"?file=../home/pages/ministries/outreach.php\">Outreach Ministry</a><br/>
- <a href=\"?file=../home/pages/ministries/social-care.php\">Social Care Ministry</a><br/>
- <a href=\"?file=../home/pages/ministries/spiritual-mediation.php\">Spiritual Mediation</a><br/>
- <a href=\"?file=../home/pages/ministries/youth.php\">Youth Ministry</a><br/>
- <hr>
- <a href=\"?file=../home/pages/contact/home.php\">Contact Home</a><br/>
- <a href=\"?file=../home/pages/contact/directions.php\">Directions</a><br/>
- <hr>
- <a href=\"?file=/home/pages/missions/home.php\">Missions</a>
- </p>";
- }
- }
- if(!$_SESSION['username'])
- {
- ?>
- <div align="center"><img src="images/cms-title.png" border="0" alt=""></div>
- <form method="post" action="">
- <table width="400" border="0" align="center" cellpadding="2" cellspacing="2">
- <tr>
- <td width="73">Username: </td>
- <td width="313"><input type="text" name="username"></td>
- </tr>
- <tr>
- <td>Password: </td>
- <td><input type="password" name="passwd"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="Submit" class="btn" value="Submit"> <input type="reset" name="reset" class="btn" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- <?php
- }
- ?>
- <style>
- body{
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
- color: #000000;
- margin-top: 20px;
- }
- a{
- color: #639;
- text-decoration: underline;
- }
- a:hover{
- text-decoration: none;
- }
- h1{
- font-size: 16px;
- }
- table{
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
- color: #000000;
- margin-top: 20px;
- }
- input{
- width: 300px;
- height: 25px;
- background: #FFFFFF;
- border: 1px solid #999;
- padding: 5px;
- }
- .btn{
- width: auto;
- background: #CCC;
- }
- hr{
- color: #fff;
- background-color: #fff;
- height: 1px;
- border: 0;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement