|
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/information/ |
Upload File : |
<?php
session_start() ;
include("../../config/config.inc.php");
include("../../libary/function.php");
?>
<!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=windows-874" />
<link href="../../libary/style.css" rel="stylesheet" type="text/css">
<title>ข่าวประชาสัมพันธ์</title>
<style>
body{
font-family:Tahoma, sans-serif, Arial;
font-size: 12px;
margin: 0 0;
padding:0 0;
background-color:#EEEEEE;
}
.normal_blue {
font-size: 12px;
color:#006699;
}
.normal{
font-size: 12px;
}
.input{
background-color:#FFFFFF;
color:#666666;
border:#CCCCCC solid 1px;
}
.blue{
color:#0280D5;
font-size:12px;
}
.orange{
color:#FF6600;
font-size:12px;
}
.mwarn,warn:link{
color:#cc3300;
font-size:12px;
text-decoration:none;
}
.warn:visited{
color:#cc3300;
font-size:12px;
text-decoration:none;
}
.style_white:visited {
font-size:12px;
color:#FFFFFF;
font-weight:bold;
}
.style_white:hover {
font-size:12px;
color:#FFCC00;
font-weight:bold;
}
#page{
font-size:12px;
}
#page a:link{
color:#999999;
text-decoration:none;
}
#page a:visited{
color:#999999;
text-decoration:none;
}
</style>
<?php
if($action == "view") {
$n = 0;
$sql = mysql_query("select location from `news_pic` where nid = '$id' ")or die("Query Line " . __LINE__ . " Error <hr>".mysql_error());
$pnum = mysql_num_rows($sql);
if($pnum >= 2){
$onload = "onLoad=\"runSlideShow()\"";
echo "<script language=\"JavaScript\">";
echo "var slideShowSpeed = 4000;";
echo "var crossFadeDuration = 1;";
echo "var Pic = new Array();";
while($rs = mysql_fetch_array($sql, MYSQL_ASSOC)){
$image = "../../images/news/".$rs['location'];
echo "Pic[$n] = '$image'; ";
$n = $n + 1;
}
mysql_free_result($sql);
echo "var t;";
echo "var j = 0;";
echo "var p = Pic.length;";
echo "var preLoad = new Array();";
echo "for (i = 0; i < p; i++) {";
echo "preLoad[i] = new Image();";
echo "preLoad[i].src = Pic[i];";
echo "}";
echo "function runSlideShow() {";
echo "if (document.all) {";
echo "document.images.SlideShow.style.filter=\"blendTrans(duration=2)\";";
echo "document.images.SlideShow.style.filter=\"blendTrans(duration=crossFadeDuration)\";";
echo "document.images.SlideShow.filters.blendTrans.Apply();";
echo "}";
echo "document.images.SlideShow.src = preLoad[j].src;";
echo "if (document.all) {";
echo "document.images.SlideShow.filters.blendTrans.Play();";
echo "}";
echo "j = j + 1;";
echo "if (j > (p - 1)) j = 0;";
echo "t = setTimeout('runSlideShow()', slideShowSpeed);";
echo "}";
echo "</script>";
} elseif($pnum == 1){
while($rs = mysql_fetch_assoc($sql)){
$image = "../../images/news/".$rs[location];
}
} else {
$nopic = "y";
}
}
?>
</head>
<body <?=$onload?>>
<?php
//include("header.php");
//include ("menu_bar.php");
?>
<br /><br />
<?php
if($action == "view") {
$sql_view = mysql_db_query($dbname,"select * from `news` where id = '$id'")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$rs = mysql_fetch_assoc($sql_view);
$xsql = mysql_query("select MAX(pid) as pid, location from `news_pic` where nid = '$rs[id]' group by nid")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$xrs = mysql_fetch_assoc($xsql);
$sql1 = mysql_query("select name from `user` where user = '$rs[author]' ")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$rs1 = mysql_fetch_assoc($sql1);
$stamp = explode(" ",$rs[stamp]);
$detail = ereg_replace ( chr(13) , "<br>", $rs[detail]);
$img = "<a href=\"news_pic.php?id=".$rs[id]."&page=$page&pid=1\" style=\"text-decoration:none\"><img src=\"../../images/cam.gif\" border=\"0\"> <font class=\"normal_blue\">จัดการข้อมูลภาพข่าว</font></a>";
?>
<table width="652" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<tr><td>
<table width="800" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0" class="normal">
<tr bgcolor="#f8f8f8">
<td colspan="2" height="20" class="normal_blue"> <img src="../../images/page.gif" width="18" height="18" border="0" align="absmiddle"><?=$rs[topic]?></td>
</tr>
<?
if($nopic != "y"){
?>
<tr valign="bottom" align="center">
<td colspan="2"><br><?=frameimg("<img src=\"".$image."\" name=\"SlideShow\" border=\"0\">")?><br></td>
</tr>
<? } ?>
<tr>
<td colspan="2">
<b class="blue"> <?=$rs[topic]?></b><ul><?=$detail?></ul>
<? if(file_exists($rs[attach])){ echo "<div align=\"left\"> <a href=\"$rs[attach]\" style=\"text-decoration:none;\"><font class=\"blue\">Download เอกสาร</font></a></div>"; } ?>
<div align="right"><?="เมื่อวันที่ ".daythai($stamp[0])."<br>เวลา ".fulltime($stamp[1])?></div>
</td>
</tr>
<tr>
<td width="200" height="22" align="right" class="blue">จัดทำข้อมูลนี้โดย <b class="normal_black">:</b> </td>
<td width="450" class="warn"> <?=$rs[author]." <font class=\"normal_black\"></font>"?></td>
</tr>
<tr>
<td colspan="2" height="20" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="center"><hr color="#eeeeee"><input name="reset" type="reset" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page."&type=".$rs[type]?>');" value="กลับหน้าหลัก"></td>
</tr>
</table>
</td></tr>
</table>
<?php
}else{
?>
<?php
$page=$_GET['page'];
if(empty($page)){
$page=1;
}
$sql="select count(topic) from news where type=1";
$query=mysql_query($sql);
list($all_row)=mysql_fetch_row($query);
$per_page=20;
$total_page=ceil($all_row/$per_page);
$pre_page=$page-1;
$next_page=$page+1;
$prev = "self.location='".$PHP_SELF."?type=1&page=$pre_page'";
$next = "self.location='".$PHP_SELF."?type=1&page=$next_page'";
$prevTen = "self.location='".$PHP_SELF."?type=1&page=1'";
$nextTen = "self.location='".$PHP_SELF."?type=1&page=$total_page'";
?>
<!--<table width="99%" border="0" align="center" cellpadding="1" id="page" cellspacing="0">
<tr>
<td align="right"> </td>
<td align="right" valign="middle"> </td>
</tr>
<tr>
<td width="58%" align="right"><? if($View==''){?>
<? if($page==1){?>
<img src="../../images/page_div_icon/xFirst.gif" />
<? }else{?>
<img src="../../images/page_div_icon/First.gif" align="absmiddle" border="0" width="10" height="12" onclick="<?=$prevTen;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==1){?>
<img src="../../images/page_div_icon/xPrevious.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Previous.gif" align="absmiddle" border="0" width="7" height="12" onclick="<?=$prev;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<?php
$board_link_num = $per_page;
$ii = 1;
if ( $board_link_num > $total_page ){
$loop_page = $total_page;
} else {
$bx = $board_link_num / 2;
$pp = $page - $bx;
$pn = $page + $bx;
$loop_page = $pn;
$ii = $pp;
if ( $total_page <= $loop_page ) {
$loop_page = $total_page;
$ii = $loop_page - ($board_link_num -1);
}
if ( $ii < 1 ) {
$ii = 1;
$loop_page = $ii + ($board_link_num -1);
}
}
for($i=$ii;$i<=$loop_page;$i++){
if ( $i==$page || !$page ) {
$txt = "<font color=\"E80000\"><b>$i</b></font>";
} else {
$txt = $i;
}
?>
<a href="<?=$PHP_SELF;?>?type=1&page=<?=$i;?>">
<?=$txt;?>
</a>
<?
} # for
?>
<? if($page==$loop_page){?>
<img src="../../images/page_div_icon/xNext.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Next.gif" align="absmiddle" border="0" width="7" height="12" onClick="<?=$next;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==$loop_page){?>
<img src="../../images/page_div_icon/xLast.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Last.gif" align="absmiddle" border="0" width="10" height="12" onClick="<?=$nextTen;?>" onMouseOver="style.cursor='hand';"/>
<? } }#End View=?></td>
<? if($View==""){$Klink="?View=All"; $CSh="ข้อมูลทั้งหมด"; $Klink2="?View=";}else{$Klink="?View=";$CSh="ข้อมูล 10 รายการล่าสุด";$Klink2="?View=All";}?>
<td width="42%" align="right" valign="middle"> ทั้งหมด <b> <font color="#CC0000">
<?=number_format($all_row);?>
</font> </b> รายการ
<? if($View !='All'){?>
แบ่งเป็น <b><font color="#0033CC">
<?=number_format($total_page);?>
</font></b> หน้า
<? }?></td>
</tr>
</table>-->
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="3" style="border-collapse:collapse;">
<thead>
<tr bgcolor="#466a8e" class="normal_blue" style="color:#FFFFFF">
<th width="10%" style="border:#999999 solid 1px;border-collapse:collapse;">ลำดับ</th>
<th align="left" width="90%" style="border:#999999 solid 1px;border-collapse:collapse;"> เรื่อง</th>
</tr>
</thead>
<?
$begin=$page-1;
$i=($page-1)*$per_page;
//$sql = "select * from `news` where type='1' order by id desc limit $begin,$per_page";
$sql = "select * from `news` where type='1' order by id desc ";
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){
$i = $i + 1;
$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
$edit = "<a href=\"?action=edit&id=".$rs[id]."&page=$page$kwd\" style=\"text-decoration:none\"><img src=\"../../images/edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไขข้อมูลข่าว\"></a>";
$del = "<a href=\"?action=del&id=".$rs[id]."&page=$page$kwd\" style=\"text-decoration:none\" onClick=\"return confirm('ท่านต้องการที่จะลบข้อมูล ".trimtxt($rs[topic], 65)." ใช่หรือไม่ ?')\"><img src=\"../../images/del.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" alt=\"ลบข้อมูลข่าว\">";
$img = "<a href=\"news_pic.php?id=".$rs[id]."&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/cam.gif\" border=\"0\" alt=\"แก้ไขข้อมูลภาพข่าว\"></a>";
$attach = chkattach($rs[attach]);
$xsql = mysql_query("select detail as type from `news_type` where id = '$rs[type]'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$xrs = mysql_fetch_assoc($xsql);
?>
<tr class="normal" bgcolor="<?=$bgcolor?>" onmouseover='mOvr(this,"dbf2ae");' onmouseout='mOut(this,"<?=$bgcolor?>");'>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$i."."?></td>
<td class="normal_blue" style="border:#999999 solid 1px;border-collapse:collapse;" onClick="window.location.replace('public2.php?action=view&id=<?=$rs[id]?>&page=<?=$page?>')"> <?=$attach.trimtxt($rs[topic],999 )?></td>
</tr>
<?
}
mysql_free_result($result);
?>
</table>
</td>
</tr>
</table>
<?php } ?>
</body>
</html>