MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/pathumthani_eoffice/application/bin/auction_news/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/bin/auction_news/auction.php
<?
include("chk_permission.php"); 
include("../../config/config.inc.php");
include("libary/function.php"); 
if(!isset($page) || $page == ""){ $page = 1; }
if($action == "del"){
	if($user_permission != 0){
	    $msg = "<br><font class=\"normal_blue\">Note</font><br><br>ระบบกำหนดให้ ผู้ดูแล (Admin) ทำการลบข้อมูลได้เท่านั้น";
		include('msg_box.php');
		echo "<meta http-equiv='refresh' content='2;url=auction.php'>" ;
		exit;
				
	}	
	
	$sql =  mysql_query("delete from `auction` where id = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$msg = "<font class=\"normal_blue\">Complete</font><br>ทำการลบข้อมูลเรียบร้อยแล้ว</div>";
	include('msg_box.php');
		echo "<meta http-equiv='refresh' content='2;url=auction.php'>" ;
	exit;
	
}

if ($_SERVER[REQUEST_METHOD] == "POST"){ 
//if Action is edit and file is send remove old file and replace with new one
if($action == "edit"){
	if($file_name != ""){
		$xsql = mysql_query("select attach from `auction` where id = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
		$xrs = mysql_fetch_assoc($xsql);
		if(file_exists($xrs[attach])){ unlink($xrs[attach]); }
	}
}

//echo "<br>".$file_name;
//echo "<br>".$file_size;
//echo "<br>".$file_type;
//Check file befor attach to server
if($file_name != "" ){

$filechk = "../../files/file_temp/auction/".$file_name;
if(file_exists($filechk)){ 

	$fn = split('[.]', $file_name);
	$f_name = $fn[0];	
	$f_ext = getFileExtension($file_name);
	$filename = "../../files/file_temp/auction/".$f_name."(1).".$f_ext;
	
} else {

	$filename = "../../files/file_temp/auction/".$file_name;
	
}

	if($file_size >= "2000000"){
	
		$msg = "<b class=warn>Warning</b><br>ขนาดของ file เกินจากที่กำหนดไว้ครับ<div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
		include("msg_box.php");		
		exit() ;
		
	} else {
	
		if(is_uploaded_file($file)){ 
			if (!copy($file,$filename)){
	 
				$msg = "ไม่สมารถ upload ขึ้น server ได้<br><div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
				include('msg_box.php');
				exit();		
			}
		unlink($file);  
		
		} else {
	
			$msg = "<font class=\"brown\">Can't upload this file</font><br>Folder ที่จะทำการบันทึกข้อมูลอาจจะยังไม่ได้กำหนดคุณลักษณะ<br>กรุณาตรวจสอบ CMOD ของ Folder<br><div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
			include('msg_box.php');
			exit();
		
		}
	}

}

//Date Change Type
$xsdate_place = swapdate($sdate_place);
$xedate_place = swapdate($edate_place);
$xexpire_day =  swapdate($expire_day);

//$temp_p1 = $stime_place1.$stime_place2;
//$temp_p2 = $etime_place1.$etime_place2;
// เวลาดูสถานที่
if($stime_place1 != "" and  $etime_place1 != ""){
	$xstime_place = add_zero($stime_place1).":".$stime_place2;
	$xetime_place = add_zero($etime_place1).":".$etime_place2;
}

// เวลาซื้อเอการ
//$temp_doc1 = $stime_doc1.$stime_doc2;
//$temp_doc2 = $etime_doc1.$etime_doc2;
if($stime_doc1 != "" and  $etime_doc1 != ""){
	$xstime_doc = add_zero($stime_doc1).":".$stime_doc2;
	$xetime_doc = add_zero($etime_doc1).":".$etime_doc2;
}

// เวลา ยื่นซอง
//$temp_offer1 = $stime_offer1.$stime_offer2;
//$temp_offer2 = $etime_offer1.$etime_offer2;
if($stime_offer1 != "" and  $etime_offer1 != ""){
	$xstime_offer = add_zero($stime_offer1).":".$stime_offer2;
	$xetime_offer = add_zero($etime_offer1).":".$etime_offer2;
}

if($stime_close1 != "" and $etime_close1 != ""){ 
$xstime_close = add_zero($stime_close1).":".$stime_close2;
$xetime_close = add_zero($etime_close1).":".$etime_close2;
}


$pur_doc_d1 = swapdate($pur_doc_d1);
$pur_doc_d2 = swapdate($pur_doc_d2);
$pur_offer_d1 = swapdate($pur_offer_d1);
$pur_offer_d2 = swapdate($pur_offer_d2);
$pur_close_d = swapdate($pur_close_d);
$stamp = date("Y-m-d H:i:s"); 
$detail = CheckTag($message);

//Query by Action
  }
$epage = 10;
if($action == ""){
	// Searching Section
	if($keyword == ""){ $where = " where 1 ";}else{ $where = " where $topic like '%$keyword%' ";}

	// Devide Page Section 
	$queryd = "select * from `auction` ";
	$queryd = $queryd.$where; 
	
	$devide = mysql_query($queryd)or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
	$totalpage = mysql_num_rows($devide);
	if(($page == "0") || ($page == "1") || ($page == "")){ $i = 0; } else { $i = ($page - 1) * $epage; }
	$all = ceil($totalpage / $epage);
} 
?>
<html>
<head><title>Administrator Section :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<link href="../../common/style.css" rel="stylesheet" type="text/css">
<link href="libary/tabber/tabber.css" rel="stylesheet" type="text/css">
<script language="javascript" src="libary/tabber/tabber.js"></script>
<script language="javascript" src="libary/popcalendar.js"></script>
<script language="javascript" src="libary/bbcode.js"></script>

<script type="text/javascript">
function chkTop() {
	var el = document.getElementById('auction_order');
	var xl = document.getElementById('auction_order_expire').style;
	if (el.checked==true) { xl.display='block'; } else { xl.display='none'; }
}
function chkTop2() {
	var el = document.getElementById('auction_status');
	var xl = document.getElementById('auction_status_expire').style;
	if (el.checked==true) { xl.display='block'; } else { xl.display='none'; }
}
</script>
  <script>  
				  function  conf(id){
				  if (confirm ("ท่านต้องการที่จะลบข้อมูลหรือไม่")==true)
				  {
				  location="auction.php?action=del&id="+id;return false;
				  }
				  }
				  </script> 
<style type="text/css">
<!--
.style1 {color: #FF0000; }
.tabber{display:none; }
.tabber1 {display:none; }
-->
</style>
</head>
<body topmargin="0">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
	<td height="100%" valign="middle">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#cdcdcd">
<tr>
  <td><table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
    <tr>
      <td width="86%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="normal">
        <tr>
          <td width="51%" height="23" bgcolor="#eeeeee">&nbsp;<img src="../../images/arrow-b.gif" border="0" align="absmiddle">&nbsp;<b class="normal_blue">Main Menu&nbsp;<font class="normal_black">:</font></b>&nbsp;ระบบข่าวประกวดราคา
            <hr color="#cdcdcd"></td>
          <td width="27%" height="23" bgcolor="#eeeeee">&nbsp;<a href="../control/index.php?action=logout">LOGOUT</a>
              <hr color="#cdcdcd"></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><br>
              <!-- ------------------------Main Body------------------------------- -->
             
              <? if($action == "view") { 
		$sql_view = mysql_query("select * from auction_file  where id = '$_GET[id]'")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
	$rs = mysql_fetch_assoc($sql_view);
	
	$detail = detail($rs[detail]);
	$price = $rs[price];
	$depname = detail($rs[depname]);				
	$pur_doc_detail = detail($rs[pur_doc_detail]);		
	$pur_offer_detail = detail($rs[pur_offer_detail]);		
	$pur_close_detail = detail($rs[pur_close_detail]);	
		
	if($rs[id] != ""){ 
		$attch="../../attach_file/".$rs[name]; 
		if (chkattach($attch)) {
			$dl="<a href=\"".$attch."\"><font class=\"blue\">".$rs[name]."</font></a>";
		}
	} else { $dl = "N/A"; }

	$xsql =  mysql_query("select detail as atype from `auction_type` where id = '$rs[type]'")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
	$xrs = mysql_fetch_assoc($xsql);
?>
              <table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
                <tr>
                  <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="normal">
                      <tr bgcolor="#f8f8f8">
                        <td height="20" colspan="2" class="normal_blue">&nbsp;<img src="../../images/page.gif" width="18" height="18" border="0" align="absmiddle">ข้อมูลการประกวดราคา <b class="brown">
                          <?=$rs[title]?>
                        </b></td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">หน่วยงาน&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal">&nbsp;
                            <?=$depname?></td>
                      </tr>
                      <tr>
                        <td colspan="2"><hr color="#eeeeee"></td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">รายละเอียด&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal">&nbsp;
                            <?=$detail?></td>
                      </tr>
                      <tr>
                        <td height="20" align="right">ราคากลาง(บาท)&nbsp;<b>:</b>&nbsp;</td>
                        <td align="left" class="normal">&nbsp;
                            <?=number_format($price)?></td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right"><img src="../../images/paperclip.jpg" align="absmiddle">&nbsp;เอกสารแนบ&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal">&nbsp;
                            <?=$dl?></td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">ประเภทการจัดซื้อ&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="warn">&nbsp;
                            <?=$xrs[atype]?></td>
                      </tr>
                      <tr>
                        <td colspan="2"><hr color="#eeeeee"></td>
                      </tr>
                      <tr bgcolor="#f8f8f8">
                        <td colspan="2" align="left" height="20" class="blue">&nbsp;<img src="../../images/email_open.gif" width="15" height="12" align="absmiddle">&nbsp;ซื้อเอกสารสอบราคา / ซื้อเอกสารการประมูล ฯ</td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">ตั้งแต่&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal_black">&nbsp;
                            <?=daythai($rs[pur_doc_d1])?></td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">ถึง&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal_black">&nbsp;
                            <?=daythai($rs[pur_doc_d2])?></td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">รายละเอียด&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left">&nbsp;
                            <?=$pur_doc_detail?></td>
                      </tr>
                      <tr>
                        <td colspan="2" height="20">&nbsp;</td>
                      </tr>
                      <tr bgcolor="#f8f8f8">
                        <td colspan="2" align="left" height="20" class="blue">&nbsp;<img src="../../images/email_reply.gif" width="15" height="12" align="absmiddle">&nbsp;ยื่นซองสอบราคา / ยื่นเอกสารการประมูล ฯ</td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">ตั้งแต่&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal_black">&nbsp;
                            <?=daythai($rs[pur_offer_d1])?></td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">ถึง&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal_black">&nbsp;
                            <?=daythai($rs[pur_offer_d2])?></td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">รายละเอียด&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left">&nbsp;
                            <?=$pur_offer_detail?></td>
                      </tr>
                      <tr>
                        <td colspan="2" height="20">&nbsp;</td>
                      </tr>
                      <tr bgcolor="#f8f8f8">
                        <td colspan="2" align="left" height="20" class="orange">&nbsp;<img src="../../images/email.gif" width="14" height="10" align="absmiddle">&nbsp;เปิดซองสอบราคา / ประกาศรายชื่อผู้มีสิทธิเข้าประมูลฯ</td>
                      </tr>
                      <tr>
                        <td width="196" height="20" align="right">วันที่&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left" class="normal_black">&nbsp;
                            <?=daythai($rs[pur_close_d])?></td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">รายละเอียด&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left">&nbsp;
                            <?=$pur_close_detail?></td>
                      </tr>
                      <tr>
                        <td colspan="2" height="20">&nbsp;</td>
                      </tr>
                      <tr bgcolor="#f8f8f8">
                        <td colspan="2" align="left" height="20" class="orange">&nbsp;ข้อมูลผู้ได้รับเลือก</td>
                      </tr>
                      <tr valign="top">
                        <td width="196" height="20" align="right">รายละเอียด&nbsp;<b>:</b>&nbsp;</td>
                        <td width="576" align="left">&nbsp;
                            <?=$rs[note];?></td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center"><hr color="#f8f8f8">
                            <input name="button" type="button" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page?>');" value="กลับหน้าหลัก"></td>
                      </tr>
                  </table></td>
                </tr>
              </table>
            <br>
              <? } else {  ?>
              <form name="search" method="get" action="<?=$PHP_SELF?>">
                <table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
                  <tr>
                    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr bgcolor="#f8f8f8">
                          <td width="166" height="20" rowspan="3" class="normal_black"><div align="left"><img src="../../images/search.jpg" width="16" height="16" align="absmiddle">&nbsp;ค้นหา
                            <input type="text" name="keyword" class="input" style="width:150px; height:20px; background-color:#ffffff;" value="<?=$keyword?>">
                                  <select name="topic" class="input" style="width:150px; height:20px;">
                                    <option value="depname">หน่วยงาน</option>
                                    <option value="detail">รายการ</option>
                                  </select>
                                  <input type="hidden" name="page" value="1">
                                  <input type="submit" name="submit" value="Go" style="width:50;" class="input">
                          </div></td>
                          <td width="130" rowspan="3" ><div align="center"><img src="../../images/approve.gif" width="16" height="16" border="0" align="absmiddle">&nbsp;<font class="normal_blue"><a href="<?=$PHP_SELF?>?action=auction_news&page=1"style="text-decoration:none;">ข่าวที่ผ่านการประมูล</a></font></div></td>
                          <td width="143" rowspan="3" class="normal_black"><div align="center"><img src="../../images/handshake.gif" border="0" align="absmiddle">&nbsp;<font class="normal_blue"><a href="<?=$PHP_SELF?>?action=auction_status_price&page=1"style="text-decoration:none;">สถานะการประกวดราคา</a></font></div></td>
                          <td width="99" rowspan="3"><div align="center"><a href="<?=$PHP_SELF?>?page=1" style="text-decoration:none;"><img src="../../images/arrow-d.gif" width="9" height="9" align="absmiddle" border="0">&nbsp;<font class="normal_blue">แสดงทั้งหมด</font></a> </div></td>
                          <td width="201" rowspan="3" bgcolor="#f8f8f8"><div align="center"><a href="<?=$PHP_SELF?>?action=auction_status&page=1" style="text-decoration:none;"><img src="../../images/arrow-d.gif" width="9" height="9" align="absmiddle" border="0">&nbsp;แสดงเฉพาะที่มีผู้ประกวดราคาแล้ว</a> </div></td>
                        </tr>
                        <tr >
                          <td rowspan="3" bgcolor="#f8f8f8"><div align="left"><img src="../../images/profile_plus.gif" border="0" alt="เพิ่ม" align="absmiddle"><a href="auction_add.php" style="text-decoration:none;"><font class="normal_blue">เพิ่มข้อมูล</font></a></div></td>
                        </tr>
                    </table></td>
                  </tr>
                </table>
              </form>
            <table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
                <tr >
                  <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr bgcolor="#C1E2F8" class="normal_blue">
                      <td width="5%"  align="center" valign="top">ลำดับ</td>
                      <td width="24%"  align="center" valign="top" bgcolor="#C1E2F8">&nbsp;หน่วยงาน</td>
                      <td width="31%"  align="left" valign="top">&nbsp;&nbsp;&nbsp;&nbsp;
                        รายละเอียด</td>
                      <td   width="12%"align="center" valign="top"><div align="left"><? if($action=="auction_status_price"){echo "สถานะ";}else{echo "ประเภท";}?></div></td>
                      <td width="9%"  align="center" ><? if($action=="auction_news"){echo "ราคาที่ประมูลได้";}elseif($action=="auction_status"){echo "Expire Day";}?></td>
                      <td width="7%"  align="center"><? if($action=="auction_news"){echo "บริษัทที่ชนะประมูล";}elseif($action=="auction_status"){echo "Expire Time";}?></td>
                      <td width="5%"  align="center">&nbsp;</td>
					  <td width="3%"  align="center" >&nbsp;</td>
                      <td width="3%"  align="center">&nbsp;</td>
                      <td width="1%"  align="center">&nbsp;</td>
                    </tr>
                    <?
//$epage=$epage-$rsx[curr_auction_order];
// Sticky
if ($action =="auction_status") { 
$sql = mysql_query("select count(*) as curr_auction_order from `auction` ") or die("Query line " . __LINE__ . " Error<hr>".mysql_error()); 
$rsx = mysql_fetch_assoc($sql);
$epage=$epage-$rsx[curr_auction_order];
 $sql = "select * from `auction` where   auction_status='1'";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = "#F9C77B";
	$ij= $ij + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
	$edit = "<a href='auction_edit.php?id=$rs[id]'\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไข\">></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"if(confirm('ท่านต้องการที่จะลบข้อมูล1 $rs[title] ใช่หรือไม่ ?')==true);return false;\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\">";
$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
?>
                    
                    <?
	}  
	 $x=$ij-$rsx[curr_auction_order];
 $sql = "select * from `auction` where auction_status='1' ";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
	$i = $i + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
		$edit = "<a href='auction_edit.php?id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\"></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"conf('$rs[id]')\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" alt=\"ลบ\">";
	$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
	
?>
                    <tr class="normal" bgcolor="<?=$bgcolor?>" onMouseOver='mOvr(this,"dbf2ae");' onMouseOut='mOut(this,"<?=$bgcolor?>");' >
                      <td align="center" height="20" class="normal_black"><?=$i?></td>
                      <td align="center" class="normal_blue" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=trimtxt($rs[depname], 25)?></td>
                      <td align="left" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=trimtxt($rs[detail], 25)?></td>
                      <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><div align="left">&nbsp;
                        <?=trimtxt($rs1[detail], 20) ?>                      
                      </div></td>
                      <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><!-- <a href="report_auction_pdf.php?sent_date="><img src="../../images/ico_tm_pdf.gif" width="16" height="16" border="0" alt="แสดงรายงาน pdf"></a>&nbsp; -->                      </td>
                      <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"></td>
                      <td align="center"><?=$stat?></td>
                      <td align="center"><?=$edit?></td>
                      <td align="center"><?=$del?></td>
                    </tr>
                    <?
}
?>
                  </table></td>
                </tr>
              </table>
            <?
  }
 elseif ($action =="auction_news") { 
 $sql = mysql_query("select count(*) as curr_auction_order from `auction` ") or die("Query line " . __LINE__ . " Error<hr>".mysql_error()); 
$rsx = mysql_fetch_assoc($sql);
$epage=$epage-$rsx[curr_auction_order];
 $sql = "select * from `auction` where   bid_status='1'";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = "#F9C77B";
	$ij= $ij + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
	$edit = "<a href='auction_edit.php?id=$rs[id]'\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไข\">></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"if(confirm('ท่านต้องการที่จะลบข้อมูล1 $rs[title] ใช่หรือไม่ ?')==true);return false;\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\">";
$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
?>

                
                      <?
	}  
	 $x=$ij-$rsx[curr_auction_order];
 $sql = "select * from `auction` where bid_status='1' ";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
	$i = $i + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
		$edit = "<a href='auction_edit.php?id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\"></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"conf('$rs[id]')\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" alt=\"ลบ\">";
	$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
	
?>
                    <tr class="normal" bgcolor="<?=$bgcolor?>" onMouseOver='mOvr(this,"dbf2ae");' onMouseOut='mOut(this,"<?=$bgcolor?>");' >
                        <td align="center" height="20" class="normal_black"><?=$i?></td>
                        <td align="center" class="normal_blue" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">
                            <?=trimtxt($rs[depname], 25)?></td>
                        <td align="left" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=trimtxt($rs[detail], 25)?></td>
                        <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=trimtxt($rs1[detail], 15) ?></td>
						 <td  align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=$rs[win_price]." "."บาท";?></td>
                <td  align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=$rs[win_office];?></td>
                 						<td align="center"><?=$stat?></td>
                        <td align="center"><?=$edit?></td>
                        <td align="center"><?=$del?></td>
                    </tr>
                      <?
}
?>
                  </table></td>
              </tr>
              </table>
            <?
 
 
 }
  elseif ($action =="auction_status_price") { 
 $sql = mysql_query("select count(*) as curr_auction_order from `auction` ") or die("Query line " . __LINE__ . " Error<hr>".mysql_error()); 
$rsx = mysql_fetch_assoc($sql);
$epage=$epage-$rsx[curr_auction_order];
$sql = "select * from `auction` ";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = "#F9C77B";
	$ij= $ij + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
	$edit = "<a href='auction_edit.php?id=$rs[id]'\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไข\">></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"if(confirm('ท่านต้องการที่จะลบข้อมูล1 $rs[title] ใช่หรือไม่ ?')==true);return false;\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\">";
$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
?>

                     
                      <?
	}  
	 $x=$ij-$rsx[curr_auction_order];
 $sql = "select * from `auction` ";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
	$i = $i + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
		$edit = "<a href='auction_edit.php?id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\"></a>";
	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\" onClick=\"conf('$rs[id]')\"><img src=\"../../images/b_drop.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" alt=\"ลบ\">";
	$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
	
?>
        <tr class="normal" bgcolor="<?=$bgcolor?>" onMouseOver='mOvr(this,"dbf2ae");' onMouseOut='mOut(this,"<?=$bgcolor?>");' >
                        <td align="center" height="20" class="normal_black"><?=$i?></td>
                        <td align="center" class="normal_blue" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">
                            <?=trimtxt($rs[depname], 25)?></td>
                        <td align="left" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"><?=trimtxt($rs[detail], 25)?></td>
                        <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">
						<? 
						$d=date('Y-m-d');
		if($rs[pur_close_d]>="$d"){
				$t1=date('H:i:s');
			if($rs[etime_close]<="$t1"){echo "<img  src=\"../../images/alarmclock_run.png\" border=\"o\" align=\"absmiddle\" alt=\"ยังไม่หมดเวลา\"  width=\"25\" hight=\"25\">";
		 }else{echo "<img src=\"../../images/alarmclock_stop.png\" border=\"0\" align=\"absmiddle\" alt=\"หมดเวลาเแล้ว\" width=\"25\" hight=\"25\">";} 
		// else
		  }else{echo "<img src=\"../../images/alarmclock_stop.png\" border=\"0\" align=\"absmiddle\" alt=\"หมดเวลาเแล้ว\" width=\"25\" hight=\"25\">";} 
		   // if d
		    // action
		?>      </td>
                                    <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">
                            <!-- <a href="report_auction_pdf.php?sent_date="><img src="../../images/ico_tm_pdf.gif" width="16" height="16" border="0" alt="แสดงรายงาน pdf"></a>&nbsp; -->                        </td>
                        <td align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"></td>
                        
						<td align="center"><?=$stat?></td>
                        <td align="center"><?=$edit?></td>
                        <td align="center"><?=$del?></td>
        </tr>
                      <?
}
?>
      </table></td>
  </tr>
</table>
            <?
 
 
 } 
  
  //End of normal 
// if action = null
// Start Sticky 
 else {

 $sql = mysql_query("select * from `auction` ") or die("Query line " . __LINE__ . " Error<hr>".mysql_error()); 
$rsx = mysql_fetch_assoc($sql);
 $sql = "select * from `auction` where auction_order=1 order by id, pur_doc_d1, stamp, depname desc ";	
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	
	$bgcolor = "#F9C77B";
	$ij= $ij + 1;
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
	
	$edit = "<a href='auction_edit.php?id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไข\"></a>";
	$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
	//$del="<img src=\"../../images/del.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" onclick=conf('$rs[id]')>";
/*	$del ="<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"  onClick=\"if(confirm('ท่านต้องการที่จะลบข้อมูล3 $rs[title] ใช่หรือไม่ ?')==true);return false;\"><img src=\"../../images/del.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\">";*/
?>
            <tr class="normal" bgcolor="<?=$bgcolor?>" onMouseOver='mOvr(this,"dbf2ae");' onMouseOut='mOut(this,"<?=$bgcolor?>");' >
               
</tr>
              <?
} 

// Normal
if ($page==1) {$x=$ij-$rsx[curr_auction_order]; } else { $x=$epage; }
$epage=$epage-$rsx[curr_auction_order];
 $sql = "select * from `auction` where auction_order!=1 order by id, pur_doc_d1, stamp, depname desc limit $x, $epage";	
//echo $sql;
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){	

	$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
	$x = $x + 1;
	
	$sql1 = mysql_query("select detail from `auction_type` where id = '$rs[type]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs1 = mysql_fetch_assoc($sql1);
	
	$edit = "<a href='auction_edit.php?id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/b_edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไข\"></a>";
	$stat="<a href='auction_chstat.php?id=$rs[id]' \"style=\"text-decoration:none\"><img src=\"../../images/hammer.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"เปลี่ยนสถานะ\"></a>";
/*	$del = "<a href='?action=del&id=$rs[id]'\"&page=$page\" style=\"text-decoration:none\"  onClick=\"if(confirm('ท่านต้องการที่จะลบข้อมูล4 $rs[title] ใช่หรือไม่ ?')==true);return false;\"><img src=\"../../images/del.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\">";*/
	
?>
              <tr class="normal" bgcolor="<?=$bgcolor?>" onMouseOver='mOvr(this,"dbf2ae");' onMouseOut='mOut(this,"<?=$bgcolor?>");' >
                <td align="center" height="20" class="normal_black"><?=$x?></td>
                <td class="normal_blue" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">&nbsp;
                    <?=trimtxt($rs[depname], 25)?></td>
                <td width="3%" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')" ><?=trimtxt($rs[detail], 25)?></td>
                <td width="8%" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">&nbsp;
                    <?=trimtxt($rs1[detail], 15); ?>
                </td>
                              
                <td width="2%" align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"></td>
                <td width="2%" align="center" onClick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"></td>
                
                <td width="1%" align="center"><!-- <a href="report_auction_pdf.php?sent_date=<?=$rs[pur_close_d]?>"><img src="../../images/ico_tm_pdf.gif" width="16" height="16" border="0" alt="แสดงรายงาน pdf"></a>&nbsp; -->
                    <?=$stat?>                </td>
                <td width="1%" align="center"><?=$edit?></td>
                <td width="1%" align="center"><img  src="../../images/b_drop.png" height="13" width="11" border="0" align="absmiddle" alt="ลบ" onClick=conf('<?=$rs[id]?>')></td>
              </tr>
              <?
}
mysql_free_result($result);
?>
      </table></td>
    </tr> 
</table>
<? } }//End of normal ?>
<!-- ---------------------End Main Body	--------------------------- -->	</td>
  </tr>
  	<tr>
  	  <td colspan="2" align="center"  valign="bottom">
<!-- --------------------Devide Page Section---------------------------------- -->
<? 
if($all >= 1) { 
//Keyword that you want to send to other page 
if($keyword == ""){ $kwd = ""; }else{ $kwd = "&keyword=".$keyword."&topic=".$topic ; }
?>
<table width="80%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td width="46%" valign="top" class="normal">
	<div align="left">&nbsp;
<?
$page_all = $all / 11 ;
$page_all = ceil($page_all);
//first Eleven Page
if($page <= 11){

	$max = $page;
	if($page <= 11 ){ 	
		if($all <= 11){ $max = $all ; }else{ $max = 11 ; }
		for($i=1;$i<=$max;$i++) 
		{
			if($i != $page){ echo "<a href=\"$PHP_SELF?page=$i$kwd\" style=\"text-decoration:none\"><font class=\"normal\">$i</font></a>&nbsp;";  } else { echo "<font class=\"blue\">$i</font>&nbsp;";  }
		}
		if($all > 11){ 	echo "<a href=\"$PHP_SELF?page=12$kwd\" style=\"text-decoration:none\"><font class=\"blue\">Next ></font></a>&nbsp;"; }
	}
	
} elseif($page >= 12) {

	$min = $page - 5;		
	$max = $page + 5;
	if($max >= $all){ $max = $all; $last_page = "y";} 
	$next = $max + 1; 
	$prev = $min - 1;	

	echo "<a href=\"$PHP_SELF?page=$prev$kwd\" style=\"text-decoration:none\"><font class=\"blue\">< Prev</font></a>&nbsp;";
	for($i=$min;$i<=$max;$i++) 
	{
		if($i != $page){ echo "<a href=\"$PHP_SELF?page=$i$kwd\" style=\"text-decoration:none\"><font class=\"normal\">$i</font></a>&nbsp;";  }
		else { echo "<font class=\"blue\">$i</font>&nbsp;";  }
	}
	if($last_page != "y"){
	echo "&nbsp;<a href=\"$PHP_SELF?page=$next$kwd\" style=\"text-decoration:none\"><font class=\"blue\">Next ></font></a>";
	}
}

?>                  
	</div>	</td>
	<td width="24%" valign="top" class="normal"><div align="right">All Record : <font class="blue"><?=$totalpage?></font> Records</div></td>
	<td width="30%" valign="top" class="normal"><div align="right">Number of all page is :&nbsp;<font class="blue"><?=$all?></font>&nbsp;Pages&nbsp;</div></td>
	</tr>
</table>
<? } ?>
<!-- -------------- End Devide Page Section ----------------------- -->	  </td>
	</tr>
</table>

</td></tr>
</table>
</td></tr>
</table>
	</div>
	</td>
</tr>
</table>
</body>
</html>

Anon7 - 2021