H69UNtblNBNpha2dtB1Odn8qYp1Qk5NK2gi7yfceofo9N
/
home
/
ymswebso
/
public_html
/
playmatezoey
/
sitecms
/
process-insert
/
Nama File / Folder
Size
Action
format.php
0.374KB
Hapus
Edit
Rename
insert-gallery-video.php
2.326KB
Hapus
Edit
Rename
insert-image.php
2.168KB
Hapus
Edit
Rename
insert-page.php
3.621KB
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") { $page_type = form_fields($_POST["page_type"]); $rootpage_id = form_fields($_POST["rootpage_id"]); $mainpage_id = form_fields($_POST["mainpage_id"]); $page_order = form_fields($_POST["page_order"]); @$show_in = form_fields($_POST["show_in"]); $page_name = form_fields($_POST["page_name"]); $slug_replaced = preg_replace("/[^a-zA-Z ]/", "", $page_name); $page_slug_output = str_replace(' ', '-', $slug_replaced); $page_slug = strtolower($page_slug_output); $page_description = form_fields($_POST["FCKeditor1"]); $meta_keywords = form_fields($_POST["meta_keywords"]); $meta_description = form_fields($_POST["meta_description"]); $status = form_fields($_POST["status"]); $modified = form_fields($today); $created = form_fields($today); } function form_fields($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ///////// fetching the file extension with $imageFileType //////////// $target_dir = "../../uploaded/image/"; $target_file = $target_dir . basename($_FILES["header_img"]["name"]); $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); ////////////////////////////////////////////////// $rand_number = rand(); $file_name = $_FILES['header_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['header_img']['tmp_name'], $path); $header_img = $new_file_name; } else { $header_img = ""; } if($page_type=="sub") { //$asdfsadf = "add-page?type=sub&rootpage_id=1"; $rootpage_explode = explode('=',$rootpage_id); $rootpage_id = $rootpage_explode[2]; $sql = "insert into page_sub(rootpage_id, mainpage_id, page_order, page_name, page_slug, page_description, meta_keywords, meta_description, header_img, status, modified, created)values('$rootpage_id', '$mainpage_id', '$page_order', '$page_name', '$page_slug', '$page_description', '$meta_keywords', '$meta_description', '$header_img', '$status', '$modified', '$created')"; } elseif($page_type=="main") { $sql = "insert into page_main(rootpage_id, page_order, page_name, page_slug, page_description, meta_keywords, meta_description, header_img, status, modified, created)values('$rootpage_id', '$page_order', '$page_name', '$page_slug', '$page_description', '$meta_keywords', '$meta_description', '$header_img', '$status', '$modified', '$created')"; } else { $sql = "insert into page_root(page_order, show_in, page_name, page_slug, page_description, meta_keywords, meta_description, header_img, status, modified, created)values('$page_order', '$show_in', '$page_name', '$page_slug', '$page_description', '$meta_keywords', '$meta_description', '$header_img', '$status', '$modified', '$created')"; } $result = mysql_query($sql); $_SESSION['msg'] = '<div class="alert alert-success text-center"><strong>The page has been added successfully.</strong></div>'; header("location: ../add-page?type=$page_type&rootpage_id="); ?> <?php ob_flush(); ?>
Liking