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 853 times via Git panel.

  1. <?php
  2.         session_start();
  3.        
  4.         session_regenerate_id(TRUE);
  5.  
  6.         header("Cache-control: private");
  7.  
  8.         error_reporting(E_ERROR);
  9.        
  10.         require("core.php");
  11.  
  12.         if (isset($_POST['go']) and ($_POST['go'] == "index")) {
  13.                 header("Location: .");
  14.         }
  15.  
  16.         if (isset($_POST['go']) and ($_POST['go'] == "reset")) {
  17.                 header("Location: reset.php");
  18.         }
  19. ?>
  20.  
  21. <title>Login</title>
  22.  
  23. <style>
  24.  
  25. body {
  26.         color: #666666;
  27.         margin: 10px;
  28.         padding: 0px;
  29.         text-align: left;
  30.         font-size: 11px;
  31.         font-family:
  32. <?php
  33.         if (file_exists("data/fonts/body.txt")) {
  34.                 $font_body = file_get_contents("data/fonts/body.txt");
  35.                 echo "{$font_body},";
  36.         }
  37. ?>
  38.         arial, helvetica, sans-serif;
  39.         background-color: #FFFFFF;
  40. }
  41.  
  42. p, td {
  43.         font-size: 11px;
  44. }
  45.  
  46. a {
  47.         font-weight: bold;
  48.         text-decoration: none;
  49. }
  50.  
  51. a:link, a:visited {
  52.         color: #666666;
  53. }
  54.  
  55. a:hover {
  56.         color: #336699;
  57. }
  58.  
  59. a:active {
  60.         color: #336699;
  61. }
  62.  
  63. .input,.click {
  64.         color: #666666;
  65.         background: #ffffff;
  66.         border: #999999 solid 1px;
  67.         width: 250px;
  68.         font-family:
  69. <?php
  70.         if (file_exists("data/fonts/input.txt")) {
  71.                 $font_input = file_get_contents("data/fonts/input.txt");
  72.                 echo "{$font_input},";
  73.         }
  74. ?>
  75.         arial, helvetica, sans-serif;
  76.         font-size: 11px;
  77. }
  78.  
  79. .input:focus {
  80.       background: #ffffcc;
  81. }
  82.  
  83. </style>
  84.  
  85. <?php
  86.         if (!isset($_POST['username']) or empty($_POST['username']) or !isset($_POST['password']) or empty($_POST['password'])) {
  87.                 $_SESSION = array();
  88.                 session_destroy();
  89.         }
  90.         else {
  91.                 $put_username = trim($_POST['username']);
  92.  
  93.                 /* Fun with crypt! */
  94.                 $put_password = sha1($_POST['password']);
  95.                 $put_password = md5($put_password);
  96.                 $put_password = crypt($put_password, $put_password);
  97.  
  98.                 $err_username = "1";
  99.                 $err_password = "1";
  100.  
  101.                 if ($put_username == file_get_contents("data/username.txt")) {
  102.                         $get_password = file_get_contents("data/password.txt");
  103.                         $last_login = "data/lastlog.txt";
  104.                         $logins = "data/logins.txt";
  105.                         $err_username = "0";
  106.                 }
  107.                 else {
  108.                         if (file_exists("data/members/active/$put_username") and file_exists("data/bb.txt")) {
  109.                                 $get_password = file_get_contents("data/members/active/$put_username/password.txt");
  110.                                 $last_login = "data/members/active/$put_username/bb-last.txt";
  111.                                 $logins = "data/members/active/$put_username/bb-logins.txt";
  112.                                 $err_username = "0";
  113.                         }
  114.                 }
  115.                
  116.                 if ($get_password == $put_password) {
  117.  
  118.                         $_SESSION['logged_in'] = $_POST['username'];
  119.                         $_SESSION['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
  120.                         $_SESSION['maj_server'] = sha1($_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']));
  121.  
  122.                         $lastlog = date("YmdHis", time() + $offset);
  123.  
  124.                         $fp_lastlog_txt = fopen($last_login, "w");
  125.                         fwrite($fp_lastlog_txt, $lastlog);
  126.                         fclose($fp_lastlog_txt);
  127.  
  128.                         if (file_exists("data/bb.txt") and ($_SESSION['logged_in'] != file_get_contents("data/username.txt"))) {
  129.                                 $fp_latest_login_txt = fopen("data/bb-last.txt", "w");
  130.                                 fwrite($fp_latest_login_txt, $_SESSION['logged_in']);
  131.                                 fclose($fp_latest_login_txt);
  132.                         }
  133.  
  134.                         $login_count = file_get_contents($logins);
  135.                         $login_count = $login_count + 1;
  136.  
  137.                         $login_count_file = fopen($logins, "w");
  138.                         fwrite($login_count_file, $login_count);
  139.                         fclose($login_count_file);
  140.  
  141.                         $err_password = "0";
  142.  
  143.                         header("Location: index.php");
  144.                 }
  145.                 else {
  146.                         $_SESSION = array();
  147.                         session_destroy();
  148.                 }
  149.         }
  150. ?>
  151.  
  152. <table border="0" cellspacing="1" cellpadding="1">
  153.  
  154. <form enctype="multipart/form-data" action="login.php" method="post">
  155.  
  156. <tr><td>Username</td><td><input class="input" type="text" maxlength="30" name="username"<?php if (!file_exists("data/autocomplete.txt")) { echo " autocomplete=\"off\""; } if ($err_username == "0") { echo " value=\"{$_POST['username']}\""; } ?>></td><?php if ($err_username == "0") { echo "<td><img src=\"images/widget.ok.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>The username you entered is correct.</td>"; } if ($err_username == "1") { echo "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>The username you entered is invalid.</td>"; } ?></tr>
  157.  
  158. <tr><td>Password</td><td><input autocomplete="off" class="input" type="password" maxlength="128" name="password"<?php if (!file_exists("data/autocomplete.txt")) { echo " autocomplete=\"off\""; } ?>></td><?php if ($err_password == "1") { echo "<td><img src=\"images/widget.x.png\" border=\"0\" width=\"14\" height=\"14\"></td><td>The password you entered is invalid.</td>"; } ?></tr>
  159.  
  160. <tr><td></td><td><input class="click" type="submit" value="click here to login"></td></tr>
  161.  
  162. </form>
  163.  
  164. <form enctype="multipart/form-data" action="login.php" method="post">
  165. <input type="hidden" name="go" value="index">
  166. <tr><td></td><td><input class="click" type="submit" value="click here to go to the index page"></td></tr>
  167. </form>
  168.  
  169. <?php if (!file_exists("data/lite.txt") and file_exists("data/reset.txt")) { ?>
  170.  
  171. <form enctype="multipart/form-data" action="login.php" method="post">
  172. <input type="hidden" name="go" value="reset">
  173. <tr><td></td><td><input class="click" type="submit" value="click here to reset your password"></td></tr>
  174. </form>
  175.  
  176. <?php } ?>
  177.  
  178. </table>
  179.  
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
35524 downloads
MAJ 1.0
26 files
14406 downloads
MAJ 0.14
45 files
37089 downloads