Mini Shell
<?php
include '../db/database.php';
$newstype = $_POST['newstype'];
$news_topic = $_POST['news_topic'];
$topic_detail = $_POST['topic_detail'];
$news_detail = $_POST['news_detail'];
$news_status = $_POST['news_status'];
$user_author = $_POST['user_author'];
//อัพโหลดรูปประจำตัว
if (is_uploaded_file($_FILES['news_images']['tmp_name'])) {
$new_image_name = 'news_'.uniqid().".".pathinfo(basename($_FILES['news_images']['name']), PATHINFO_EXTENSION);
$image_upload_path = "images/".$new_image_name;
move_uploaded_file($_FILES['news_images']['tmp_name'],$image_upload_path);
} else {
$new_image_name = "";
}
$sql = "INSERT INTO `news` (`news_topic`,`topic_detail`,`news_images`,`news_detail`,`news_status`,`new_date`,`newstype_id`,`user_author`) VALUES
('$news_topic','$topic_detail','$new_image_name','$news_detail','$news_status',NOW(),'$newstype','$user_author')";
$result = mysqli_query($link, $sql);
if ($result) {
echo "<script>window.location='news.php';</script>";
} else {
echo "<script>alert('เกิดข้อผิดผลาด ! ไม่สามารถบันทึกข้อมูลได้');window.location='addnews.php';</script>";
}
Zerion Mini Shell 1.0