<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<link href="../css/main.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function mOvr(src, clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
function mOut(src, clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
} 
function mClk(src, clrOver, clrIn){ 
	if((event.srcElement.tagName=='TD') && (src.children.tags('A')[0]))
		src.children.tags('A')[0].click();
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>

</head>
<body bgcolor="#F4F4F4" leftmargin="1" topmargin="1" marginwidth="1" marginheight="1">
<?
	include("config.inc.php");	//ตั้งค่าต่างๆของเวปบอร์ด
	include("function.php");		//ฟังก์ชั่นที่ใช้ในเวปบอร์ด
    $key=$_GET['key'];
    $user=$_GET['user'];
	$filename="../member.txt";
		if(file_exists($filename)) 
	   {	// ถ้ามีไฟล์หัวข้อคำถาม
		$dat01 = file($filename);
         // แยกข้อมูลในแต่ละบรรทัด ออกเป็นฟิลด์ย่อย
		 for($i=0;$i<sizeof($dat01);$i++)
		 {
		      $buf = explode("|X|",$dat01[$i]);
			  if($buf[1]==$user)$split = explode("|X|",$dat01[$i]);			   
          }
      }		 	
	
	
	// อ่านค่า Key จากไฟล์
	if(file_exists("../$split[1].pass")) {
		$FILE=fopen("../$split[1].pass","rt");
		$key_in_file=fgets($FILE,15);	// Key กำหนดอยู่ในไฟล์ 12 ตัว ฉะนั้นต้องอ่านมา มากกว่า 12 ในที่นี้ใช้ 15 ตัว
		fclose($FILE);
	}

	if($key!=$key_in_file) {
		echo Message(65,"red","ไม่อนุญาตให้เข้าใช้หน้า Admin (ลบคำถาม - คำตอบ)","อาจเพราะ Username และหรือ Password ไม่ถูกต้อง<br>หรือยังไม่ได้ Login เข้าระบบ","<a href='./login.php'>Login อีกครั้ง</a>");
		exit();
	}
	

?>
<table width="100%" height="100%" cellpadding="0" cellspacing="1">
  <tr>
    <td align="center" valign="middle"><table width="585" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
        <tr>
          <td height="19" bgcolor="#FFFFFF"><table width="100%" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="3" align="center" bgcolor="#0099CC"></td>
              </tr>
              <tr>
                <td height="17" align="center" bgcolor="#006699"><strong><font color="#FFFFFF" size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Add 
                  Job</font></strong></td>
              </tr>
              <tr> 
                <td height="17" align="center" bgcolor="#0099CC"><table width="100%" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="1%">&nbsp;</td>
                      <td width="10%" ><table cellpadding="0" cellspacing="1" bgcolor="#89B700">
                          <tr> 
                            <td align="center" bgcolor="#CCFF33" onMouseOver="mOvr(this, '#88EA35')"  onMouseOut="mOut(this, '#CCFF33')"  ><strong><a href="../manager.php?<? echo "num=$num&key=$key&user=$user"  ?>">&nbsp;Manager&nbsp;</a></strong></td>
                          </tr>
                        </table></td>
                      <td width="79%">&nbsp;</td>
                      <td width="10%"><table cellpadding="0" cellspacing="1" bgcolor="#89B700">
                          <tr> 
                            <td align="center" bgcolor="#CCFF33" onMouseOver="mOvr(this, '#88EA35')"  onMouseOut="mOut(this, '#CCFF33')"  ><strong><a href="../logout.php?<? echo "id=$split[1]"; ?>">&nbsp;Logout&nbsp;</a></strong></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td valign="top" bgcolor="#A9CFF5"> <table width="100%" height="100%" cellpadding="0" cellspacing="1">
                    <tr> 
                      <td height="38" valign="top" bgcolor="#F7FAED"><table width="100%" cellspacing="5" cellpadding="0">
                          <tr> 
                            <td>
		                   <form method="post" action="ac_addnew.php?<? echo "key=$key&user=$user"; ?>" name="webForm"   enctype="multipart/form-data">
                                <table width="100%" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
                                  <tr valign="top"> 
                                    <td width="18%" align="right"><font color="686898" size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Position</font></td>
                                    <td width="68%"><input type=text name="QTitle" size=50 maxlength=100 class=violet></td>
                                  </tr>
                                  <tr valign="top"> 
                                    <td align="right"><font color="686898">Job 
                                      Description</font></td>
                                    <td><input name="data" type="text" id="data" size="50"></td>
                                  </tr>
                                  <tr valign="top"> 
                                    <td align="right"><font color="686898">Job 
                                      Type</font></td>
                                    <td><input name="jobtype" type="text" id="data2" size="50"></td>
                                  </tr>
                                  <tr valign="top"> 
                                    <td align="right"><font color="686898" size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Qualifications</font></td>
                                    <td><textarea rows="5" cols="50" name="QNote" class=violet></textarea></td>
                                  </tr>
                                  <tr> 
                                    <td align=right><font color=686898 size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Place 
                                      of work</font></td>
                                    <td><input name="place" type="text" id="jobtype" size="50"></td>
                                  </tr>
                                  <tr> 
                                    <td align=right><font color=686898 size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Amount</font></td>
                                    <td><input name="Amount" type="text" id="Amount" size="50"></td>
                                  </tr>
                                  <tr>
                                    <td align=right><font color="#666699">Expected 
                                      Salary</font></td>
                                    <td><input type="text" name="salary"></td>
                                  </tr>
                                  <tr> 
                                    <td align=right><font color=686898 size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">Picture</font></td>
                                    <td> <input type="file" name="Upload_Img"   size=24> 
                                      <font color=#FF0033> (ไม่เกิน 50 Kb)</font> 
                                    </td>
                                  </tr>
                                  <tr valign="top"> 
                                    <td align="right"><font color="686898" size="1" face="MS Sans Serif, AngsanaUPC, CordiaUPC">&nbsp;</font></td>
                                    <td><input type="submit" name="Submit" value="Submit"> 
                                      <input type="reset" name="Submit2" value="Reset"> 
                                    </td>
                                  </tr>
                                </table>
                              </form></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
