Path : /var/www/html/kPp2s@lary/admin/
File Upload :
Current File : //var/www/html/kPp2s@lary/admin/mageListManager.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_Adminname'] = NULL;
  $_SESSION['MM_AdminGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Adminname']);
  unset($_SESSION['MM_AdminGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}

$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_Adminname 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 = "login.php";
if (!((isset($_SESSION['MM_Adminname'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Adminname'], $_SESSION['MM_AdminGroup'])))) {   
  $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 require_once('../Connections/areaConn.php'); ?>
<?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;
}
}

$maxRows_viewList = 10;
$pageNum_viewList = 0;
if (isset($_GET['pageNum_viewList'])) {
  $pageNum_viewList = $_GET['pageNum_viewList'];
}
$startRow_viewList = $pageNum_viewList * $maxRows_viewList;

$query_viewList = "SELECT * FROM hhsalary_tb order by hs_id desc";
$query_limit_viewList = "$query_viewList LIMIT $startRow_viewList, $maxRows_viewList";
$viewList = mysqli_query($areaConn,$query_limit_viewList);
$row_viewList = mysqli_fetch_assoc($viewList);

if (isset($_GET['totalRows_viewList'])) {
  $totalRows_viewList = $_GET['totalRows_viewList'];
} else {
  $all_viewList = mysqli_query($areaConn,$query_viewList);
  $totalRows_viewList = mysqli_num_rows($all_viewList);
}
$totalPages_viewList = ceil($totalRows_viewList/$maxRows_viewList)-1;
?>
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Office of Kamphaengphet Primary Education Area 2</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="../css/bootstrap.min.css" rel="stylesheet" />
<script src="../js/jquery.js"></script>
<script src="../js/bootstrap.min.js"></script>
<style type="text/css">
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
</style>

</head>

<body>
  <div class="row" style="background-color:seagreen;">
    	<div class="col-xl-12" style="text-align: center;">
      		<p style="margin-top:10px; color:whitesmoke;">
        	<img src="../images/manlogo.png" class="rounded-circle" width="40" height="40">
      		ระบบนำเข้าข้อมูลสมาชิกบุคลากรทางการศึกษา(ผู้บริหาร)
      		</p>
      </div>
      
  </div>
  <div class="row" style="background-color:#FFF;margin-top:5px;margin-left:5px;margin-right:5px;border-radius:5px;">
		<div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
		<div class="col-xl-6 col-lg-6 col-md-6 col-sm-8">
      <button class="btn btn-success" onclick="Javascript:window.location.href='insertListManager.php';">เพิ่มรายการใหม</button>
    </div>
    <div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
  </div>
  <div class="row" style="background-color:#FFF;margin-top:5px;margin-left:5px;margin-right:5px;border-radius:5px;">
		<div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
		<div class="col-xl-6 col-lg-6 col-md-6 col-sm-8">
      <table class="table table-bordered table-striped">
        <tr style="background-color:brown;color:#FFF">
          <td style="text-align:center">ที่</td>
          <td>รายการเลื่อนเงินเดือน</td>
          <td style="text-align:center">วันที่</td>
          <td style="text-align:center">สถานะ</td>
          <td style="text-align:center">แก้ไข</td>
          <td style="text-align:center">นำเข้าข้อมูล</td>
        </tr>
        <?php 
          $i=1;
          do { ?>
            <tr>
              <td style="text-align:center"><?php echo $i; ?></td>
              <td><?php echo $row_viewList['hs_name']."(".$row_viewList['hs_start'].")"; ?></td>
              <td style="text-align:center"><?php echo $row_viewList['hs_date']; ?></td>
              <td style="text-align:center"><?php echo $row_viewList['hs_status']; ?></td>
              <td style="text-align:center"><a href="updateListManager.php?id=<?php echo $row_viewList['hs_id']; ?>"><img src="images/b_edit.png" width="16" height="16" /></a></td>
              <td style="text-align:center"><a href="selectFileManager.php?hsid=<?php echo $row_viewList['hs_id']; ?>"><img src="images/upload.png" width="22" height="23" /></a></td>
            </tr>
            <?php 
            $i++;
          } while ($row_viewList = mysqli_fetch_assoc($viewList)); ?>
        </table>
      </div>
      <div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
    </div>
  <div class="row" style="background-color:#FFF;margin-top:5px;margin-left:5px;margin-right:5px;border-radius:5px;">
		<div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
		<div class="col-xl-6 col-lg-6 col-md-6 col-sm-8">
          <button type="button" class="btn btn-primary" onclick="JavaScript:window.location.href='manage.php';">หน้าหลัก</button>
          <button type="button" class="btn btn-danger" onclick="JavaScript:window.location.href='<?php echo $logoutAction ?>';">ออกจากระบบ</button>
    </div>
    <div class="col-xl-3 col-lg-3 col-md-3 col-sm-2"></div>
  </div>
</body>
</html>
<?php
mysqli_free_result($viewList);
?>