| Server IP : 104.21.80.248 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/Downloads/evaluation/ |
Upload File : |
<?php
session_start();
date_default_timezone_set('Asia/Bangkok');
include("config.inc.php");
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
echo "<LINK HREF='style/style.css' REL='stylesheet' TYPE='text/css'>";
if ( ($_SESSION['admin_login']==$admin_login && $_SESSION['password_admin_login']==$password_admin_login) or ($_SESSION['admin_evaluation']=="evaluation") ) {
include("header.php");
echo "<h1>".$office."</h1>";
//ส่วนเพิ่มข้อมูล
if($_GET[idx]==1){
echo "<form id='frm' name='frm' method='post' action='admin.php?idx=4'>";
echo "<Center>";
echo "<Font color='#006666' Size=3><B>เพิ่มกลุ่มงานที่ต้องการประเมิน</B></Font>";
echo "</Cener>";
echo "<Br>";
echo "<Table Border='0'>";
echo "<Tr><Td align='right'>รหัส </Td><Td><Input Type='Text' Name='cat_id' Size='5' class='custom-select'></Td></Tr>";
echo "<Tr><Td align='right'>ชื่อกลุ่มงาน </Td><Td><Input Type='Text' Name='cat_name' Size='40' class='custom-select'></Td></Tr>";
echo "<Br>";
echo "</Table>";
echo "<Br>";
echo "<INPUT TYPE='submit' name='smb' value='ตกลง' class=myButton> <INPUT TYPE='button' name='back' value='ย้อนกลับ' onclick='javascript:history.back(-1)' class=myButton>";
echo "</form>";
}
//ส่วนยืนยันการลบข้อมูล
if($_GET[idx]==2) {
echo "<table width='500' border='0' align='center'>";
echo "<tr><td align='center'><font color='#990000' size='4'>โปรดยืนยันความต้องการลบข้อมูลอีกครั้ง</font><br></td></tr>";
echo "<tr><td align=center>";
echo "<INPUT TYPE='button' name='smb' value='ยืนยัน' onclick='location.href=\"admin.php?idx=3&id=$_GET[id]\"' class=myButton> <INPUT TYPE='button' name='back' value='ยกเลิก' onclick='javascript:history.back(-1)' class=myButton>";
echo "</td></tr></table>";
}
//ส่วนลบข้อมูล
if($_GET[idx]==3){
$sql = "delete from eva_cat where id=$_GET[id]";
$dbquery = mysqli_query($connect,$sql);
}
//ส่วนเพิ่มข้อมูล
if($_GET[idx]==4){
$sql = "insert into eva_cat (cat_id, cat_name) values ( '$_POST[cat_id]','$_POST[cat_name]','1')";
$dbquery = mysqli_query($connect,$sql);
}
//ส่วนฟอร์มแก้ไขข้อมูล
if ($_GET[idx]==5){
echo "<form id='frm' name='frm' method='post' action='admin.php?idx=6'>";
echo "<Center>";
echo "<Font color='#006666' Size=3><B>แก้ไข</B></Font>";
echo "</Cener>";
echo "<Br>";
$sql = "select * from eva_cat where id='$_GET[id]'";
$dbquery = mysqli_query($connect,$sql);
$ref_result = mysqli_fetch_array($dbquery);
echo "<Table Border='0'>";
echo "<Tr><Td align='right'>รหัส </Td><Td><Input Type='Text' Name='cat_id' Size='5' value='$ref_result[cat_id]' class='custom-input'></Td></Tr>";
echo "<Tr><Td align='right'>ชื่อกลุ่ม </Td><Td><Input Type='Text' Name='cat_name' Size='60' value='$ref_result[cat_name]' class='custom-input'></Td></Tr>";
echo "<Br>";
echo "</Table>";
echo "<Br>";
echo "<Input Type=Hidden Name='id' Value='$_GET[id]'>";
echo "<INPUT TYPE='submit' name='submit' value='ตกลง' class='myButton'> <INPUT TYPE='button' name='back' value='ย้อนกลับ' onclick='javascript:history.back(-1)' class='myButton'>";
echo "</form>";
}
//ส่วนปรับปรุงข้อมูล
if ($_GET[idx]==6){
$sql = "update eva_cat set cat_id='$_POST[cat_id]',cat_name='$_POST[cat_name]' where id='$_POST[id]'";
$dbquery = mysqli_query($connect,$sql);
}
//ส่วนเปิด-ปิดการใช้งาน
if ($_GET[idx]==7){
$sql = "update eva_cat set status='$_GET[status]' where id='$_GET[id]'";
$dbquery = mysqli_query($connect,$sql);
}
if ($_GET[idx]=='logout'){
session_destroy();
echo "<meta http-equiv=refresh content=1;URL=index.php>";
echo "<br><br>";
echo "<center>";
echo "<img src='image/sleep.gif'>";
echo "<font color=\"#000080\"><h1>อ อ ก จ า ก ร ะ บ บ เ รี ย บ ร้ อ ย แ ล้ ว ค รั บ</h1></font>";
echo "<font color=\"#660000\"><h2>กรุณารอสักครู่</h2></font>";
echo "</center>";
}
//ส่วนการแสดงผล
if(!(($_GET[idx]==1) or ($_GET[idx]==2) or ($_GET[idx]==5) or ($_GET[idx]=='logout'))){
$sql = "select * from eva_cat order by id";
$dbquery = mysqli_query($connect,$sql);
echo "<table align='center' class='myTableGold'>";
echo "<Tr><Td align='left' colspan=7><INPUT TYPE='submit' name='smb' value='เพิ่มข้อมูล' onclick='location.href=\"admin.php?idx=1\"' class='myButton'> <INPUT TYPE='button' name='smb' value='ออกจากระบบ' onclick='location.href=\"admin.php?idx=logout\"' class='myButton'></Td></Tr>";
echo "<th width='50'>ที่</th> <th width='50'>รหัส</th><th>กลุ่ม</th><th>สถานะเปิดใช้งาน</th><th width='50'>ลบ</th><th width='50'>แก้ไข</th><th>คัดลอก Link</th>";
$N=1;
While ($result = mysqli_fetch_array($dbquery)){
$id = $result['id'];
$cat_id= $result['cat_id'];
$cat_name= $result['cat_name'];
$status=$result['status'];
switch ($status){
case 0: $status_img="<a href='admin.php?idx=7&id=$id&status=1' alt='เปิดการใช้งาน' title='เปิดการใช้งาน'><img src='image/no.png' width=32></a>"; break;
case 1: $status_img="<a href='admin.php?idx=7&id=$id&status=0' alt='ปิดการใช้งาน' title='ปิดการใช้งาน'><img src='image/yes.png' width=32></a>"; break;
}
echo "<Tr>";
echo "<Td align=center>$N</Td>";
echo "<Td align=center>$cat_id</Td>";
echo "<Td align=left>$cat_name</Td>";
echo "<Td align=center>$status_img</Td>";
echo "<Td align=center><a href=admin.php?idx=2&id=$id><img src=image/drop.png border='0' alt='ลบ' width=32></a></Td>";
echo "<Td align=center><a href=admin.php?idx=5&id=$id><img src=image/edit.png border='0' alt='แก้ไข' width=32></a></Td>";
$copylink=$url."/index.php?idx=".$id;
echo "<td><input type='text' value='$copylink' id='copylink".$id."' class='custom-input' >
<button onclick='copyLink(".$id.")' class=myButton>Copy Link</button></td>";
echo "</Tr>";
$N++;
}
echo "</Table>";
}
////////////////////////////////
}else{
echo "<form name='frm' action='login_check.php' method='post' onsubmit='return check();'>
<table border=0 width=450>
<tr><td bgcolor=#D3E4F5 align=center>
<table bgcolor=#EEEEEE cellspacing=0 cellpadding=1 width=100%>
<tr><td align=center colspan=2>
<font color=green size=4><b>".$title."</b></font><br><font color=#666666 size=2>".$office."<br>ยินดีต้อนรับ</font><br>
</td></tr>
<tr><td align=right width=40%><font color=#666666 size=2>ชื่อผู้ใช้ : </font></td><td><input name='username' type='text' id='username' value='username' onFocus='clearText(this)' class='custom-select' style='width:180px;'></td></tr>
<tr><td align=right><font color=#666666 size=2>รหัสผ่าน : </font></td><td><input name='password' type='password' id='password' value='password' onFocus='clearText(this)' class='custom-select' style='width:180px;'></td></tr>
<tr><td></td><td><input type=submit name='op' value='เข้าระบบ' class=myButton><br></td></tr>
</table>
</td></tr>
</table>
</form>";
}
?>
<script language="JavaScript">
<!--
function check() {
if(document.frm.username.value=="username") {
alert("กรุณากรอกชื่อที่ใช้ในการล็อกอินเข้าระบบด้วยครับ") ;
document.frm.username.focus() ;
return false ;
}
else if(document.frm.password.value=="password") {
alert("กรุณากรอกรหัสผ่านด้วยครับ") ;
document.frm.password.focus() ;
return false ;
}
else
return true ;
}
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
function copyLink(id) {
/* Get the text field */
var copyText = document.getElementById("copylink"+id);
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
alert("Copied this link : " + copyText.value);
}
//-->
</script>