H69UNtblNBNpha2dtB1Odn8qYp1Qk5NK2gi7yfceofo9N
/
home
/
ymswebso
/
public_html
/
projectac
/
sitecms
/
process-update
/
Nama File / Folder
Size
Action
update-news-event.php
2.839KB
Hapus
Edit
Rename
update-slider-status.php
0.706KB
Hapus
Edit
Rename
update-sort-page.php
0.667KB
Hapus
Edit
Rename
update-video.php
0.676KB
Hapus
Edit
Rename
<=Back
<?php ob_start(); ?> <?php include("../includes/session.php"); ?> <?php include("../includes/login-verify.php"); ?> <?php include("../includes/printmsg.php"); ?> <?php include("../includes/extra-vars.php"); ?> <?php include("../includes/connection.php"); ?> <?php ///// code start here ///// // define variables and set to empty values if ($_SERVER["REQUEST_METHOD"] == "POST") { $newsevent_id = form_fields($_POST["newsevent_id"]); $news_title = form_fields($_POST["news_title"]); $posted_by = form_fields($_POST["posted_by"]); $news_time = form_fields($_POST["news_time"]); $news_ampm = form_fields($_POST["news_ampm"]); $posted_date = form_fields($_POST["datepicker"]); $news_description_replaced = str_replace("../",'/',$_POST["news_description"]); $news_description = htmlspecialchars($news_description_replaced); $news_or_event = form_fields($_POST["news_or_event"]); $img_exist = form_fields($_POST["img_exist"]); $remote_ip = $ip_address; $status = form_fields($_POST["status"]); $modified = $today; } function form_fields($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = mysql_real_escape_string($data); return $data; } /////////////// creating slug ////////////////// $slug_value = $_POST["news_title"]; include("../slug.php"); /////////////////////////////////////////////// ///////// fetching the file extension with $imageFileType //////////// $target_dir = "../../uploaded/image/"; $target_file = $target_dir . basename($_FILES["news_img"]["name"]); $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); ////////////////////////////////////////////////// $rand_number = rand(); $file_name = $_FILES['news_img']['name']; $output_file = str_replace(" ","",$file_name); $new_file_name = $rand_number."_".$output_file; $path = "../../uploaded/image/".$new_file_name; if($imageFileType=="jpg" || $imageFileType=="jpeg" || $imageFileType=="gif" || $imageFileType=="png" || $imageFileType=="JPG" || $imageFileType=="JPEG" || $imageFileType=="GIF" || $imageFileType=="PNG") { move_uploaded_file($_FILES['news_img']['tmp_name'], $path); $news_img = $new_file_name; $img_exist_path = "../../uploaded/image/".$img_exist; !unlink($img_exist_path); } else { $news_img = $img_exist; } $sql = ("update news_events set news_title = '$news_title', news_slug = '$final_slug', posted_by = '$posted_by', news_time = '$news_time', news_ampm = '$news_ampm', posted_date = '$posted_date', news_description = '$news_description', news_img = '$news_img', news_or_event = '$news_or_event', status = '$status', modified = '$today' where id = '$newsevent_id'"); $result = mysql_query($sql); $_SESSION['msg'] = '<div class="alert alert-success text-center"><strong>The news/event info. has been updated successfully.</strong></div>'; header("location: ../manage-news-events?id=$newsevent_id&action=edit"); ?> <?php ob_flush(); ?>
Liking