"Fossies" - the Fresh Open Source Software Archive

Member "proma-0.8.3/index.php" (25 Oct 2007, 2617 Bytes) of package /linux/privat/old/proma-0.8.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "index.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /* ProMA (ProFTPd MySQL Admin), Copyright (C) 2002-2007 Stein Magnus Jodal
    3  * ProMA comes with ABSOLUTELY NO WARRANTY.
    4  * This is free software, and you are welcome to redistribute it
    5  * under the terms of the GNU General Public License.
    6  * Read 'COPYING' for further information.
    7  */
    8 
    9 /* ProMA Main File
   10  * $Id: index.php,v 1.12 2007/10/25 19:13:35 jodal Exp $
   11  */
   12 
   13 // Configuration
   14 if (file_exists("config.inc.php")) {
   15     require("config.inc.php");
   16 } else {
   17     die("Please copy 'config.inc.php-example' to 'config.inc.php' and edit it to fit your setup.");
   18 }
   19 
   20 // Libraries
   21 require("libs/auth.lib.php");
   22 require("libs/admin.lib.php");
   23 require("libs/common.lib.php");
   24 
   25 // Database
   26 $link = mysql_connect($db_host, $db_user, $db_password);
   27 mysql_select_db($db_name);
   28 
   29 // Prepare subpage
   30 $page = $_GET["page"];
   31 
   32 if (empty($page)) {
   33     $page = "main";
   34 }
   35 
   36 // Admin
   37 if ($page == "admin") {
   38 
   39     // Runlevel
   40     $runlevel = 0;
   41 
   42     // If cookie is set
   43     if ($_COOKIE["proma"] != "" && $_GET["action"] != "logout") {
   44         $runlevel = check_cookie();
   45 
   46         if ($runlevel == 0) {
   47             $message = "The session has timed out.";
   48         }
   49     }
   50 
   51     // If login info is entered
   52     if (!empty($_POST["login"])) {
   53         $runlevel = login();
   54 
   55         if ($runlevel == 0) {
   56             $message = "Wrong username or password, or you're not an admin.";
   57         }
   58     }
   59 
   60     // If logout-link is clicked
   61     if ($_GET["action"] == "logout") {
   62         $runlevel = logout();
   63 
   64         if ($runlevel == 0) {
   65             $message = "Logged out.";
   66         }
   67     }
   68 
   69 }
   70 
   71 // Top
   72 print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
   73 ?>
   74 
   75 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   76     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
   77 
   78 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   79 
   80 <head>
   81     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
   82     <title>ProMA - <?php print $info_host; ?></title>
   83     <link rel="stylesheet" type="text/css" href="style.css" />
   84 </head>
   85 
   86 <body>
   87 
   88 <h1>ProMA - <?php print $info_host; ?></h1>
   89 
   90 <p class="menu">
   91 <a href="?page=main">Information / Statistics</a> |
   92 <a href="?page=register">Register Account</a> |
   93 <a href="?page=change">Change Account Information</a> |
   94 <a href="?page=admin">Administration</a>
   95 </p>
   96 
   97 <?php
   98 
   99 // Main
  100 // Include the content of the page
  101 
  102 $filename = "pages/$page.inc.php";
  103 
  104 if (file_exists($filename)) {
  105     include($filename);
  106 } else {
  107     print "<h2>File not found</h2>\n";
  108 }
  109 
  110 // Bottom
  111 ?>
  112 
  113 <p class="bottom">
  114 <a href="http://proma.sourceforge.net/">ProMA 0.8.3</a> &#149;
  115 Copyright &copy; 2002-2007 <a href="http://www.jodal.no/">Stein Magnus Jodal</a>. All rights reserved. &#149;
  116 Distributed under the GNU General Public License.
  117 </p>
  118 
  119 </body>
  120 
  121 </html>