| Server IP : 104.21.80.248 / Your IP : 172.71.28.156 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/group/ |
Upload File : |
<?php include("header.php");
//$id = $mysqli->escape_string($_GET['id']);
$uid = $mysqli->escape_string($_GET['uid']);
$catname = $mysqli->query("SELECT * FROM categories WHERE id='$uid'");
$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
if ($uid<=26) {
echo "โรงเรียนในจังหวัดราชบุรี";
} else { echo "โรงเรียนในจังหวัดกาญจนบุรี";}
?> </h3>
</div><!--title-->
<?php
error_reporting(E_ALL ^ E_NOTICE);
// How many adjacent pages should be shown on each side?
$adjacents = 5;
if ($uid<=26) {
$query = $mysqli->query("select COUNT(*) as num FROM posts WHERE active=1 and uid<=26 or uid BETWEEN '56' AND '65' ORDER BY id DESC");
} else {
$query = $mysqli->query("select COUNT(*) as num FROM posts WHERE active=1 and uid BETWEEN '27' AND '55' 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. */
if ($uid<=26) {
$result = $mysqli->query("SELECT * FROM posts WHERE active=1 and uid<=26 or uid BETWEEN '56' AND '65' ORDER BY id DESC LIMIT $start, $limit");
} else {
$result = $mysqli->query("SELECT * FROM posts WHERE active=1 and uid BETWEEN '27' AND '55' 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=\"section.php?uid=$uid&page=$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=\"section.php?uid=$uid&page=$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=\"section.php?uid=$uid&page=$counter.html\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"section.php?uid=$uid-$lpm1.html\">$lpm1</a>";
$pagination.= "<a href=\"section.php?uid=$uid-$lastpage.html\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"category-$uid-1.html\">1</a>";
$pagination.= "<a href=\"category-$uid-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&page=$counter.html\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"category-$uid&page=$lpm1.html\">$lpm1</a>";
$pagination.= "<a href=\"category-$uid&page=$lastpage.html\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"category-$uid-1.html\">1</a>";
$pagination.= "<a href=\"category-$uid-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=\"section.php?uid=$uid&page=$counter.html\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"section.php?uid=$uid&page=$next.html\">next »</a>";
else
$pagination.= "<span class=\"disabled\">next »</span>";
$pagination.= "</div>\n";
}
if ($uid<=26) {
$q = $mysqli->query("SELECT * FROM posts WHERE active=1 and uid<=26 or uid BETWEEN '56' AND '65' ORDER BY id DESC limit $start,$limit");
} else {
$q = $mysqli->query("SELECT * FROM posts WHERE active=1 and uid BETWEEN '27' AND '55' ORDER BY id DESC limit $start,$limit");
}
$numr = mysqli_num_rows($q);
if ($numr==0)
{
echo '<div class="msg">ไม่พบข้อมูล!!</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 /*
$today2=date("dmY");
$oldday=substr($row['image'], 0, 8);
if ($today2>=$oldday){
*/ ?>
<?php
if ($row['id'] > 4430){
?>
<img src="uploads/<?php echo $row['image'];?>" height="90" width="120" alt="<?php echo $row['title'];?>" align="absmiddle">
<?php }else{ ?>
<img src="<?php echo $row['image'];?>" height="90" width="120" 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>
<br>
<a href="<?php echo $code_url;?>feed.php?school=<?php echo $id;?>" target="_blank"></a>
</center>
<div class="id"><?php echo $pagination;?></div>
</div><!--news-box-->
<?php include("footer.php"); ?>