📄 index.php
字号:
<? /****************************************************************************** SimpleAssets - an online web based asset management application.* Copyright (C) 2002 Jeff Gordon (jgordon81@users.sourceforge.net). All rights reserved.* Public Works and Government Services Canada (PWGSC)* Architecture and Standards Directorate** Released July 2002** This program is free software licensed under the * GNU General Public License (GPL).** This file is part of SimpleAssets.** SimpleAssets is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** SimpleAssets is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** You should have received a copy of the GNU General Public License* along with SimpleAssets; if not, write to the Free Software* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*******************************************************************************/$version = 0.2;$versiondate = "Saturday, October 11th, 2003";// required to make SimpleAssets run in PHP 4.2.0 and upinclude 'patch.php';include 'config.php';if (strlen($sql_db) == 0) $sql_db = str_replace("/","",strrchr(str_replace("/index.php","",$PHP_SELF),"/"));include 'setup.php';include 'asset_actions.php';include 'asset_admin.php';include 'asset_admin_transfer.php';include 'asset_import.php';include 'employee_actions.php';include 'employee_admin.php';include 'employee_import.php';include 'license_actions.php';include 'license_admin.php';include 'reports.php';include 'calendar.php';include 'help.php';include 'search.php';include 'misc.php';global $action, $key, $lastaction, $lastkey; // requested and stored action and keyglobal $login, $pass, $loginfail, $loginout; // login and logout valuesglobal $oldpass, $passagain; // extra change password valuesglobal $print; // print flagglobal $QUERY_STRING; // entire query stringglobal $HTTP_SESSION_VARS;global $mylogin, $mypass;global $my_access_level;// FORM CLEANUP// clear extra html form characters from the key$key = dehtml($key);$lastkey = dehtml($lastkey); // SET PRINT SCREEN// set whether we are printing the screenif ($print == "1") $print_screen = true;else $print_screen = false;// CONNECT TO DB// attempt to establish a connection with the server and databaseif (strlen($sql_db) < 1) $sql_db = "SimpleAssets";$server_status = db_connect($ip,$sql_login,$sql_pass);if ($server_status) $db_status = db_select($sql_db);// JUMP TO EXCEL REPORTif (strcmp($action,"reportsassets") == 0) { reports_assets(); exit;}if (strcmp($action,"reportslicensessummary") == 0) { reports_licenses_summary(); exit;}if (strcmp($action,"reportslicensesdetailed") == 0) { reports_licenses_detailed(); exit;}if (strcmp($action,"reportsemployees") == 0) { reports_employees(); exit;}if (strcmp($action,"reportsindividual") == 0) { reports_individual($key); exit;}if ((strcmp($action,"login") == 0) && ($my_access_level > 0)) $action = "";if ((strcmp($action,"setup") == 0)) $action = "";// CHECK FOR NO DB// set the setup flag if no db exists or its userbase is emptyif ((!$server_status) || (!$db_status)) { $setup = true; if (!(in_array($action,Array("help","helpfaq","helpprocesses","helpfeatures","helpversion")))) { $action = "setup"; }} else { // LOGIN USER // obtain the logged in employee id $my_emp_id = login(); // display login box for users who have not logged in and are not setting up if (($my_access_level == 0) && (strcmp($action,"employeeregister") != 0)) { $lastaction = $action; $lastkey = $key; $action = "login"; } else { if (strcmp($action,"login") == 0) $action = ""; }}// default colors (blue)$header_ext = "_blue";$hrcolor = "#0099cc";// assets (orange)if (in_array($action,Array("assets","assetos","assetsupplier","surplus","retired","assetview","assetupdate","assetinsert","assettransfer","assettransfererase","assettransfersignin","assetcalendar","assetapprovals"))) { $header_ext = "_orange"; $hrcolor = "#ffcc00";}// employees (red)if (in_array($action,Array("employees","employeeregister","employeeview","employeeinsert","employeeinsertcomplete","employeeupdate","employeeupdatecomplete","employeepassword"))) { $header_ext = "_red"; $hrcolor = "#ff0033";}// licenses (purple)if (in_array($action,Array("licenses","licensequery","licenseview","licensedelete","licenseinsert"))) { $header_ext = "_purple"; $hrcolor = "#cc3399";}// reports (green)if (in_array($action,Array("reports","reportssignout","reportsip","reportsverify"))) { $header_ext = "_green"; $hrcolor = "#66cc00";}// used for internal purposes// include '../network.html';// print out html headersecho "<html>\n";echo "<head>\n";echo "<title>SimpleAssets :: " . $org_name . "</title>\n";?> <script language="Javascript"> function openwin() { myWindow = window.open('<? echo $PHP_SELF . "?" . $QUERY_STRING . "&print=1"; ?>', 'tinyWindow', 'scrollbars=yes,toolbar=no,width=600,height=400') } </script> <script> <!-- if(navigator.appName.indexOf("Netscape")!=-1) document.writeln("<LINK REL='Stylesheet' TYPE='text/css' HREF='css/ns.css'>\n"); else document.writeln("<LINK REL='Stylesheet' TYPE='text/css' HREF='css/ie.css'>\n"); //--> </script> <noscript><link rel='stylesheet' TYPE='text/css' HREF='css/ie.css'></noscript><?echo "</head>\n";if ($print_screen == false) echo "<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 border=0 link='#0000cc' vlink='#0000cc' alink='#0000cc'>\n";else echo "<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 border=0 link='#0000cc' vlink='#0000cc' alink='#0000cc' onload='window.print()'>\n";//==========================================================//==========================================================// 1. draw the top header menus//==========================================================//==========================================================if ($print_screen == false) { ///////////////////////////////////////////////////////////////// // draw the top menu and the graphical header (BLACK AND GRAPHIC) echo "<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor='#000000' width=100%>"; echo "<tr><td class='text11bold'>"; echo " <img src='images/cdn.gif' width=24 height=11 border=0><font color='#ffffff'><b><font color='#ffffff'> " . $org_name . "</font></b></font>"; echo "</a></td>"; echo "<td align='right'><font class='text11bold' color='#ffffff'><b> "; echo "</b></font></td>"; echo "<td><img src='images/right_head_top" . $header_ext . ".jpg' width=439 height=27 usemap='#Map' border=0></td>"; echo "</tr><tr>"; echo "<td><a href='" . $PHP_SELF . "'><img src='images/left_head" . $header_ext . ".jpg' width=312 height=58 border=0></a></td>"; echo "<td width=100% background='images/center_head" . $header_ext . ".jpg'><img src='images/center_head" . $header_ext . ".jpg' width=19 height=58></td>"; echo "<td><img src='images/right_head" . $header_ext . ".jpg' width=439 height=58></td></tr></table>"; ///////////////////////////////////// // draw the admin menu (BLUE) if ($my_access_level > 0) { echo "<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor='#000099'><tr><td>"; echo "<table width=100% bgcolor='#000099'><tr>"; $msg = getMsg(); if (($my_access_level > 1) && (strcmp($msg,"you have no new messages.") == 0)) { echo "<td align='left'><font class='text10bold'' color='#ffffff'><b> new: "; echo " <a href='" . $PHP_SELF . "?action=assetinsert' class='text10bold'><font color='#ffffcc'>asset</font></a> ·"; echo " <a href='" . $PHP_SELF . "?action=employeeinsert' class='text10bold'><font color='#ffffcc'>employee</font></a> ·"; echo " <a href='" . $PHP_SELF . "?action=licenseinsert' class='text10bold'><font color='#ffffcc'>license</font></a> "; echo "</b></font><font class='text12'> </font></td>"; } else { echo "<td align='left'><font class='text10bold' color='#ffffff'><b> " . $msg . " "; echo "</b></font></td>"; } echo "<td align='right'><font class='text10bold' color='#ffffff'><b>" . stripslashes($activelogin) . ": "; if ($my_access_level > 1) echo " <a href='" . $PHP_SELF . "?action=assetapprovals' class='text10bold'><font color='#ffffcc'>approve transfers</font></a> ·"; else echo " <a href='" . $PHP_SELF . "?action=assetinsert' class='text10bold'><font color='#ffffcc'>new asset</font></a> ·"; echo " <a href='" . $PHP_SELF . "?action=employeeview&key=" . $my_emp_id . "' class='text10bold'><font color='#ffffcc'>view my assets</font></a> ·"; echo " <a href='" . $PHP_SELF . "?action=employeeupdate&key=" . $my_emp_id . "' class='text10bold'><font color='#ffffcc'>edit my profile</font></a> ·"; echo " <a href='" . $PHP_SELF . "?action=employeepassword&key=" . $my_emp_id . "' class='text10bold'><font color='#ffffcc'>change my password</font></a>"; echo "</b></font>"; echo "</td></tr></table>\n"; echo "</td></tr></table>\n"; } else { echo "<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor='#000099'><tr><td>"; echo "<img src='images/spacer.gif' width=100 height=7>"; echo "</td></tr></table>\n"; } ///////////////////////////////////// // draw the top search box (GREY) if ($setup == false) { $searchbox_color = "#eeeeee"; if (strcmp($action,"search") == 0) $search_key = $key; else $search_key = ""; echo "<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor='" . $searchbox_color . "'><tr><td>"; echo "<center>"; echo "<table bgcolor='" . $searchbox_color . "'><tr>"; echo "<td><form action='" . $PHP_SELF . "' method='get'><img src='images/search_title.jpg' width=60 height=20></td>"; echo "<td><input type='hidden' name='action' value='search'><input name='key' type='text' value=\"" . q_replace($search_key) . "\" size=30 class='boxtext13'>"; echo "</td><td><input type='image' name='submit' src='images/go.gif' width=20 height=20 border=0><table cellspacing=0 cellpadding=0 border=0><tr><td></form></td></tr></table>"; echo"</td></tr></table></center>"; echo "</td></tr></table>"; }}//==========================================================//==========================================================// 2. draw the centre portion based on the action//==========================================================//==========================================================echo "<p><table width=100% cellspacing=10><tr><td>";switch($action) {//////////////////////////////////// main features (read-only) // provides a listing of assets, associated to surplus case "surplus": employee_view(-1); break; // provides a listing of assets, which have been retired case "retired": employee_view(-2); break; // shows the search screen case "search": search($key); break; // shows the login box case "login": loginbox($key);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -