Viewing file: product_one.php (55.87 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'product.php'; if (isset($_GET[product_id])){ $_SESSION[product_id] = $_GET[product_id]; }
$product_id = $_SESSION[product_id]; $product_SL = " SELECT * FROM product WHERE product_id = '$product_id'"; $product_QR = mysqli_query($con,$product_SL); $product = mysqli_fetch_array($product_QR);
// $plot_name = $product[plot_name]; // $plot_name= str_replace("อสังหาริมทรัพย์แนะนำ","HOT",$plot_name); // $plot_name= str_replace("โฆษณา","New",$plot_name);
// $product_update = "UPDATE `product` SET `plot_name` = '$plot_name' WHERE `product_id` = '$_SESSION[product_id]'"; // $product_reult = mysqli_query($con,$product_update);
$product_id = $_SESSION[product_id]; $product_SL = " SELECT * FROM product WHERE product_id = '$product_id'"; $product_QR = mysqli_query($con,$product_SL); $product = mysqli_fetch_array($product_QR);
if ($_POST['product_picture_all_del']) { for($i=0;$i<count($_POST["product_picture_id"]);$i++){ if(trim($_POST["product_picture_id"][$i]) != ""){ $product_picture_id = $_POST[product_picture_id][$i]; $product_picture_SL = " SELECT * FROM product_picture WHERE product_picture_id = '$product_picture_id'"; $product_picture_QR = mysqli_query($con,$product_picture_SL); $product_picture = mysqli_fetch_array($product_picture_QR); @unlink("../Files/product_picture_photo/".$product_picture['product_picture_photo']);
$product_picture_Del ="DELETE FROM `product_picture` WHERE product_picture_id = '$product_picture_id' "; $product_picture_Qurey = mysqli_query($con,$product_picture_Del);
if($product_picture_Qurey) {
} else{ echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } } } if($product_picture_Qurey) { echo"<script> window.location='product_one.php?DELETE'; </script>"; } else{ echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } }
if ($_POST['product_picture_add']) { if(isset($_FILES['product_picture_photo']['name'])&&$_FILES['product_picture_photo']['name']!=''){ $Count = count($_FILES['product_picture_photo']['name']); for ($i=0; $i < $Count; $i++) { $Jpg = strrchr($_FILES["product_picture_photo"]["name"][$i],"."); $product_picture_photo = rand().rand().$Jpg; if(move_uploaded_file($_FILES["product_picture_photo"]["tmp_name"][$i],"../Files/product_picture_photo/".$product_picture_photo)){ $product_picture_Add = "INSERT INTO `product_picture` (`product_id`,`product_picture_photo`) VALUES ('$product_id','$product_picture_photo')"; $product_picture_Reult = mysqli_query($con,$product_picture_Add); if (!$product_picture_Reult) { echo"<script>alert('Error product_picture'); window.history.back(); </script>"; } } else{ echo"<script>alert('Error move_uploaded_file'); window.history.back(); </script>"; } } echo"<script> window.location='product_one.php?INSERT'; </script>"; } } if ($_GET['product_picture_del']) { $product_picture_id = $_GET[product_picture_id]; $product_picture_SL = " SELECT * FROM product_picture WHERE product_picture_id = '$product_picture_id'"; $product_picture_QR = mysqli_query($con,$product_picture_SL); $product_picture = mysqli_fetch_array($product_picture_QR); @unlink("../Files/product_picture_photo/".$product_picture['product_picture_photo']); $product_picture_Del ="DELETE FROM `product_picture` WHERE product_picture_id = '$product_picture_id' "; $product_picture_Qurey = mysqli_query($con,$product_picture_Del); if($product_picture_Qurey) { echo"<script> window.location='product_one.php?DELETE'; </script>"; } else{ echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } } if ($_POST['productUpdate']) { if($_FILES['product_photo']['name']!=''){ @unlink("../Files/product_photo/".$product['product_photo']); $suffix = strrchr($_FILES["product_photo"]["name"],"."); $product_photo = rand().$suffix; $upload = move_uploaded_file($_FILES["product_photo"]["tmp_name"],"../Files/product_photo/".$product_photo); $product_photo_Update = "UPDATE `product` SET `product_photo` = '$product_photo' WHERE `product_id` = '$_SESSION[product_id]'"; $product_photo_Reult = mysqli_query($con,$product_photo_Update); $table = 'product'; min_resize($product_photo,$table); if (!$product_photo_Reult) { echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } if ($product_photo_Reult) { echo"<script> window.location='product_one.php?UPDATE'; </script>"; } } }
// gallery ------------------------------------------------> if ($_POST['add_gallery']) { $gallery_photo = $_FILES['gallery_photo']['name']; $gallery_video = $_FILES['gallery_video']['name']; $gallery_youtube = function_youtube($_POST['gallery_youtube']); $gallery_facebook = $_POST['gallery_facebook']; $gallery_review = function_review($_POST['gallery_review']); $gallery_link = function_link($_POST['gallery_link']); $gallery_download = $_FILES['gallery_download']['name']; if ( trim($gallery_photo)=='' && trim($gallery_video)=='' && trim($gallery_review)=='' && trim($gallery_youtube)=='' && trim($gallery_facebook)=='' && trim($gallery_link)=='' && trim($gallery_download)=='' ) { echo" <script>alert('กรุณากรอกอย่างใดอย่างหนึ่ง '); window.location='product_one.php?#gallery'; </script>"; } else{ $gallery_Add = "INSERT INTO `gallery` (`gallery_link`,`gallery_review`,`gallery_youtube`,`gallery_facebook`,`gallery_code`) VALUES ('$gallery_link','$gallery_review','$gallery_youtube','$gallery_facebook','product_id$product_id')"; $gallery_Reult = mysqli_query($con,$gallery_Add); $_SESSION[gallery_id] = mysqli_insert_id($con); if (!$gallery_Reult) { echo"<script>alert('เกิดข้อผิดพลาด'); </script>"; }
if($_FILES['gallery_photo']['name']!=''){ $Jpg = strrchr($_FILES["gallery_photo"]["name"],"."); $gallery_photo = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_photo"]["tmp_name"],"../Files/gallery_photo/".$gallery_photo); $gallery_photo_Update = "UPDATE `gallery` SET `gallery_photo` = '$gallery_photo' WHERE `gallery_id` = '$_SESSION[gallery_id]'"; $gallery_photo_Reult = mysqli_query($con,$gallery_photo_Update); } if($_FILES['gallery_video']['name']!=''){ $Jpg = strrchr($_FILES["gallery_video"]["name"],"."); $gallery_video = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_video"]["tmp_name"],"../Files/gallery_video/".$gallery_video); $gallery_video_Update = "UPDATE `gallery` SET `gallery_video` = '$gallery_video' WHERE `gallery_id` = '$_SESSION[gallery_id]'"; $gallery_video_Reult = mysqli_query($con,$gallery_video_Update); } if($_FILES['gallery_download']['name']!=''){ $Jpg = strrchr($_FILES["gallery_download"]["name"],"."); $gallery_download = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_download"]["tmp_name"],"../Files/gallery_download/".$gallery_download); $gallery_download_Update = "UPDATE `gallery` SET `gallery_download` = '$gallery_download' WHERE `gallery_id` = '$_SESSION[gallery_id]'"; $gallery_download_Reult = mysqli_query($con,$gallery_download_Update); }
echo"<script> window.location='product_one.php#gallery".$_SESSION[gallery_id]."'; </script>"; } }
if ($_POST['update_gallery']) { $gallery_id = $_POST['gallery_id']; $gallery_photo = $_FILES['gallery_photo']['name']; $gallery_video = $_FILES['gallery_video']['name']; $gallery_youtube = function_youtube($_POST['gallery_youtube']); $gallery_facebook = $_POST['gallery_facebook']; $gallery_review = function_review($_POST['gallery_review']); $gallery_link = function_link($_POST['gallery_link']); $gallery_download = $_FILES['gallery_download']['name']; $gallery_Update = "UPDATE gallery SET gallery_link = '$gallery_link', gallery_review = '$gallery_review', gallery_youtube = '$gallery_youtube', gallery_facebook = '$gallery_facebook' WHERE `gallery_id` = '$gallery_id'"; $gallery_Reult = mysqli_query($con,$gallery_Update); if (!$gallery_Reult) { echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } if ($gallery_Reult) { if($_FILES['gallery_photo']['name']!=''){ $gallery_SL = " SELECT * FROM gallery WHERE gallery_id = '$gallery_id'"; $gallery_QR = mysqli_query($con,$gallery_SL); $gallery = mysqli_fetch_array($gallery_QR); @unlink("../Files/gallery_photo/".$gallery['gallery_photo']); $Jpg = strrchr($_FILES["gallery_photo"]["name"],"."); $gallery_photo = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_photo"]["tmp_name"],"../Files/gallery_photo/".$gallery_photo); $gallery_photo_Update = "UPDATE `gallery` SET `gallery_photo` = '$gallery_photo' WHERE `gallery_id` = '$gallery_id'"; $gallery_photo_Reult = mysqli_query($con,$gallery_photo_Update); } if($_FILES['gallery_download']['name']!=''){ $gallery_SL = " SELECT * FROM gallery WHERE gallery_id = '$gallery_id'"; $gallery_QR = mysqli_query($con,$gallery_SL); $gallery = mysqli_fetch_array($gallery_QR); @unlink("../Files/gallery_download/".$gallery['gallery_download']); $Jpg = strrchr($_FILES["gallery_download"]["name"],"."); $gallery_download = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_download"]["tmp_name"],"../Files/gallery_download/".$gallery_download); $gallery_download_Update = "UPDATE `gallery` SET `gallery_download` = '$gallery_download' WHERE `gallery_id` = '$gallery_id'"; $gallery_download_Reult = mysqli_query($con,$gallery_download_Update); } if($_FILES['gallery_video']['name']!=''){ $gallery_SL = " SELECT * FROM gallery WHERE gallery_id = '$gallery_id'"; $gallery_QR = mysqli_query($con,$gallery_SL); $gallery = mysqli_fetch_array($gallery_QR); @unlink("../Files/gallery_video/".$gallery['gallery_video']); $Jpg = strrchr($_FILES["gallery_video"]["name"],"."); $gallery_video = rand().rand().$Jpg;; $upload = move_uploaded_file($_FILES["gallery_video"]["tmp_name"],"../Files/gallery_video/".$gallery_video); $gallery_video_Update = "UPDATE `gallery` SET `gallery_video` = '$gallery_video' WHERE `gallery_id` = '$gallery_id'"; $gallery_video_Reult = mysqli_query($con,$gallery_video_Update); } echo"<script> window.location='product_one.php?UPDATE#gallery".$gallery_id."'; </script>"; } } if ($_GET['gallery_del']) { $gallery_id = $_GET[gallery_id]; $gallery_SL = " SELECT * FROM gallery WHERE gallery_id = '$gallery_id'"; $gallery_QR = mysqli_query($con,$gallery_SL); $gallery = mysqli_fetch_array($gallery_QR); @unlink("../Files/gallery_photo/".$gallery['gallery_photo']); @unlink("../Files/gallery_download/".$gallery['gallery_download']); @unlink("../Files/gallery_video/".$gallery['gallery_video']); $gallery_Del ="DELETE FROM `gallery` WHERE gallery_id = '$gallery_id' "; $gallery_Qurey = mysqli_query($con,$gallery_Del); if($gallery_Qurey) { echo"<script> window.location='product_one.php?DELETE'; </script>"; } else{ echo"<script>alert('เกิดข้อผิดพลาด'); window.history.back(); </script>"; } }
?> <!DOCTYPE html> <html> <head> <? include 'index_Head.php'; ?> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> </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"> <h3> อสังหาริมทัพย์ : <span class="text-primary bold"> <?php echo $product[product_name]; ?> </span> </h3> <hr> </div> </div> <? include 'index_Alerts.php'; ?> <div class="row"> <div class="col-md-12 br-margin2"> <a href="product.php" class="btn btn-primary"><span class="glyphicon glyphicon-step-backward"></span> กลับ </a> <a href="product_update.php?product_id=<?php echo $product[product_id]; ?>" class="btn btn-info"> <span class="glyphicon glyphicon-edit"></span> แก้ไข </a> <a href="product_del.php?product_id=<?php echo $product[product_id]; ?>" onclick="return confirm(' ยืนยันการลบข้อมูล ? ')" class="btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> ลบ </a> </div> <div class="col-md-8"> <div class="panel panel-default"> <div class="panel-heading"> รายละเอียดอสังหาริมทัพย์ : <span class="text-primary bold"> <?php echo $product[product_name]; ?> </span> </div> <div class="panel-body"> <div class="row br-margin2"> <div class="col-md-12"> <form class="form-horizontal"> <div class="form-group"> <label class="control-label col-md-3" > สำหรับ (สมาชิก , คนนอก) </label> <label class="control-label col-md-9 text-left"> <? $product_web_SL = " SELECT * FROM product_web WHERE product_web_id = '$product[product_web_id]'"; $product_web_QR = mysqli_query($con,$product_web_SL); $product_web = mysqli_fetch_array($product_web_QR); if (!isset($product_web[product_web_id])||$product_web[product_web_id]=='') { ?> - <? } else{ echo $product_web[product_web_name]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >ชื่ออสังหาริมทัพย์</label> <label class="control-label col-md-9 text-left"> <? echo $product[product_name]; ?> </label> </div> <!-- <div class="form-group"> <label class="control-label col-md-3" >ชื่อลิ้ง อสังหานี้</label> <label class="control-label col-md-9 text-left"> <? echo $product[product_page]; ?> </label> </div> --> <div class="form-group"> <label class="control-label col-md-3" >รหัสทรัพย์</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_code])&&trim($product[product_code])!='') { echo $product[product_code]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > สำหรับ </label> <label class="control-label col-md-9 text-left"> <? $market_SL = " SELECT * FROM market WHERE market_id = '$product[market_id]'"; $market_QR = mysqli_query($con,$market_SL); $market = mysqli_fetch_array($market_QR); if (!isset($market[market_id])||$market[market_id]=='') { ?> - <? } else{ echo $market[market_name]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > สถานะ </label> <label class="control-label col-md-9 text-left"> <? $product_status_SL = " SELECT * FROM product_status WHERE product_status_id = '$product[product_status_id]'"; $product_status_QR = mysqli_query($con,$product_status_SL); $product_status = mysqli_fetch_array($product_status_QR); if (!isset($product_status[product_status_id])||$product_status[product_status_id]=='') { ?> - <? } else{ echo $product_status[product_status_name]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >ราคา</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_price])&&trim($product[product_price])!=''&&trim($product[product_price])!='0') { echo number_format($product[product_price]); } else{ echo "-"; } ?> <? if (isset($product[product_charges])&&trim($product[product_charges])!=''&&trim($product[product_charges])!='0') { echo " "; echo $product[product_charges]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > ราคาที่ถูกขีด ราคาเดิม </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_rebate])&&trim($product[product_rebate])!=''&&trim($product[product_rebate])!='0') { ?> <span style="text-decoration:line-through"> <? echo number_format($product[product_rebate]); ?> </span> <? } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > ประเภทอสังหาฯ </label> <label class="control-label col-md-9 text-left"> <? $catalog_SL = " SELECT * FROM catalog WHERE catalog_id = '$product[catalog_id]'"; $catalog_QR = mysqli_query($con,$catalog_SL); $catalog = mysqli_fetch_array($catalog_QR); if (!isset($catalog[catalog_id])||$catalog[catalog_id]=='') { ?> - <? } else{ echo $catalog[catalog_name]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > ชั้น </label> <label class="control-label col-md-9 text-left"> <? $floor_SL = " SELECT * FROM floor WHERE floor_id = '$product[floor_id]'"; $floor_QR = mysqli_query($con,$floor_SL); $floor = mysqli_fetch_array($floor_QR); if (!isset($floor[floor_id])||$floor[floor_id]=='') { ?> - <? } else{ echo $floor[floor_name]; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > โซนหรือถนน </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_zone])&&trim($product[product_zone])!='') { echo $product[product_zone]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >บ้านเลขที่</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_detail])&&trim($product[product_detail])!='') { echo $product[product_detail]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >ห้องนอน</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_bedroom])&&trim($product[product_bedroom])!=''&&trim($product[product_bedroom])!='0') { echo number_format($product[product_bedroom]); } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >ห้องน้ำ</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_bathroom])&&trim($product[product_bathroom])!=''&&trim($product[product_bathroom])!='0') { echo number_format($product[product_bathroom]); } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >พื้นที่ใช้สอย</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_area])&&trim($product[product_area])!='') { echo $product[product_area]; echo " ตารางวา"; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > ทำเลที่ตั้ง </label> <label class="control-label col-md-9 text-left"> <? $province_SL = " SELECT * FROM province WHERE province_id = '$product[province_id]'"; $province_QR = mysqli_query($con,$province_SL); $province = mysqli_fetch_array($province_QR); if (isset($province[province_id])&&trim($province[province_id])!='') { echo " (<b>จังหวัด</b> : "; echo $province[province_name]; echo ") "; } else{ echo "-"; } $amphure_SL = " SELECT * FROM amphure WHERE amphure_id = '$product[amphure_id]'"; $amphure_QR = mysqli_query($con,$amphure_SL); $amphure = mysqli_fetch_array($amphure_QR); if (isset($amphure[amphure_id])&&trim($amphure[amphure_id])!='') { echo " (<b>อำเภอ</b> : "; echo $amphure[amphure_name]; echo ") "; } $district_SL = " SELECT * FROM district WHERE district_id = '$product[district_id]'"; $district_QR = mysqli_query($con,$district_SL); $district = mysqli_fetch_array($district_QR); if (isset($district[district_id])&&trim($district[district_id])!='') { echo " (<b>ตำบล</b> : "; echo $district[district_name]; echo ") "; }
?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > รายการแสดง </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[plot_name])&&trim($product[plot_name])!='') { echo $product[plot_name]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > คุณสมบัติ </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[features_name])&&trim($product[features_name])!='') { echo $product[features_name]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" >เดินทางไปบ้านหลังนี้</label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_link])&&trim($product[product_link])!='') { ?> <a href="http://<? echo $product[product_link]; ?>" target="_blank" > <span class="glyphicon glyphicon-new-window"> <? echo $product[product_link]; ?> </span> </a> <? } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > Google Maps </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_googlemaps])&&trim($product[product_googlemaps])!='') { ?> <div class="embed-responsive embed-responsive-16by9"> <? echo $product[product_googlemaps]; ?> </div> <? } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > เจ้าของทรัพย์ </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_owner])&&trim($product[product_owner])!='') { echo $product[product_owner]; } else{ echo "-"; } ?> </label> </div> <div class="form-group"> <label class="control-label col-md-3" > ผู้ขาย </label> <label class="control-label col-md-9 text-left"> <? if (isset($product[product_condition])&&trim($product[product_condition])!='') { echo $product[product_condition]; } else{ echo "-"; } ?> </label> </div> </form> </div> </div> <!-- row --> </div> <!-- panel body --> </div> <!-- panel --> <div class="panel panel-default"> <div class="panel-heading"> ข้อมูลทั้งหมด </div> <div class="panel-body"> <div class="Review"> <? if (isset($product[product_review])&&trim($product[product_review])!='') { echo $product[product_review]; } else{ echo "ยังไม่มีข้อมูลนี้"; } ?> </div> </div> <div class="panel-footer"> ข้อมูลล่าสุดเมื่อ : <?php echo $product[product_datetime]; ?> </div> </div> <div class="panel panel-default" id="gallery"> <div class="panel-heading"> <div class="row"> <div class="col-md-9"> กล่องเนื้อหา (รูปภาพ วิดีโอ ข้อความ ไฟล์ดาวโหลด ลิ้ง) </div> <div class="col-md-3 text-right" style="margin: -5px;"> <button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#add_gallery"> <span class="glyphicon glyphicon-plus-sign"></span> เพิ่มกล่องเนื้อหา </button> </div> </div> <div id="add_gallery" 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">(ไม่จำเป็นต้องกรอกทั้งหมด)</span> </h4> </div> <div class="modal-body"> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">รูปภาพ </label> <input Type="file" class="form-control" multiple="multiple" name="gallery_photo"> </div> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ ไฟล์อัพโหลด </label> <input Type="file" class="form-control" name="gallery_video"> </div> </div> <div class="form-group"> <label class="control-label" for="email">ข้อความ เนื้อหา </label> <textarea class="ckeditor" name="gallery_review"></textarea> </div> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ Youtube </label> <input Type="text" class="form-control" name="gallery_youtube" placeholder="เช่น https://www.youtube.com/watch?v=ABrjdyavqkI"> </div> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ Facebook </label> <input Type="text" class="form-control" name="gallery_facebook" placeholder="เช่น https://www.facebook.com/efmstation/videos/336277683664652/"> </div> </div> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">ลิ้งเว็บไซต์ต่างๆ </label> <input Type="text" class="form-control" name="gallery_link" placeholder="เช่น https://www.website.com/"> </div> <div class="form-group col-md-6"> <label class="control-label" for="email">ไฟล์ สำหรับให้ดาวโหลด</label> <input Type="file" class="form-control" name="gallery_download" > </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> ยืนยันการเพิ่ม </button> <input Type="hidden" name="add_gallery" value="x"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> </div> <div class="panel-body"> <? $gallery_SL = " SELECT * FROM gallery WHERE gallery_code = 'product_id$product[product_id]' ORDER BY gallery_sort IS NULL ASC, gallery_sort ASC"; $gallery_QR = mysqli_query($con,$gallery_SL); $gallery_Row = mysqli_num_rows($gallery_QR); if ($gallery_Row==0) { ?> <p class="text-muted"> ยังไม่มีข้อมูลนี้ </p> <? } ?> <div class="table-responsive"> <table class="table table-bordered "> <tbody class="row_position"> <? while ($gallery = mysqli_fetch_array($gallery_QR)) { ?> <tr id="<?php echo $gallery['gallery_id'] ?>"> <td id="gallery<?php echo $gallery[gallery_id]; ?>"> <? if (isset($gallery[gallery_photo])&&trim($gallery[gallery_photo])!='') { ?> <div class="margintop15"> <img src="../Files/gallery_photo/<?php echo $gallery[gallery_photo]; ?>" class="full" /> </div> <? } ?> <? if (isset($gallery[gallery_video])&&trim($gallery[gallery_video])!='') { ?> <div class="margintop15"> <video width="100%" height="auto" controls> <source src="../Files/gallery_video/<? echo $gallery[gallery_video]; ?>" type="video/mp4"> Your browser does not support HTML5 video. </span> </video> </div> <? } ?> <? if (isset($gallery[gallery_youtube])&&trim($gallery[gallery_youtube])!='') { ?> <div class="margintop15"> <div class="embed-responsive embed-responsive-16by9"> <iframe src="<?php echo $gallery['gallery_youtube']; ?>?rel=0&controls=0&showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> </div> </div> <? } ?> <? if (isset($gallery[gallery_facebook])&&trim($gallery[gallery_facebook])!='') { ?> <div class="margintop15"> <div class="embed-responsive embed-responsive-16by9"> <iframe src="https://www.facebook.com/plugins/video.php?href=<?php echo $gallery['gallery_facebook']; ?>&show_text=0&width=269" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe> </div> </div> <? } ?> <? if (isset($gallery[gallery_review])&&trim($gallery[gallery_review])!='') { ?> <div class="margintop15"> <?php echo $gallery[gallery_review]; ?> </div> <? } ?> <? if (isset($gallery[gallery_link])&&trim($gallery[gallery_link])!='') { ?> <div class="margintop15"> <a target="_blank" class="btn btn-default" href="http://<?php echo $gallery[gallery_link]; ?>"> <span class="glyphicon glyphicon-link"></span> <?php echo $gallery[gallery_link]; ?> </a> </div> <? } ?> <? if (isset($gallery[gallery_download])&&trim($gallery[gallery_download])!='') { ?> <div class="margintop15"> <a target="_blank" class="btn btn-default" href="../Files/gallery_download/<?php echo $gallery[gallery_download]; ?>"> <span class="glyphicon glyphicon-download"></span> <?php echo $gallery[gallery_download]; ?> </a> </div> <? } ?> <div class="caption" style="margin: 10px;"> <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#update_gallery<?php echo $gallery[gallery_id]; ?>"> <span class="glyphicon glyphicon-edit"></span> แก้ไข </button> <div id="update_gallery<?php echo $gallery[gallery_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"> แก้ไข กล่องเนื้อหา </h4> </div> <div class="modal-body"> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">รูปภาพ <small>(รูปใหม่ที่จะนำมาแทน)</small>:</label> <input Type="file" class="form-control" name="gallery_photo" > </div> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ <small>(วิดีโอใหม่ที่จะนำมาแทน)</small>:</label> <input Type="file" class="form-control" name="gallery_video" > </div> </div> <div class="form-group"> <label class="control-label" for="email">ข้อความ เนื้อหา </label> <textarea class="ckeditor" name="gallery_review"><?php echo $gallery[gallery_review]; ?></textarea> </div> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ Youtube </label> <input Type="text" class="form-control" name="gallery_youtube" value="<?php echo $gallery[gallery_youtube]; ?>" > </div> <div class="form-group col-md-6"> <label class="control-label" for="email">วิดีโอ Facebook </label> <input Type="text" class="form-control" name="gallery_facebook" value="<?php echo $gallery[gallery_facebook]; ?>" > </div> </div> <div class="row"> <div class="form-group col-md-6"> <label class="control-label" for="email">ลิ้งเว็บไซต์ต่างๆ </label> <input Type="text" class="form-control" name="gallery_link" value="<?php echo $gallery[gallery_link]; ?>" placeholder="เช่น https://www.website.com/"> </div> <div class="form-group col-md-6"> <label class="control-label" for="email">ไฟล์ สำหรับให้ดาวโหลด <small>(ไฟล์ใหม่ที่จะนำมาแทน)</small>:</label> <input Type="file" class="form-control" name="gallery_download" > </div> </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_gallery" value="x"> <input Type="hidden" name="gallery_id" value="<?php echo $gallery[gallery_id]; ?>"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> <a href="product_one.php?gallery_id=<?php echo $gallery[gallery_id]; ?>&gallery_del=x" onclick="return confirm(' ยืนยันการลบข้อมูล ? ')" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span> ลบกล่องนี้</a> </div> </td> </tr> <? $i++; } ?> </tbody> </table> </div> </div> <div class="panel-footer"> </div> </div>
<? $row = "SELECT * FROM view WHERE product_id = '$product[product_id]' ";
$rowQuery = mysqli_query($con,$row) or die ("Error Query [".$row."]"); $Num_Rows = mysqli_num_rows($rowQuery);
$view_SL = $row." ORDER BY view_id DESC"; $view_QR = mysqli_query($con,$view_SL);
$YYYY = date('Y-m-d');
$time = time(); $timeview = time() - 300;
$sql = "select * from statistics_online where statistics_online_time > '$timeview'"; $result = mysqli_query($con,$sql); $Online = mysqli_num_rows($result);
$DaySl = $row." AND ( view_date = '$YYYY' ) "; $DayQuery = mysqli_query($con,$DaySl); $DayNum = mysqli_num_rows($DayQuery);
$AllSl = $row; $AllQuery = mysqli_query($con,$AllSl); $All_Rows = mysqli_num_rows($AllQuery);
?> <div class="row"> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading"> ผู้เข้าชมวันนี้ </div> <div class="panel-body"> <h4> <? echo number_format($DayNum); ?> คน </h4> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading"> ผู้เข้าชมทั้งหมด </div> <div class="panel-body"> <h4> <? echo number_format($All_Rows); ?> คน </h4> </div> </div> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> สถิติการเข้าชม ต่อวัน </div> <div class="panel-body"> <? $All_DayNum = 0; for ($i=0; $i<=7; $i++) {
$date = date('Y-m-d', strtotime("-".$i." days"));
$DaySl = $row." AND view_date = '$date' "; $DayQuery = mysqli_query($con,$DaySl); $DayNum = mysqli_num_rows($DayQuery);
$DayNow[$i] = $DayNum; $All_DayNum += $DayNum; $y=$i;
$D[$i] = date('Y-m-d', strtotime("-$y days")); } $All_DayNum = $All_DayNum / 7; ?>
<div id="view_day" ></div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> สถิติการเข้าชม ต่อเดือน </div> <div class="panel-body"> <? $All_MonNum = 0; for ($i=1; $i<=6; $i++) { if ($i==0) { $Mounth = date('m', strtotime("+1 month")); $Year = date('Y', strtotime("-$i month")); $x=$i-1; } else{ $x=$i-1; $Mounth = date('m', strtotime("-$x month")); $Year = date('Y', strtotime("-$x month")); }
$DaySl = $row." AND MONTH(view_date) = '$Mounth' and YEAR(view_date) = '$Year' "; $DayQuery = mysqli_query($con,$DaySl); $DayNum = mysqli_num_rows($DayQuery);
$SumIncome[$i] = $DayNum; $All_MonNum += $DayNum; $y=$i-1;
$YM[$i] = date('Y-m', strtotime("-$y month")); } $All_MonNum = $All_MonNum / 6; ?> <div id="view_month" ></div> </div> </div> </div> </div> </div> <!-- 12 --> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-4"> จัดการรูปภาพ </div> <div class="col-md-8 text-right" style="margin: -5px;"> <button type="button" class="btn btn-sm btn-info " data-toggle="modal" data-target="#productUpdate"> <span class="glyphicon glyphicon-picture"></span> แก้ไขรูปภาพหลัก </button> <button type="button" class="btn btn-sm btn-success " data-toggle="modal" data-target="#product_picture_add"> <span class="glyphicon glyphicon-picture"></span> เพิ่มรูปภาพ </button> </div> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <p class="text-muted"> รูปภาพหลักของ อสังหาริมทัพย์ </p> </div> <div class="col-md-12 br-margin2"> <img class="full" style="cursor: zoom-in;" id="img_product<?php echo $product[product_id]; ?>" src="../Files/product_photo/<?php echo $product[product_photo]; ?>" /> <div id="modal_product<?php echo $product[product_id]; ?>" class="w3-modal"> <span class="zoom-close w3-close">×</span> <img class="w3-modal-content w3-close" id="show_product<?php echo $product[product_id]; ?>"> </div> <script> var w3modal = document.getElementById("modal_product<?php echo $product[product_id]; ?>"); var img = document.getElementById("img_product<?php echo $product[product_id]; ?>"); var modalImg = document.getElementById("show_product<?php echo $product[product_id]; ?>"); img.onclick = function(){ w3modal.style.display = "block"; modalImg.src = this.src; } var span = document.getElementsByClassName("w3-close")[0]; span.onclick = function() { w3modal.style.display = "none"; }
window.onclick = function(event) { if (event.target == w3modal) { w3modal.style.display = "none"; } } </script> </div> </div> <div class="row"> <? $product_picture_SL = " SELECT * FROM product_picture WHERE product_id = '$product[product_id]' ORDER BY product_picture_sort asc "; $product_picture_QR = mysqli_query($con,$product_picture_SL); $product_picture_Row = mysqli_num_rows($product_picture_QR); if ($product_picture_Row == '0') {
} else{ ?> <div class="col-md-12"> <p class="text-muted"> รูปภาพเพิ่มเติม (ลากรูปภาพเพื่อจัดลำดับ) </p> </div> <? } ?> <form method="post" encType="multipart/form-data" action=""> <div class="row_product_picture"> <? while ($product_picture = mysqli_fetch_array($product_picture_QR)) { ?> <div class="col-md-6" id="<?php echo $product_picture[product_picture_id]; ?>"> <div class="thumbnail" > <div class="img80"> <img style="cursor: zoom-in;" id="img_product_picture<?php echo $product_picture[product_picture_id]; ?>" src="../Files/product_picture_photo/<?php echo $product_picture[product_picture_photo]; ?>" /> </div> <label class="checkbox-inline" style="margin-top: 5px;"> <input name="product_picture_id[]" value="<?php echo $product_picture['product_picture_id'];?>" type="checkbox"> เลือกรูปนี้เพื่อลบ </label> <div id="modal_product_picture<?php echo $product_picture[product_picture_id]; ?>" class="w3-modal"> <span class="zoom-close w3-close">×</span> <img class="w3-modal-content w3-close" id="show_product_picture<?php echo $product_picture[product_picture_id]; ?>"> </div> <script> var w3modal = document.getElementById("modal_product_picture<?php echo $product_picture[product_picture_id]; ?>"); var img = document.getElementById("img_product_picture<?php echo $product_picture[product_picture_id]; ?>"); var modalImg = document.getElementById("show_product_picture<?php echo $product_picture[product_picture_id]; ?>"); img.onclick = function(){ w3modal.style.display = "block"; modalImg.src = this.src; } var span = document.getElementsByClassName("w3-close")[0]; span.onclick = function() { w3modal.style.display = "none"; }
window.onclick = function(event) { if (event.target == w3modal) { w3modal.style.display = "none"; } } </script> <div class="caption"> <a href="product_one.php?product_picture_id=<?php echo $product_picture[product_picture_id]; ?>&product_picture_del=x" onclick="return confirm('ยืนยันการลบข้อมูล ? ')" ><span class="glyphicon glyphicon-trash"></span> ลบรูปนี้</a> </div> </div> </div> <? } ?> </div> <div class="col-md-12"> <button onclick="return confirm('ลบที่เลือกทั้งหมด ? ')" Type="submit" class="btn btn-danger top-margin1 br-margin2 btn-block btn-lg"> ลบที่เลือก </button> <input type="hidden" name="product_picture_all_del" value="product_picture_all_del" > </div> </form> </div> </div> </div> </div> <!-- 12 --> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <!-- container --> <div id="product_picture_add" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <form class="form" enctype="multipart/form-data" method="post"> <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">เพิ่มรูปภาพเพิ่มเติม</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="recipient-name" class="control-label">เลือกรูปภาพ <span class="text-muted normal">เป็นรูปภาพที่จะแสดงต่อจาก รูปหลักของ อสังหาริมทัพย์</span></label> <input type="file" required class="form-control" multiple="multiple" name="product_picture_photo[]"> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> ยืนยันการเพิ่ม </button> <input type="hidden" name="product_picture_add" value="x"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> <div id="productUpdate" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <form class="form" enctype="multipart/form-data" method="post"> <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">แก้ไขรูปภาพหลักของ อสังหาริมทัพย์</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="recipient-name" class="control-label">เลือกรูปภาพ <span class="text-muted normal">เป็นรูปภาพที่จะนำมาแทนรูปเดิม</span></label> <input type="file" required class="form-control" multiple="multiple" name="product_photo"> </div> </div> <div class="modal-footer"> <button onclick="return confirm('ยืนยันการแก้ไข ? ')" type="submit" class="btn btn-info"> <span class="glyphicon glyphicon-floppy-disk"></span> บันทึกการแก้ไข </button> <input type="hidden" name="productUpdate" value="x"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> </div> </form> </div> </div> </div> <? $position = $_POST['position']; $gallery_sort_i=1; foreach($position as $k=>$v){ $sql = "Update gallery SET gallery_sort=".$gallery_sort_i." WHERE gallery_id =".$v; $mysqli->query($sql);
$gallery_sort_i++; } ?> <script type="text/javascript"> $( ".row_position" ).sortable({ delay: 150, stop: function() { var selectedData = new Array(); $('.row_position>tr').each(function() { selectedData.push($(this).attr("id")); }); updateOrder(selectedData); } }); function updateOrder(data) { $.ajax({ url:"product_one.php", type:'post', data:{position:data}, success:function(){ } }) } </script>
<script>
Highcharts.chart('view_day', { chart: { type: 'column' }, title: { text: 'สถิติการเข้าชม ต่อวัน ' }, subtitle: { text: 'เฉลี่ย <? echo number_format($All_DayNum); ?> คน ต่อสัปดาห์' }, xAxis: { type: 'category', labels: { rotation: -45, style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }, yAxis: { min: 0, title: { text: 'คน' } }, legend: { enabled: false }, tooltip: { pointFormat: '' }, series: [{ name: 'Population', data: [ ['<? echo $D[6]; ?>', <? echo $DayNow[6]; ?>], ['<? echo $D[5]; ?>', <? echo $DayNow[5]; ?>], ['<? echo $D[4]; ?>', <? echo $DayNow[4]; ?>], ['<? echo $D[3]; ?>', <? echo $DayNow[3]; ?>], ['<? echo $D[2]; ?>', <? echo $DayNow[2]; ?>], ['<? echo $D[1]; ?>', <? echo $DayNow[1]; ?>], ['<? echo $D[0]; ?>', <? echo $DayNow[0]; ?>] ],
dataLabels: { enabled: true, rotation: -90, color: '#FFFFFF', align: 'right', format: '{point.y}', // one decimal y: 10, // 10 pixels down from the top style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }] });
Highcharts.chart('view_month', { chart: { type: 'column' }, title: { text: 'สถิติการเข้าชม ต่อเดือน' }, subtitle: { text: 'ค่าเฉลี่ย <? echo number_format($All_MonNum); ?> ' }, xAxis: { type: 'category', labels: { rotation: -45, style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }, yAxis: { min: 0, title: { text: 'คน' } }, legend: { enabled: false }, tooltip: { pointFormat: '' }, series: [{ name: 'Population', data: [ ['<? echo $YM[6]; ?>', <? echo $SumIncome[6]; ?>], ['<? echo $YM[5]; ?>', <? echo $SumIncome[5]; ?>], ['<? echo $YM[4]; ?>', <? echo $SumIncome[4]; ?>], ['<? echo $YM[3]; ?>', <? echo $SumIncome[3]; ?>], ['<? echo $YM[2]; ?>', <? echo $SumIncome[2]; ?>], ['<? echo $YM[1]; ?>', <? echo $SumIncome[1]; ?>], ['<? echo $YM[0]; ?>', <? echo $SumIncome[0]; ?>] ],
dataLabels: { enabled: true, rotation: -90, color: '#FFFFFF', align: 'right', format: '{point.y}', // one decimal y: 10, // 10 pixels down from the top style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }] }); </script>
<? $product_picture = $_POST['product_picture']; $product_picture_sort_i=1; foreach($product_picture as $k=>$v){ $sql = "Update product_picture SET product_picture_sort=".$product_picture_sort_i." WHERE product_picture_id =".$v; $mysqli->query($sql);
$product_picture_sort_i++; } ?> <script type="text/javascript"> $( ".row_product_picture" ).sortable({ delay: 150, stop: function() { var selected_product_picture = new Array(); $('.row_product_picture>div').each(function() { selected_product_picture.push($(this).attr("id")); }); updateOrder_product_picture(selected_product_picture); } }); function updateOrder_product_picture(data) { $.ajax({ url:"product_one.php", type:'post', data:{product_picture:data}, success:function(){ } }) } </script>
</body> </html>
|