D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ipuco
/
public_html
/
superadmin
/
Filename :
sub-categories-add.php
back
Copy
<?php ob_start(); session_start(); include('include/connection.php'); $emailid = $_SESSION['emailid']; $adminid = $_SESSION['id']; $per = mysqli_query($conn, "select * from admin where id='" . $adminid . "'"); $perq1 = mysqli_fetch_array($per); if (!(isset($_SESSION['emailid']) && $_SESSION['emailid'] != '')) { header("Location: index.php"); } if (isset($_POST['submit'])) { date_default_timezone_set('Asia/Kolkata'); function string_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } $file_name1 = $_FILES['image1']['name']; $random_digit1 = rand(0000, 9999); $new_file_name1 = $random_digit1 . $file_name1; $path1 = "upload/" . $new_file_name1; copy($_FILES['image1']['tmp_name'], $path1); $file_name2 = $_FILES['image2']['name']; $random_digit2 = rand(0000, 9999); $new_file_name2 = $random_digit2 . $file_name2; $path2 = "upload/" . $new_file_name2; copy($_FILES['image2']['tmp_name'], $path2); $menu_name = $_POST['menu_name']; $service_heading = $_POST['service_heading']; $editor2 = addslashes($_POST['editor2']); $editor1 = addslashes($_POST['editor1']); $seotitle = $_POST['seotitle']; $metadescription = $_POST['metadescription']; $metakeyword = $_POST['metakeyword']; $newtitle = string_limit_words($menu_name, 6); $urltitle = preg_replace('/[^a-z0-9]/i', ' ', $newtitle); $newurltitle = str_replace(" ", "-", $newtitle); $newurltitle1 = str_replace("&", "and", $newurltitle); $newurltitle2 = str_replace(".", "dot", $newurltitle1); $newurltitle3 = str_replace("/", "dot", $newurltitle2); $url = strtolower($newurltitle3); $seo_tag = trim(addslashes($_POST['seo_tag'])); if (mysqli_query($conn, "insert into subcategory values('','$menu_name','$service_heading','$editor2','$editor1','$new_file_name2','$new_file_name1','$seotitle','$metadescription','$metakeyword','$url','$seo_tag')")) { ?> <script type="text/javascript"> //alert("Data Inserted Successfully"); window.location = "sub-categories.php"; </script> <?php } else { ?> <script type="text/javascript"> //alert("Error! Data Not Inserted"); window.location = "sub-categories.php"; </script><?php echo mysql_error(); } } ?>