| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/comservices/backend/ |
Upload File : |
<?php require_once('../Connections/comservice.php'); ?>
<?php include("file-upload.inc.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmaddcase")) {
$insertSQL = sprintf("INSERT INTO com_inform (item_id, device_name, inform_location, job_type, inform_detail, inform_img, member_name, admin_id, inform_status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['item_id'], "text"),
GetSQLValueString($_POST['device_name'], "text"),
GetSQLValueString($_POST['inform_location'], "text"),
GetSQLValueString($_POST['job_type'], "text"),
GetSQLValueString($_POST['inform_detail'], "text"),
GetSQLValueString(Upload($_FILES['inform_img']), "text"),
GetSQLValueString($_POST['member_name'], "text"),
GetSQLValueString($_POST['admin_id'], "text"),
GetSQLValueString($_POST['status'], "text"));
mysql_select_db($database_comservice, $comservice);
$Result1 = mysql_query($insertSQL, $comservice) or die(mysql_error());
$insertGoTo = "inform_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_recmem = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_recmem = $_SESSION['MM_Username'];
}
mysql_select_db($database_comservice, $comservice);
$query_recmem = sprintf("SELECT * FROM com_member WHERE muser = %s", GetSQLValueString($colname_recmem, "text"));
$recmem = mysql_query($query_recmem, $comservice) or die(mysql_error());
$row_recmem = mysql_fetch_assoc($recmem);
$totalRows_recmem = mysql_num_rows($recmem);
mysql_select_db($database_comservice, $comservice);
$query_job_type = "SELECT * FROM com_job_type";
$job_type = mysql_query($query_job_type, $comservice) or die(mysql_error());
$row_job_type = mysql_fetch_assoc($job_type);
$totalRows_job_type = mysql_num_rows($job_type);
mysql_select_db($database_comservice, $comservice);
$query_device_name = "SELECT * FROM com_devices";
$device_name = mysql_query($query_device_name, $comservice) or die(mysql_error());
$row_device_name = mysql_fetch_assoc($device_name);
$totalRows_device_name = mysql_num_rows($device_name);
?>
<!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>ระบบแจ้งซ่อมครุภัณฑ์คอมพิวเตอร์ออนไลน์ </title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function validateForm() {
var i = document.forms["frmaddcase"]["item_id"].value;
if (i==null || i=="") {
alert("กรุณากรอกรหัสครุภัณฑ์ให้ครบถ้วน");
return false;
}
var l= document.forms["frmaddcase"]["inform_location"].value;
if (l==null || l=="") {
alert("กรุณากรอกข้อมูลที่อยู่ครุภัณฑ์ให้ครบถ้วน");
return false;
}
var d= document.forms["frmaddcase"]["inform_detail"].value;
if (d==null || d=="") {
alert("กรุณากรอกข้อมูลอาการเสียให้ครบถ้วน");
return false;
}
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor="#EEEEEE">
<h3> ระบบแจ้งซ่อมครุภัณฑ์คอมพิวเตอร์ออนไลน์</h3></td>
</tr>
</table>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"><font color="#3366FF"></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF">
<b>
</b></td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td width="18%" rowspan="2" align="left" valign="top" bgcolor="#FFFFFF">
<?php include("menumember.php"); ?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" align="center" bgcolor="#EEEEEE"><a href="<?php echo $logoutAction ?>">ออกจากระบบ</a></td>
</tr>
</table>
</td>
<td align="center" bgcolor="#FFFFFF">
<a href="#" class="list-group-item active">
<strong>แบบฟอร์มแจ้งซ่อมครุภัณฑ์คอมพิวเตอร์</strong></a></td>
</tr>
<tr>
<td width="82%" align="right" bgcolor="#FFFFFF">
<form action="<?php echo $editFormAction; ?>" onsubmit="return validateForm()" method="POST" enctype="multipart/form-data" name="frmaddcase" id="frmaddcase" >
<table width="80%" border="0" align="right" cellpadding="10" cellspacing="10">
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td width="24%" align="right">หัวข้อการแจ้งซ่อม /รหัสครุภัณฑ์ : </td>
<td><input name="item_id" type="text" class="form-control" id="item_id"
placeholder="กรอกข้อมูล" value="" />
</td>
<td valign="top"><font color="#FF0000">*ต้องการข้อมูล </font></td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right">ประเภทครุภัณฑ์ : </td>
<td colspan="2"><label for="device_name"></label>
<label for="device_name"></label>
<select name="device_name" id="device_name">
<?php
do {
?>
<option value="<?php echo $row_device_name['device_name']?>"><?php echo $row_device_name['device_name']?></option>
<?php
} while ($row_device_name = mysql_fetch_assoc($device_name));
$rows = mysql_num_rows($device_name);
if($rows > 0) {
mysql_data_seek($device_name, 0);
$row_device_name = mysql_fetch_assoc($device_name);
}
?>
</select></td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right">ประเภทปัญหา : </td>
<td colspan="2"><label for="job_type"></label>
<select name="job_type" id="job_type">
<?php
do {
?>
<option value="<?php echo $row_job_type['type_name']?>"><?php echo $row_job_type['type_name']?></option>
<?php
} while ($row_job_type = mysql_fetch_assoc($job_type));
$rows = mysql_num_rows($job_type);
if($rows > 0) {
mysql_data_seek($job_type, 0);
$row_job_type = mysql_fetch_assoc($job_type);
}
?>
</select></td>
</tr>
<tr>
<td align="right"> </td>
<td> </td>
<td width="16%"> </td>
</tr>
<tr>
<td align="right" valign="top">อาการเสีย : </td>
<td><font color="#FF0000">
<textarea name="inform_detail" rows="3" class="form-control" id="inform_detail" placeholder="กรุณาระบุอาการเสีย/ปัญหา อย่างละเอียด"></textarea>
</font></td>
<td valign="top"><font color="#FF0000">* ต้องการข้อมูล </font></td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"><label for="inform_img"></label></td>
</tr>
<tr>
<td align="right">ภาพประกอบ : </td>
<td colspan="2"><input type="file" name="inform_img" id="inform_img" /></td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right">ที่ตั้งครุภัณฑ์ : </td>
<td><input name="inform_location" type="text" class="form-control" id="inform_location" placeholder="กรุณาระบุที่ตั้งอย่างละเอียด เช่น อาคาร, ชั้น, ห้อง, โต๊ะ" value="" /></td>
<td valign="top"><font color="#FF0000">* ต้องการข้อมูล </font></td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2"><input name="member_name" type="hidden" id="member_name" value="<?php echo $row_recmem['muser']; ?>" />
<input name="admin_id" type="hidden" id="admin_id" value="devbanban.com" />
<input name="status" type="hidden" id="status" value="waiting" /></td>
</tr>
<tr>
<td colspan="3" align="center">
<button type="submit" class="btn btn-primary ">บันทึกข้อมูล</button>
<button type="reset" class="btn btn-warning">เคลียร์ข้อความ</button> </td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="2" align="center"> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="frmaddcase" />
</form>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"> </td>
</tr>
</table>
<p> </p>
<?php
include("../footer.php")
?>
<?php
mysql_free_result($recmem);
mysql_free_result($job_type);
mysql_free_result($device_name);
?>
</body>
</html>