<?php session_start(); if (!isset($_SESSION['MM_Username']) && ($_SESSION['MM_Authorization'] )) ?> <!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" dir="ltr" lang="en-US" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>IT Service Desk</title> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <script type="text/javascript" src="../templates/script.js"></script> <style type="text/css"> <!-- #dataTable{ width:100%; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; } #dataTable .content{ background:#0076a3; height:25px; text-align:center; font-size:14px; font-weight:bold; color:white; } #dataTable tr.even{ height:25px; background-color: #0099FF; } #dataTable tr.odd{ height:25px; background-color: #0066FF; } #dataTable tr.odd,tr.even{ font-size:15px; text-align:left; } --> </style> <div id="criteria"> <fieldset> <legend>Search</legend> <table width="100%"> <tr> <td> <form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>"> <table> <tr> <td>Search :</td> <td><select name="WhereSelect" id="WhereSelect"> <option value="0">-- Select catagory to search -- </option> <option value="1">-- Luname --</option> <option value="2">-- Property --</option> <option value="3">-- Servername --</option> <option value="4">-- Username --</option> </select></td> <td><input type="text" name="txtKeyword" id="txtKeyword" value="<?=$_GET[txtKeyword]?>"/></td> <td><input type="submit" name="button" id="button" value="Submit" /></td> </tr> </table> </form> </td> </tr> <tr> <td> <?php //---SCRIPT_NAME ///( isset($_GET["Search"]) ) if ($_GET[txtKeyword] != "") { $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("pcom"); mysql_query("SET character_set_results=utf8"); mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); mysql_query("collation_connection = utf8_bin"); mysql_query("collation_database = utf8_bin"); mysql_query("collation_server = utf8_bin"); $word = $_GET[txtKeyword] ; $WhereSelect = $_GET[WhereSelect]; if ( $WhereSelect == 0 ) { $swicth_condition = 1 ; } elseif ( $WhereSelect == 1 ) { $swicth_condition = 2 ; } elseif ( $WhereSelect == 2 ) { $swicth_condition = 3 ; } elseif ( $WhereSelect == 3 ) { $swicth_condition = 4 ; } elseif ( $WhereSelect == 4 ) { $swicth_condition = 5 ; } switch ( $swicth_condition ) { case 1 : $condition_sql = " WHERE Luname LIKE ('%$word%') || Property LIKE ('%$word%') || Severname LIKE ('%$word%') || Username LIKE ('%$word%')" ; break ; case 2 : $condition_sql = " WHERE Luname LIKE ('%$word%')" ; break ; case 3 : $condition_sql = " WHERE Property LIKE ('%$word%')" ; break ; case 4 : $condition_sql = " WHERE Severname LIKE ('%$word%')" ; break ; case 5 : $condition_sql = " WHERE Username LIKE ('%$word%')" ; break ; } $strSQL = "SELECT * FROM ho_remote ".$condition_sql." "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 40; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } // WHERE Username LIKE ('%".$_GET["txtKeyword"]."%') || Name LIKE ('%".$_GET["txtKeyword"]."%')|| ESN LIKE ('%".$_GET["txtKeyword"]."%')"; $strSQL .=" order by Username ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <script language="javascript" src="search.js" type="text/javascript"></script> <?php switch($_SESSION['MM_UserRight']){ case "Administrator" : ?> <table align="center" cellpadding="0" cellspacing="0" id="dataTable"> <td class="content">Luname</td> <td class="content">Property</td> <td class="content">Servername</td> <td class="content">Username</td> <td class="content">Action</td> <? while($objResult=mysql_fetch_array($objQuery)){ if($i%2==0) $row="even"; else $row="odd"; echo "<tr class='$row'>"; echo "<td align='center' width='100'>"; echo "<a href='/pcom/statususer.php?username=$objResult[Luname]'>$objResult[Luname]</a></td>"; echo "<td align='left'>$objResult[Property]</td>"; echo "<td align='center'>$objResult[Severname]</td>"; echo "<td align='center'>$objResult[Username]</td>"; echo "<td width='243'>"; if($objResult[Status_No]=="2"||$objResult[Status_No]=="") echo "<input type='button' value='Received' class='btSpan-1' onclick=statusRecieve('$objResult[Username]')>"; else{ echo "<input type='button' value='Change' class='btSpan-1' onclick=statusChange('$objResult[Username]')>"; echo "<input type='button' value='Edit' class='btSpan-1' onclick=statusEdit('$objResult[Username]')>"; echo "<input type='button' value='Return' class='btSpan-1' onclick=statusReturn('$objResult[Username]')>"; } echo "</td>"; echo "</tr>"; $i+=1; } ?> </table> <?php break; ?> <?php case "User" : ?> <table align="center" cellpadding="0" cellspacing="0" id="dataTable"> <td class="content">Luname</td> <td class="content">Property</td> <td class="content">Servername</td> <td class="content">Username</td> <? while($objResult=mysql_fetch_array($objQuery)){ if($i%2==0) $row="even"; else $row="odd"; echo "<tr class='$row'>"; echo "<td align='center' width='100'>"; echo "<a href='/pcom/statususer.php?username=$objResult[Luname]'>"; echo "$objResult[Luname]"; echo "</a>"; echo "</td>"; echo "<td align='left'>$objResult[Property]</td>"; echo "<td align='center'>$objResult[Severname]</td>"; echo "<td align='center'>$objResult[FunctionCode]</td>"; echo "</tr>"; $i+=1; } ?> </table> <?php break; ?> <?php } ?> </td> </tr> </table> </fieldset> </div> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td>Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> "; } mysql_close($objConnect); } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง