Profile
MAJ is an Open Source, PHP-based content management system (CMS) that can be deployed as a blog, bulletin or message board, Internet forum, and wiki. It is extensible via PHP panels and is HTML5 and CSS3 ready.
Git
This blob has been accessed 922 times via Git panel.

  1. <?php
  2.  
  3.  
  4. header("Cache-control: private");
  5.  
  6. error_reporting(E_ERROR);
  7.  
  8. require("core.php");
  9.  
  10. if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
  11.         header("Location: login.php");
  12. }
  13.  
  14. $login_username = file_get_contents("data/username.txt");
  15.  
  16. if (file_exists("data/offset.txt")) {
  17.         $offset = file_get_contents("data/offset.txt");
  18. }
  19. else {
  20.         $offset = 0;
  21. }
  22.  
  23. if (isset($_SESSION['logged_in']) and isset($_REQUEST['target']) and ($_REQUEST['target'] == "unread")) {
  24.  
  25.         if (file_exists("data/members/active/{$_SESSION['logged_in']}/comments/unread")) {
  26.                 rmdirr("data/members/active/{$_SESSION['logged_in']}/comments/unread");
  27.         }
  28.        
  29.         if (($_SESSION['logged_in'] == file_get_contents("data/username.txt")) and file_exists("data/comments/unread")) {
  30.                 rmdirr("data/comments/unread");
  31.         }
  32.  
  33.         header("Location: .");
  34. }
  35.  
  36. if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
  37.  
  38.         if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['target']) and !empty($_REQUEST['target'])) {
  39.  
  40.                 if ($_REQUEST['target'] == "album") {
  41.                         rmdirr("images/{$_REQUEST['entry']}/album");
  42.                         rmdirr("data/items/{$_REQUEST['entry']}/album");
  43.                         rmdirr("data/albums/{$_REQUEST['entry']}");
  44.                         header("Location: index.php?entry={$_REQUEST['entry']}");
  45.                 }
  46.  
  47.                 if ($_REQUEST['target'] == "filedrop") {
  48.                         rmdirr("data/items/{$_REQUEST['entry']}/filedrop");
  49.                         header("Location: index.php?entry={$_REQUEST['entry']}");
  50.                 }
  51.  
  52.                 if ($_REQUEST['target'] == "pdf") {
  53.                         rmdirr("data/items/{$_REQUEST['entry']}/pdf/file");
  54.                         header("Location: index.php?entry={$_REQUEST['entry']}");
  55.                 }
  56.         }
  57.  
  58.         if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type'])) {
  59.  
  60.                 rmdirr("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}");
  61.  
  62.                 $cmonth = date("Ym", time() + $offset);
  63.  
  64.                 if (file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}")) {
  65.                         rmdirr("data/comments/latest/$cmonth/{$_REQUEST['entry']}");
  66.                 }
  67.  
  68.                 if (file_exists("data/comments/pending/{$_REQUEST['entry']}") and ($_REQUEST['type'] == "pending")) {
  69.  
  70.                         $fp_comment_count_txt = fopen("data/comments/pending/{$_REQUEST['entry']}/count.txt","r");
  71.                         $comment_count_value = file_get_contents("data/comments/pending/{$_REQUEST['entry']}/count.txt");
  72.  
  73.                         if ($comment_count_value <= 1) {
  74.                                 rmdirr("data/comments/pending/{$_REQUEST['entry']}");
  75.                         }
  76.                         else {
  77.                                 $comment_count_value = $comment_count_value - 1;
  78.                                 $fp_comment_count_txt = fopen("data/comments/pending/{$_REQUEST['entry']}/count.txt","w");
  79.                                 fwrite($fp_comment_count_txt, $comment_count_value);
  80.                                 fclose($fp_comment_count_txt);
  81.                         }
  82.                 }
  83.                 header("Location: index.php?entry={$_REQUEST['entry']}&show=comments");
  84.         }
  85.  
  86.         if ($_POST['action'] == "delete") {
  87.  
  88.                 $cmonth = date("Ym", time() + $offset);
  89.  
  90.                 if (file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}")) {
  91.                         rmdirr("data/comments/latest/$cmonth/{$_REQUEST['entry']}");
  92.                 }
  93.  
  94.                 if (file_exists("data/items/{$_REQUEST['entry']}")) {
  95.                         rmdirr("data/items/{$_REQUEST['entry']}");
  96.                 }
  97.  
  98.                 if (file_exists("images/{$_REQUEST['entry']}")) {
  99.                         rmdirr("images/{$_REQUEST['entry']}");
  100.                 }
  101.  
  102.                 if (file_exists("data/albums/{$_REQUEST['entry']}")) {
  103.                         rmdirr("data/albums/{$_REQUEST['entry']}");
  104.                 }
  105.  
  106.                 if (file_exists("data/sticky/{$_REQUEST['entry']}")) {
  107.                         unlink("data/sticky/{$_REQUEST['entry']}");
  108.                 }
  109.  
  110.                 if (file_exists("data/comments/pending/{$_REQUEST['entry']}")) {
  111.                         rmdirr("data/comments/pending/{$_REQUEST['entry']}");
  112.                 }
  113.  
  114.                 header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
  115.         }
  116.  
  117.         if ($_POST['action'] == "edit") {
  118.                 header("Location: edit.php?entry={$_REQUEST['entry']}");
  119.         }
  120.  
  121.         if ($_POST['action'] == "home") {
  122.                 header("Location: index.php");
  123.         }
  124. }
  125.  
  126. if (!isset($_REQUEST['entry'])) {
  127.         exit();
  128. }
  129.  
  130. if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
  131.         exit();
  132. }
  133.  
  134. ?>
  135.  
  136. <title>Delete</title>
  137.  
  138. <style>
  139.  
  140. body {
  141.         color: #666666;
  142.         margin: 10px;
  143.         padding: 0px;
  144.         text-align: left;
  145.         font-family: <?php
  146.                                 if (file_exists("data/fonts/body.txt")) {
  147.                                         $font_body = file_get_contents("data/fonts/body.txt");
  148.                                         echo "{$font_body},";
  149.                                 }
  150.         ?> arial, helvetica, sans-serif;
  151.         background-color: #FFFFFF;
  152. }
  153.  
  154. p, td {
  155.         font-size: 11px;
  156. }
  157.  
  158. a {
  159.         font-weight: bold;
  160.         text-decoration: none;
  161. }
  162.  
  163. a:link, a:visited {
  164.         color: #666666;
  165. }
  166.  
  167. a:hover {
  168.         color: #336699;
  169. }
  170.  
  171. a:active {
  172.         color: #336699;
  173. }
  174.  
  175. .input_submit {        
  176.         color: #666666;
  177.         background: #ffffff;
  178.         border: #999999 solid 1px;
  179.         width: 125px;
  180.         font-family: <?php
  181.                                 if (file_exists("data/fonts/input.txt")) {
  182.                                         $font_input = file_get_contents("data/fonts/input.txt");
  183.                                         echo "{$font_input},";
  184.                                 }
  185.         ?> arial, helvetica, sans-serif;
  186.         font-size: 11px
  187. }
  188.  
  189. #panel_title {
  190.         font-family: <?php
  191.                                 if (file_exists("data/fonts/panel-title.txt")) {
  192.                                         $font_panel_title = file_get_contents("data/fonts/panel-title.txt");
  193.                                         echo "{$font_panel_title},";
  194.                                 }
  195.         ?> arial, helvetica, sans-serif;
  196.         font-size: 12px;
  197.         font-weight: bold;
  198.         color: #666666;
  199.         padding: 5px 5px 5px 5px;
  200.         background-color: #FFFFFF;
  201.         margin: 0px;
  202.         border-color: #CCCCCC;
  203.         border-width: 1px 1px 0px 1px;
  204.         border-style: solid solid none solid;
  205. }
  206.  
  207. #panel_body {
  208.         font-family: <?php
  209.                                 if (file_exists("data/fonts/panel-body.txt")) {
  210.                                         $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
  211.                                         echo "{$font_panel_body},";
  212.                                 }
  213.         ?> arial, helvetica, sans-serif;
  214.         font-size: 11px;
  215.         color: #666666;
  216.         padding: 5px 5px 5px 5px;
  217.         background-color: #FFFFFF;
  218.         margin: 0px;
  219.         border-color: #CCCCCC;
  220.         border-width: 1px 1px 1px 1px;
  221.         border-style: solid solid solid solid;
  222. }
  223.  
  224. #panel_footer {
  225.         font-family: <?php
  226.                                 if (file_exists("data/fonts/panel-footer.txt")) {
  227.                                         $font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
  228.                                         echo "{$font_panel_footer},";
  229.                                 }
  230.         ?> arial, helvetica, sans-serif;
  231.         font-size: 11px;
  232.         color: #666666;
  233.         padding: 5px 5px 5px 5px;
  234.         background-color: #FFFFFF;
  235.         margin: 0px;
  236.         border-color: #CCCCCC;
  237.         border-width: 0px 1px 1px 1px;
  238.         border-style: none solid solid solid;
  239. }
  240.  
  241. </style>
  242.  
  243. <p><table border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"><tr><td width="525">
  244. <div id="panel_title"><?php readfile("data/items/{$_REQUEST['entry']}/title.txt"); ?></div>
  245. <div id="panel_body"><?php readfile("data/items/{$_REQUEST['entry']}/body.txt"); ?></div>
  246. <div id="panel_footer"><font style="font-size: 10px; color: #999999;"><?php readfile("data/items/{$_REQUEST['entry']}/date.txt"); ?></font></div>
  247. </td></tr></table></p>
  248.  
  249. <p><table border="0" cellspacing="2" cellpadding="0">
  250. <tr><td>
  251. <form enctype="multipart/form-data" action="del.php" method="post">
  252. <input type="hidden" name="entry" value="<?php echo $_REQUEST['entry']; ?>">
  253. <input type="hidden" name="action" value="delete">
  254. <input class="input_submit" type="submit" value="delete">
  255. </form>
  256. </td><td>
  257. <form enctype="multipart/form-data" action="del.php" method="post">
  258. <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
  259. <input type="hidden" name="action" value="edit">
  260. <input class="input_submit" type="submit" value="edit">
  261. </form>
  262. </td><td>
  263. <form enctype="multipart/form-data" action="del.php" method="post">
  264. <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
  265. <input type="hidden" name="action" value="home">
  266. <input class="input_submit" type="submit" value="home">
  267. </form>
  268. </td></tr>
  269. </table>
  270.  
Credits
Sunday, Sep 18, 2005, 12:00 AM (Revision 11 - Thursday, Jul 14, 2011, 7:30 PM)
Open Source enables software developers to stand on the shoulders of giants instead of reinventing the wheel, so to speak. Kudos and many thanks to the folks who made their work freely available for reuse in MAJ.

read more
Bugs and Exploits
Friday, Aug 26, 2005, 12:00 AM (Revision 23 - Wednesday, May 29, 2013, 5:25 AM)
Although MAJ started as a family project, care has been taken to make it as "safe" as possible. With more people now working on MAJ, bugs and exploitable code may sometimes slip in. We invite you to poke around and see if you can find any. Generally, there are two things you can do when you find a MAJ or PHP-related bug or exploit:

1. Take advantage of it. But hey, what's so exciting about messing up someone's blog? Ho-hum, right?
2. Report it here so that we can work on a fix and make MAJ better.

read more
Search
Download
MAJ 2.0
75 files
33448 downloads
MAJ 1.0
26 files
13526 downloads
MAJ 0.14
45 files
35642 downloads