Viewing file: contact.php (10.2 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'contact.php';
$Row = "SELECT * FROM contactus"; $RowQuery = mysqli_query($con,$Row) or die ("Error Query [".$Row."]"); $Num_Rows = mysqli_num_rows($RowQuery); $Per_page = 100; // Per page $page = $_GET["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; } $i=$page_Start+1;
$contactus_SL = " SELECT * FROM contactus ORDER BY contactus_id DESC LIMIT $page_Start , $Per_page "; $contactus_RS = mysqli_query($con,$contactus_SL); $contactus_Row = mysqli_num_rows($contactus_RS);
if ($_POST['Updatefixed_graphicmap']) { if($_FILES['fixed_graphicmap']['name']!=''){ @unlink("../Files/fixed_graphicmap/".$fixed['fixed_graphicmap']); $fixed_graphicmap = rand().$_FILES["fixed_graphicmap"]["name"]; $upload = move_uploaded_file($_FILES["fixed_graphicmap"]["tmp_name"],"../Files/fixed_graphicmap/".$fixed_graphicmap); $fixed_graphicmap_Update = "UPDATE `fixed` SET `fixed_graphicmap` = '$fixed_graphicmap'"; $fixed_graphicmap_Reult = mysqli_query($con,$fixed_graphicmap_Update); } if ($fixed_graphicmap_Reult) { echo"<script>alert('แก้ไขเรียบร้อยแล้ว'); window.location='contact.php?UPDATE';</script>"; } else { echo"<script>alert('fixed_Reult'); window.history.back(); </script>"; } }
if ($_POST['update_fixed_googlemaps']) { $fixed_googlemaps = $_POST['fixed_googlemaps']; $fixed_Up = "UPDATE fixed SET fixed_googlemaps = '$fixed_googlemaps' "; $fixed_Reult = mysqli_query($con,$fixed_Up); if ($fixed_Reult) { echo"<script>alert('แก้ไขเรียบร้อยแล้ว'); window.location='contact.php?UPDATE';</script>"; } else { echo"<script>alert('fixed_Reult'); window.history.back(); </script>"; } } if ($_POST['pagecontent_update']) { $pagecontent_review = trim($_POST['pagecontent_review']); $pagecontent_id = $_POST['pagecontent_id']; $pagecontent_Update = "UPDATE `pagecontent` SET `pagecontent_review` = '$pagecontent_review' WHERE `pagecontent_id` = '$pagecontent_id'"; $pagecontent_Reult = mysqli_query($con,$pagecontent_Update); if($pagecontent_Reult) { echo"<script> window.location='contact.php?UPDATE'; </script>"; } else{ echo"<script>alert('Content_Reult'); window.history.back(); </script>"; } }
?>
<!DOCTYPE html> <html> <head> <? include 'index_Head.php'; ?> </head> <body> <? include 'index_Navbar.php'; ?> <div class="container-fluid"> <div class="row"> <div class="col-md-2" id="main-left"> <div class="row"> <div class="col-md-12"> <? include 'index_AdminMenu.php'; ?> </div> </div> </div> <div class="col-md-10"> <div class="row"> <div class="col-md-12"> <? $pagecontent_SL = " SELECT * FROM pagecontent WHERE pagecontent_name = 'contact'"; $pagecontent_QR = mysqli_query($con,$pagecontent_SL); $pagecontent = mysqli_fetch_array($pagecontent_QR); ?> <h3> จัดการ <? echo $pagecontent[pagecontent_topic]; ?> </h3> <hr> </div> </div> <? include 'index_Alerts.php'; ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <? $pagecontent_SL = " SELECT * FROM pagecontent WHERE pagecontent_name = 'contact'"; $pagecontent_QR = mysqli_query($con,$pagecontent_SL); $pagecontent = mysqli_fetch_array($pagecontent_QR); ?> <div class="panel-heading"> <div class="row" > <div class="col-md-12"> หน้าเพจ,เนื้อหา : <span class="text-primary"> <? echo $pagecontent[pagecontent_topic]; ?> </span> <button type="button" class="btn btn-info" style="margin-top: -5px; margin-bottom: -5px;" data-toggle="modal" data-target="#pagecontent_update<?php echo $pagecontent[pagecontent_id]; ?>"> <span class="glyphicon glyphicon-edit"></span> แก้ไข </button> </div> </div> </div> <div class="panel-body"> <? echo $pagecontent[pagecontent_review]; ?> </div> <div id="pagecontent_update<?php echo $pagecontent[pagecontent_id]; ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <form action="" method="post" encType="multipart/form-data"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="exampleModalLabel"> แก้ไข หน้าเพจ,เนื้อหา : <span class="text-primary"> <? echo $pagecontent[pagecontent_topic]; ?> </span> </h4> </div> <div class="modal-body"> <div class="form-group"> <textarea name="pagecontent_review" class="ckeditor"><? echo $pagecontent[pagecontent_review]; ?></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info"> <span class="glyphicon glyphicon-floppy-disk"></span> บันทึกการแก้ไข </button> <input Type="hidden" name="pagecontent_update" value="x"> <input Type="hidden" name="pagecontent_id" value="<?php echo $pagecontent[pagecontent_id]; ?>"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> </div> </div>
<div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-6"> Google Maps </div> <div class="col-md-6 text-right"> <button type="button" style="margin: -6px;" class="btn btn-info" data-toggle="modal" data-target="#update_fixed_googlemaps"> <span class="glyphicon glyphicon-edit"></span> แก้ไข Google Maps </button> </div> </div> </div> <div class="panel-body GoogleMaps"> <div class="embed-responsive embed-responsive-16by9"> <? echo $fixed[fixed_googlemaps]; ?> </div> <div id="update_fixed_googlemaps" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form action="" method="post" enctype="multipart/form-data"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="exampleModalLabel"> แก้ไข Google Maps </h4> </div> <div class="modal-body"> <div class="form-group"> <label class="control-label " > Google Maps </label> <textarea class="form-control" rows="5" id="comment" name="fixed_googlemaps" placeholder=" Embed a map "><? echo $fixed[fixed_googlemaps]; ?></textarea> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info"> <span class="glyphicon glyphicon-floppy-disk"></span> บันทึกการแก้ไข </button> <input Type="hidden" name="update_fixed_googlemaps" value="x"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading"> การติดต่อเข้ามา ทั้งหมด <span class="badge"> <? echo "$Num_Rows"; ?></span> </div> <div class="panel-body"> <? if ($contactus_Row>0) { ?> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th> #</th> <th> ชื่อ </th> <th> วันเดือนปี </th> <th> รายละเอียด , ลบ </th> </tr> </thead> <tbody> <? while ($contactus = mysqli_fetch_array($contactus_RS)) { ?> <tr> <td> <p><?php echo $i; ?></p> </td> <td> <p><?php echo $contactus[contactus_name]; ?></p> </td> <td> <p><?php echo displaydate($contactus[contactus_date]); ?></p> </td> <td> <a href="contactus_one.php?contactus_id=<?php echo $contactus[contactus_id]; ?>" class="btn btn-primary"> <span class="glyphicon glyphicon-zoom-in"></span> รายละเอียด </a> <a href="contactus_del.php?contactus_id=<?php echo $contactus[contactus_id]; ?>" class="btn btn-danger" onclick="return confirm(' ยืนยันการลบข้อมูล ? ')"> <span class="glyphicon glyphicon-trash"></span> ลบ </a> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> <? } else{ echo "<h4> ยังไม่มีการติดต่อเข้ามา </h4>"; } ?> </div> <div class="panel-footer"> <? include 'index_pagenum.php'; ?> </div> </div> </div> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <!-- container --> </body> </html>
|