0byt3m1n1-V2
Path:
/
home
/
helpdesk
/
[
Home
]
File: home.php
<?php require_once('Connections/Connect.php'); ?> <?php require_once('Connections/Connect.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "index.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $MM_referrer .= "?" . $_SERVER['QUERY_STRING']; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO test (name) VALUES (%s)", GetSQLValueString($_POST['name'], "text")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); $insertGoTo = "home.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO test (name) VALUES (%s)", GetSQLValueString(isset($_POST['checkbox']) ? "true" : "", "defined","'Y'","'N'")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); $insertGoTo = "alert_ok.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO test (name) VALUES (%s)", GetSQLValueString($_POST['checkbox'], "text")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); $insertGoTo = "alert_ok.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO test (name) VALUES (%s)", GetSQLValueString($_POST['radio'], "text")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); $insertGoTo = "alert_ok.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO test (name) VALUES (%s)", GetSQLValueString($_POST['radio'], "text")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); } $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_Connect, $Connect); $query_Recordset1 = "SELECT * FROM addjob ORDER BY id DESC"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $Connect) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $colname_Recordset2 = "-1"; if (isset($_GET['id'])) { $colname_Recordset2 = $_GET['id']; } mysql_select_db($database_Connect, $Connect); $query_Recordset2 = sprintf("SELECT * FROM login_user WHERE id = %s", GetSQLValueString($colname_Recordset2, "int")); $Recordset2 = mysql_query($query_Recordset2, $Connect) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/bootstrap.min.css"> <title>หน้าหลัก</title> <link rel="stylesheet" href="css/jquery-ui.css"> <script src="js/jquery-1.10.2.js"></script> <script src="js/jquery-ui.js"></script> <script> </script> </head> <body background="images/1180422460.gif"> <table width="100%" border="0"> <tr> <td class="btn-success"> <img src="icon/Tools.png" width="32" height="32" /> <strong>ระบบแจ้งซ่อมออนไลน์ ( Peaceresort )</strong></td> <td width="7%" height="43" class="btn-success"> <img src="images/R24pic.gif" width="70" height="60" /></td> </tr> </table> <table width="100%" border="0"> <tr> <td width="0%"> </td> <td width="9%"> </td> <td width="11%"> </td> <td width="14%"> </td> <td width="37%"> </td> <td width="29%"> </td> </tr> <tr> <td height="52"> </td> <td><a href="addjob.php?id=<?php echo $row_Recordset2['id']; ?>"><img src="icon/Edit.png" width="32" height="32" /><strong><a href="#"></a></td> <td><a href="ind.php"><img src="icon/User.png" width="32" height="32" /> <strong>ผู้ดูแลระบบ</strong></a></td> <td><a href="<?php echo $logoutAction ?>"><img src="icon/Stop.png" width="32" height="32" /> <strong>ออกจากระบบ</strong></a></td> <td><img src="icon/Web.png" width="32" height="32" /> <strong><a href="#">ผู้ใช้งานระบบ : <?php echo $_SESSION['MM_Username']; ?></a></strong></td> <td> </td> </tr> </table> <p> <script src="js/bootstrap.min.js"></script> <marquee bgcolor="#39b54a" border="0" align="middle" scrollamount="2" scrolldelay="5" behavior="scroll" width="100%" height="20" style="font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 18"> ** ตรวจสอบว่างานเสร็จหรือยังให้ดูตรงหัวข้อ " สถานะงาน " ครับ ** </marquee> </p> <p> จำนวนใบงานที่อยู่ในระบบทั้งหมด <?php echo $totalRows_Recordset1 ?> ใบงาน</p> <table width="100%" border="0" class="table table-bordered"> <tr class="alert-success"> <td width="9%" height="31" align="center"><strong>ชื่อผู้แจ้ง</strong></td> <td width="12%" align="center"><strong>วันที่แจ้ง</strong></td> <td width="11%" align="center"><strong>แผนกที่แจ้ง</strong></td> <td width="38%" align="center"><strong>รายละอียด</strong></td> <td width="10%" align="center"><strong>สถานะงาน</strong></td> <td width="20%" align="center"><strong>หมายเหตุ</strong></td> </tr> <?php do { ?> <tr> <td align="center"><?php echo $row_Recordset1['name']; ?></td> <td align="center"><?php echo $row_Recordset1['datepicker']; ?></td> <td><?php echo $row_Recordset1['department']; ?></td> <td><a href="admin/details.php?id=<?php echo $row_Recordset1['id']; ?>"><?php echo $row_Recordset1['details']; ?></a></td> <td align="center"><?php echo $row_Recordset1['status']; ?></td> <td><?php echo $row_Recordset1['comment']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table><table width="240" border="0" align="center"> <tr> <td width="21"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>"><img src="First.gif" /></a> <?php } // Show if not first page ?></td> <td width="17"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="Previous.gif" /></a> <?php } // Show if not first page ?></td> <td width="17"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img src="Next.gif" /></a> <?php } // Show if not last page ?> </td> <td width="68"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="Last.gif" /></a> <?php } // Show if not last page ?></td> </tr> </table> </p> <p> </p> <p> </p> </body> </html> <?php mysql_free_result($Recordset1); mysql_free_result($Recordset2); ?>
©
2018.