H69UNtblNBNpha2dtB1Odn8qYp1Qk5NK2gi7yfceofo9N
/
home
/
ymswebso
/
public_html
/
projectac
/
sitecms
/
process-insert
/
Nama File / Folder
Size
Action
insert-attribute.php
2.368KB
Hapus
Edit
Rename
insert-gallery-image.php
1.644KB
Hapus
Edit
Rename
insert-project-category.php
1.718KB
Hapus
Edit
Rename
insert-video-file.php
1.896KB
Hapus
Edit
Rename
<?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") { $attribute_name = form_fields($_POST["attribute_name"]); $attribute_value = form_fields($_POST["attribute_value"]); $attribute_description = form_fields($_POST["attribute_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); $data = mysql_real_escape_string($data); return $data; } /////////////// creating slug ////////////////// $slug_value = $_POST["attribute_value"]; include("../slug.php"); /////////////////////////////////////////////// ///////// fetching the file extension with $imageFileType //////////// $target_dir = "../../uploaded/image/"; $target_file = $target_dir . basename($_FILES["attribute_img"]["name"]); $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); ////////////////////////////////////////////////// $rand_number = rand(); $file_name = $_FILES['attribute_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['attribute_img']['tmp_name'], $path); $attribute_img = $new_file_name; } else { $attribute_img = ""; } $sql = "insert into attributes (attribute_name, attribute_slug, attribute_value, attribute_img, attribute_description, status, modified, created)values('$attribute_name', '$final_slug', '$attribute_value', '$attribute_img', '$attribute_description', '$status', '$modified', '$created')"; $result = mysql_query($sql); $_SESSION['msg'] = '<div class="alert alert-success text-center"><strong>Attribute has been added successfully.</strong></div>'; header("location: ../manage-attributes?attribute_name=$attribute_name"); ?> <?php ob_flush(); ?>