<?php session_start(); if(isset($_SESSION['Admin']) && !$_SESSION["Admin"]){ header("location: index.php"); } include("inc/config.php"); include_once('function.php'); $order = $_GET["order"]; $sort = $_GET["sort"]; if(!isset($order) || $order == ""){ $order = "id"; } if(!isset($sort) || $sort == "") $sort = "desc"; else if($sort == "desc") $sort = "asc"; else $sort = "desc"; if(!isset($_GET["type"])) $type = "news"; else $type = $_GET["type"]; switch($type){ case "news": $typeName = "ข่าวประชาสัมพันธ์"; break; case "announce": $typeName = "ประกาศ/คำสั่ง"; break; case "activity": $typeName = "กิจกรรม"; break; case "procure": $typeName = "จัดซื้อจัดจ้าง"; break; case "article": $typeName = "วิชาการ"; break; case "research": $typeName = "วิจัย"; break; case "source": $typeName = "แหล่งข้อมูลด้านการวิจัย"; break; case "poll": $typeName = "แบบสำรวจออนไลน์"; break; } ?> <!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> <title> - CMS</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" type="text/css" href="../css/pagination.css" /> <link rel="stylesheet" type="text/css" href="../css/grey.css" /> <script language="javascript"> function visibleconf(){ var s = ""; for (var i=0; i<visibleconf.arguments.length; i++){ s = s + "&" + visibleconf.arguments[i]; } if (confirm("คุณต้องการที่จะเปลี่ยนหรือไม่?")) self.location="news_visible.php?act=visibleconf"+s; } function delconf(){ var s = ""; for (var i=0; i<delconf.arguments.length; i++){ s = s + "&" + delconf.arguments[i]; } if (confirm("คุณต้องการที่จะลบหรือไม่?")) self.location="news_del.php?act=delconf"+s; } </script> </head> <body> <?php include ("inc/head.php"); ?> <table width="99%" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="250" valign="top"><?php include ("menu.php"); ?></td> <td width="1" bgcolor="#000000"><img src="images/spacer.gif" /></td> <td width="15"><img src="images/spacer.gif" /></td> <td valign="top"><br /> <table cellpadding="2" cellspacing="2"> <tr> <td colspan="2"><b><?php echo $typeName; ?></b></td> </tr> <tr> <td colspan="2"><img src="images/spacer.gif" /></td> </tr> <tr> <td width="25"><a href="news_add.php?type=<?php echo $type; ?>"><img src="images/button_add.gif" width="25" height="25" alt="Add" /></a></td> <td><a href="news_add.php?type=<?php echo $type; ?>">เพิ่ม</a></td> </tr> </table> <table width="100%" cellpadding="5" cellspacing="2"> <tr bgcolor="#E4E4E4"> <?php if($type == "news"){ ?><td width="20%"><b>รูปภาพ</b></td><?php } ?> <td><b><a href="news.php?type=<?php echo $type; ?>&order=id&sort=<?php echo $sort; ?>">หัวข้อเรื่อง</a></b></td> <td width="14%" align="center"><b>แสดง/ไม่แสดง</b></td> <td width="5%" align="center"><b>แก้ไข</b></td> <td width="5%" align="center"><b>ลบ</b></td> </tr> <?php $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]); $limit = 10; $startpoint = ($page * $limit) - $limit; //to make pagination $statement = "news where type='$type' order by $order $sort"; $sql = "select * from $statement LIMIT $startpoint, $limit"; $result = mysql_query($sql) or die(mysql_error()); $i = 1; while($row = mysql_fetch_array($result)){ if ($i == 1) echo "<tr bgcolor='#FFFFFF'>"; else echo "<tr bgcolor='#F8F8F8'>"; ?> <?php if($type == "news"){ ?><td><?php if($row["photo"] != ""){?><img src="get_image.php?file=download\news\photo\<?php echo $row["photo"]; ?>&w=120&h=120"><?php } ?></td><?php } ?> <td><?php echo $row["subject"]; ?></td> <td align="center"><a href="javascript:visibleconf('id=<?php echo $row["id"]; ?>&visible=<?php echo $row["visible"]; ?>&type=<?php echo $type; ?>')"><?php if ($row["visible"] == "Y"){ ?><img src="images/iconvisible.gif" width="14" height="14" alt="Visible" /><?php } else{ ?><img src="images/iconinvisible.gif" width="14" height="14" alt="Invisible" /><?php } ?></a></td> <td align="center"><a href="news_edit.php?id=<?php echo $row["id"]; ?>&type=<?php echo $type; ?>"><img src="images/iconeditpencil.gif" width="14" height="14" alt="Edit" /></a></td> <td align="center"><a href="javascript:delconf('id=<?php echo $row["id"]; ?>&photo=<?php echo $row["photo"]; ?>&file=<?php echo $row["file"]; ?>&file2=<?php echo $row["file2"]; ?>&file3=<?php echo $row["file3"]; ?>&file4=<?php echo $row["file4"]; ?>&file5=<?php echo $row["file5"]; ?>&type=<?php echo $type; ?>')"><img src="images/icontrash.gif" width="14" height="14" alt="Delete" /></a></td> </tr> <?php $i++; if($i == 3) $i = 1; } ?> </table> <br><div align="center"><?php echo pagination($statement,$limit,$page); ?></div><br /><br /> </td> </tr> </table> </body> </html> <?php mysql_close(); ?>
Quote:แต่พอกดไปหน้าที่ 2 มันดันไป เป็นหน้าที่ 2 ของ case news อะครับ ช่วยดูให้หน่อยนะครับ
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง