MINI MINI MANI MO
<?
session_start();
if($_SESSION["lang"] == "") $_SESSION["lang"] = "th" ;
date_default_timezone_set('Asia/Bangkok');
if( isset($_GET['did']) ){
include 'connectdb.php';
$mysqli = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$mysqli->set_charset("utf8");
if (mysqli_connect_errno()) echo $conn->connect_error;
// จังหวะที่จะ delete
$id = $_GET['did'];
$sql = " DELETE FROM webboard WHERE QuestionID ='".$_GET['did']."' ";
// var_dump($sql); die();
$query1 = $mysqli->query($sql);
if ($query1){
echo "<script>alert('Post Deleted')</script>";
echo '<script> window.history.back()</script> ';
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<meta name="author" content="" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<!-- Stylesheets
============================================= -->
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,600,700|Montserrat:400,700|Crete+Round:400italic" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Kanit" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/swiper.css" type="text/css" />
<!-- Medical Demo Specific Stylesheet -->
<link rel="stylesheet" href="css/medical.css" type="text/css" />
<link rel="stylesheet" href="css/dark.css" type="text/css" />
<link rel="stylesheet" href="css/font-icons.css" type="text/css" />
<link rel="stylesheet" href="css/medical-icons.css" type="text/css" />
<link rel="stylesheet" href="css/animate.css" type="text/css" />
<link rel="stylesheet" href="css/magnific-popup.css" type="text/css" />
<link rel="stylesheet" href="css/fonts.css" type="text/css" />
<!-- components CSS -->
<link rel="stylesheet" href="css/components/datepicker.css" type="text/css" />
<link rel="stylesheet" href="css/components/timepicker.css" type="text/css" />
<link rel="stylesheet" href="css/components/daterangepicker.css" type="text/css" />
<link rel="stylesheet" href="css/components/bs-filestyle.css" type="text/css" />
<link rel="stylesheet" href="css/responsive.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<? include "include/titledata.php"; ?>
<link rel="stylesheet" href="css/colors.php?color=168c48" type="text/css" />
<title>Vibharam Hospital :: Post to Webboard</title>
<style>
.form-control.error { border: 2px solid red; }
#primary-menu ul li#appoint > a { color:#FFF!important; font-weight: 600; }
.white-section label {
display: block; margin-bottom: 15px;
}
.white-section select {
width:100%!important;
}
.white-section pre { margin-top: 15px; }
</style>
</head>
<body class="stretched">
<!-- Document Wrapper
============================================= -->
<div id="wrapper" class="clearfix">
<? include "header.php"; ?>
<!-- Page Title
============================================= -->
<section id="page-title">
<div class="container clearfix">
<ol class="breadcrumb">
<li><a href="index.php">Home</a></li>
<li>Web Board</li>
</ol>
</div>
</section><!-- #page-title end -->
<!-- Content
============================================= -->
<section id="content" class=" nomargin nopadding" >
<div class="content-wrap">
<div class="container clearfix " >
<div class="row padding20">
<div class=" bg-danger bottommargin-sm">
<div class="col-md-8">
<div class="heading-block">
<h2> <i class="icon fa fa-bell"></i> Web Board</h2>
</div>
<?php if ($_SESSION["lang"] == "th"){ ?>
<div class="alert-text">สอบถามปัญหาหรือคำถามทั่วไปได้ที่นี่ งดใช้คำหยาบคาย</div>
</div>
<div class="col-md-4 text-right">
<a href="webboard-post.php">
<button class="button button-rounded button-brown topmargin-10 fright" type="submit" value="submit">
ตั้งกระทู้ใหม่ <i class="close-icon fa fa-edit"></i> </button></a>
</div>
<?php }else{ ?>
</div>
<div class="col-md-4 text-right">
<a href="webboard-post.php">
<button class="button button-rounded button-brown topmargin-10 fright" type="submit" value="submit">
New Post <i class="close-icon fa fa-edit"></i> </button></a>
</div>
<?php } ?>
</div>
<div class="clearfix"></div> <hr>
<div class="table-container padding20 topmargin-sm">
<table class="table table_secondary table-type-2 table-striped typography-last-elem">
<thead>
<tr bgcolor="#cccccc" height="44">
<?php if ($_SESSION["lang"] == "th"){ ?>
<th>ลำดับ</th>
<th width="55%">หัวข้อกระทู้ </th>
<th>อ่าน </th>
<th>ตอบ</th>
<th>วันที่ : เวลา</th>
<?php }else{ ?>
<th>No.</th>
<th width="55%">Topic </th>
<th>Read </th>
<th>Answer</th>
<th>Date : Time</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
include 'connectdb.php';
date_default_timezone_set('Asia/Bangkok');
$mysqli = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$mysqli->set_charset("utf8");
if (mysqli_connect_errno()) echo $mysqli->connect_error;
$strSQL = "SELECT * FROM webboard ";
$objQuery = $mysqli->query($strSQL) ;
$Num_Rows = mysqli_num_rows($objQuery);
$Per_Page = 5; // Per Page
error_reporting( error_reporting() & ~E_NOTICE );
$Page = $_REQUEST["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page";
$objQuery = mysqli_query($mysqli,$strSQL);
?>
<?php
while($objResult = mysqli_fetch_array($objQuery))
{
?>
<tr>
<td><?php echo $objResult["QuestionID"];?></td>
<td>
<a href="webboard-view.php?QuestionID=<?php echo $objResult["QuestionID"];?>"><?php echo $objResult["Question"];?></a>
<?php if (isset($_SESSION["admin_id"])) { ?>
<a href='<?php $_SERVER['PHP_SELF'] ?>?did=<?php echo $objResult["QuestionID"];?>' onclick="return confirm('ยืนยันการลบข้อมูล?')" >
<button style="float: right;" class="btn btn-icon btn-danger" title="ลบข้อมูล">Delete Post <i class="fa fa-remove"></i></button>
</a>
<?php } ?>
</td>
<td><?php echo $objResult["View"];?></td>
<td><?php echo $objResult["Reply"];?></td>
<td> <?php echo date("d-m-Y ",strtotime($objResult["CreateDate"]));?> | <?php echo date("H:i:s ",strtotime($objResult["CreateDate"]));?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="clearfix"></div>
<div class="center-block text-center">
<ul class="pagination text-center" style="margin:0 auto;">
<?php
if($Prev_Page)
{
echo "<li><a class='page-link border-b_prim' href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page' aria-label='Previous'><span aria-hidden='true'>«</span></a></li>";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "<li><a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a></li>";
}
else
{
echo "<li class='active'><a> $i </a></li>";
}
}
if($Page!=$Num_Pages)
{
echo "<li><a class='page-link border-b_prim' href='$_SERVER[SCRIPT_NAME]?Page=$Next_Page' aria-label='Next'><span aria-hidden='true'>»</span></a></li>";
}
?>
</ul>
</div>
</div>
</div>
</div>
</section> <!-- #content end -->
<? include "footer.php"; ?>
</body>
</html>
OHA YOOOO