| Server IP : 172.67.187.206 / Your IP : 162.159.115.41 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/move/ |
Upload File : |
<?php include("header.php");
$id = $mysqli->escape_string($_GET['id']);
if(!isset($_SESSION['username'])){
}else{
$username1 = $_SESSION['username'];
$user1 = $mysqli->query("SELECT * FROM users WHERE username='$username1' LIMIT 1");
$userrow1 = mysqli_fetch_array($user1);
}
$catname = $mysqli->query("SELECT c_name FROM categories WHERE id='$id'");
$getcatname = mysqli_fetch_array($catname)
?>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:25px;
top:10px;
width:100px;
height:99px;
z-index:1;
}
-->
</style>
<?php
// Create the function, so you can use it
function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
// If the user is on a mobile device, redirect them
if(isMobile()) {} else {
echo "<div id='Layer1'><a href='index.html'><img src='images/logo.png'></a> </div>";
}
?>
<?php include("right_all.php");?>
<div class="other-box">
<div class="title">
<h3>::ข่าวกิจกรรม:: <?php echo $getcatname['c_name'];?> </h3>
</div><!--title-->
<?php
error_reporting(E_ALL ^ E_NOTICE);
// How many adjacent pages should be shown on each side?
$adjacents = 5;
$query = $mysqli->query("select COUNT(*) as num FROM posts WHERE active=1 and cat_id='$id' ORDER BY id DESC");
$total_pages = mysqli_fetch_array($query);
$total_pages = $total_pages['num'];
$limit = 10; //how many items to show per page
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
$result = $mysqli->query("SELECT * FROM posts WHERE active=1 and cat_id='$id' ORDER BY id DESC LIMIT $start, $limit");
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"category-$id-$prev.html\">« previous</a>";
else
$pagination.= "<span class=\"disabled\">« previous</span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"category-$id-$counter.html\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"category-$id-$counter.html\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"category-$id-$lpm1.html\">$lpm1</a>";
$pagination.= "<a href=\"category-$id-$lastpage.html\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"category-$id-1.html\">1</a>";
$pagination.= "<a href=\"category-$id-2.html\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"category-$id-$counter.html\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"category-$id-$lpm1.html\">$lpm1</a>";
$pagination.= "<a href=\"category-$id-$lastpage.html\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"category-$id-1.html\">1</a>";
$pagination.= "<a href=\"category-$id-2.html\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"category-$id-$counter.html\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"category-$id-$next.html\">next »</a>";
else
$pagination.= "<span class=\"disabled\">next »</span>";
$pagination.= "</div>\n";
}
$q = $mysqli->query("SELECT * FROM posts WHERE active=1 and cat_id='$id' ORDER BY id DESC limit $start,$limit");
$numr = mysqli_num_rows($q);
if ($numr==0)
{
echo '<div class="msg"><font color="red">ไม่พบข้อมูล!!</font></div>';
}
while($row=mysqli_fetch_assoc($q)){
$description = stripslashes($row['description']);
$desc = strlen ($description);
if ($desc > 140) {
$sdec = substr($description,0,500).'..';
}else{
$sdec = $description;}
?>
<div class="story">
<div class="small-thumb">
<?php
if ($row['id'] > 4430){
?>
<img src="timthumb.php?src=uploads/<?php echo $row['image'];?>&h=90&w=120&q=100" alt="<?php echo $row['title'];?>" align="absmiddle">
<?php }else{ ?>
<img src="timthumb.php?src=<?php echo $row['image'];?>&h=90&w=120&q=100" alt="<?php echo $row['title'];?>" align="absmiddle">
<?php } ?>
</div><!--smcategory-$id-thumb-->
<h2><a href="story-<?php echo $row['id'];?>.html"><?php echo stripslashes($row['title']);?></a></h2>
<p><?php echo strip_tags($sdec);?></p>
<?php
$userid = $row['uid'];
$user = $mysqli->query("SELECT * FROM users WHERE id='$userid' LIMIT 1");
$userrow = mysqli_fetch_array($user);
?>
<?php if(!isset($_SESSION['username'])){?>
<?php }elseif
($userrow['id']=="$userrow1[id]") {
?>
<div align="right">
<a href="edit_news.php?id=<?php echo $row['id'];?>">แก้ไข</a>
<a class="red-button" href="delete_news.php?id=<?php echo $row['id'];?>">ลบ</a>
</div>
<?php } ?>
<div class="look-up-story">
<p>เขียนโดย : <a href="category-<?php echo $row['cat_id'];?>-1.html"><?php echo $userrow['school'];?></a> เปิดอ่าน<?php echo $row['views'];?> ครั้ง เขียนเมื่อ<?php echo $row['date'];?></p>
</div><!--look-up-->
</div><!--story-->
<?php }?>
<center>นำ code ไปติดเว็บ <br><font color="#FF9900">ปรับปรุงใหม่เพื่อให้แต่ละโรงเรียนสามารถปรับแต่งเองได้</font><br>
<a href="<?php echo $code_url;?>feed.php?school=<?php echo $id;?>" target="_blank"><img src="images/rss.png" alt="RSS" width="40" height="40" border="0" /></a>
<textarea name="textarea" cols="80" rows="1"><iframe src="<?php echo $code_url;?>news.php?school=<?php echo $id;?>&limit=4" scrolling="no" frameborder="0" width="550" height="500"></iframe></textarea> <a target="_blank" href="<?php echo $code_url;?>news.php?school=<?php echo $id;?>&limit=4" scrolling="no" frameborder="0" width="550" height="500"">ตัวอย่าง</a><br>
<textarea name="textarea" cols="80" rows="2"><iframe src="<?php echo $code_url;?>news_front.php?school=<?php echo $id;?>&limit=6&thum_width=180&thum_hight=120&col=3" scrolling="no" frameborder="0" width="100%" height="395"></iframe></textarea><a target="_blank" href="<?php echo $code_url;?>news_front.php?school=<?php echo $id;?>&limit=6&thum_width=180&thum_hight=120&col=3">ตัวอย่าง</a><br><br><br><img src="images/cco.png">
</center>
<div class="id"><?php echo $pagination;?></div>
</div><!--news-box-->
<?php include("footer.php"); ?>