This blob has been accessed 280 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)){
- foreach ($data as $key => $value){
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else{
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- $login_username = file_get_contents("data/username.txt");
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- }
- function rmdirr($recurse_dirname)
- {
- if (!file_exists($recurse_dirname)) {
- return false;
- }
- if (is_file($recurse_dirname)) {
- return unlink($recurse_dirname);
- }
- $recurse_dir = dir($recurse_dirname);
- while (false !== $recurse_entry = $recurse_dir->read()) {
- if ($recurse_entry == '.' || $recurse_entry == '..') {
- continue;
- }
- rmdirr("$recurse_dirname/$recurse_entry");
- }
- $recurse_dir->close();
- return rmdir($recurse_dirname);
- }
- if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id']) and isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title']) and isset($_REQUEST['new_content']) and !empty($_REQUEST['new_content']) and !file_exists("data/panels/{$_REQUEST['new_id']}")) {
- if (!file_exists("data/panels")) {
- mkdir("data/panels");
- }
- $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
- if (!file_exists("data/panels/$new_id")) {
- mkdir("data/panels/$new_id");
- }
- $new_title = ucfirst(strip_tags(trim($_REQUEST['new_title'])));
- $panel_content = ucfirst(trim($_REQUEST['new_content']));
- }
- if (isset($_REQUEST['panel_del']) and !empty($_REQUEST['panel_del']) and ($_REQUEST['panel_del'] == "on")) {
- rmdirr("data/panels/{$_REQUEST['panel_id']}");
- }
- if ((!isset($_REQUEST['panel_hide']) or !empty($_REQUEST['panel_hide'])) and ($_REQUEST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
- unlink("data/panels/{$_REQUEST['panel_id']}/private.txt");
- }
- }
- if (isset($_REQUEST['panel_hide']) and !empty($_REQUEST['panel_hide']) and ($_REQUEST['panel_hide'] == "on")) {
- if (!file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
- touch("data/panels/{$_REQUEST['panel_id']}/private.txt");
- }
- }
- if ((!isset($_REQUEST['panel_free']) or !empty($_REQUEST['panel_free'])) and ($_REQUEST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_REQUEST['panel_id']}/free.txt")) {
- unlink("data/panels/{$_REQUEST['panel_id']}/free.txt");
- }
- }
- if (isset($_REQUEST['panel_free']) and !empty($_REQUEST['panel_free']) and ($_REQUEST['panel_free'] == "on")) {
- if (!file_exists("data/panels/{$_REQUEST['panel_id']}/free.txt")) {
- touch("data/panels/{$_REQUEST['panel_id']}/free.txt");
- }
- }
- if ((!isset($_REQUEST['panel_right']) or !empty($_REQUEST['panel_right'])) and ($_REQUEST['panel_edit'] == "on")) {
- if (file_exists("data/panels/{$_REQUEST['panel_id']}/right.txt")) {
- unlink("data/panels/{$_REQUEST['panel_id']}/right.txt");
- }
- }
- if (isset($_REQUEST['panel_right']) and !empty($_REQUEST['panel_right']) and ($_REQUEST['panel_right'] == "on")) {
- if (!file_exists("data/panels/{$_REQUEST['panel_id']}/right.txt")) {
- touch("data/panels/{$_REQUEST['panel_id']}/right.txt");
- }
- }
- if (isset($_REQUEST['panel_title']) and !empty($_REQUEST['panel_title'])) {
- $panel_title = ucfirst(strip_tags(trim($_REQUEST['panel_title'])));
- if ($panel_title != file_get_contents("data/panels/{$_REQUEST['panel_id']}/title.txt")) {
- }
- }
- if (isset($_REQUEST['panel_content']) and !empty($_REQUEST['panel_content'])) {
- $panel_content = ucfirst(trim($_REQUEST['panel_content']));
- if ($panel_content != file_get_contents("data/panels/{$_REQUEST['panel_id']}/panel.php")) {
- }
- }
- ?>
- <style>
- body
- {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: verdana, helvetica, sans-serif;
- background-color: #FFFFFF;
- }
- p
- {
- font-size: 11px;
- }
- a
- {
- font-weight: bold;
- text-decoration: none;
- }
- a:link, a:visited
- {
- color: #666666;
- }
- a:hover
- {
- color: #336699;
- }
- a:active {
- color: #336699;
- }
- .input {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 300px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px
- }
- </style>
- <p><b>Add Panel</b></p><p>Enter a unique panel ID, the panel title, and panel contents. Use <a href=http://php.net target=_maj>PHP</a> and <a href=http://www.w3.org/MarkUp/ target=_maj>HTML</a> with care!</p>
- <table border=0 cellspacing=1 cellpadding=2>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <tr><td><p>panel id*</p></td><td><input type=text class=input name=new_id autocomplete=off maxlength=30></td></tr>
- <tr><td><p>title*</p></td><td><input type=text class=input name=new_title autocomplete=off maxlength=90></td></tr>
- <tr><td><p>content*</p></td><td><textarea class=input name=new_content rows=15></textarea></td></tr>
- <tr><td><p></p></td><td><input type=submit class=input value="click here to add a new panel"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
- <tr><td><p></p></td><td><input class=input type=submit value="click here to go to the index page"></td></tr>
- </form>
- </table>
- <?php
- if (file_exists("data/panels")) {
- if ($dh_panel = opendir("data/panels")) {
- while (($entry_panel = readdir($dh_panel)) !== false) {
- if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
- $show_panel[] = $entry_panel;
- }
- }
- closedir($dh_panel);
- }
- sort($show_panel);
- reset($show_panel);
- $count_panel = count($show_panel);
- if ($count_panel > 0) {
- echo "<p><br><b>Panel Management</b></p><p>Hiding a panel will make it invisible to visitors. Deleting a panel will remove all its contents.</p>";
- echo "<table border=0 cellspacing=1 cellpadding=2>";
- foreach ($show_panel as $panel) {
- echo '<form enctype="multipart/form-data" action="';
- echo $_SERVER['PHP_SELF'];
- echo '" method="post">';
- echo "<tr><td><p><b><a name=\"";
- echo strtolower(str_replace("_", " ", $panel));
- echo "\">";
- echo strtolower(str_replace("_", " ", $panel));
- echo '</a></b></p></td><td><p><input type=text class=input name=panel_title value="';
- readfile("data/panels/$panel/title.txt");
- echo '" autocomplete=off maxlength=90></p></td></tr><tr><td valign=top><p><input type=checkbox name=panel_hide';
- if (file_exists("data/panels/$panel/private.txt")) {
- echo " checked";
- }
- echo '> hide<br><input type=checkbox name=panel_free';
- if (file_exists("data/panels/$panel/free.txt")) {
- echo " checked";
- }
- echo '> free<br><input type=checkbox name=panel_right';
- if (file_exists("data/panels/$panel/right.txt")) {
- echo " checked";
- }
- echo '> right<br><input type=checkbox name=panel_del> delete </p></td><td><textarea class=input name=panel_content rows=10>';
- readfile("data/panels/$panel/panel.php");
- echo "</textarea></td></tr><tr><td></td><td><input type=hidden name=panel_id value=$panel><input type=hidden name=panel_edit value=on><input type=submit class=input value=submit></p></td>";
- echo "</tr><tr><td></td><td><p> </p></td></tr></form>";
- }
- echo "</table>";
- }
- }
- ?>