D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
travexx
/
www
/
superadmin
/
Filename :
add-tour.php
back
Copy
<?php include 'cn.php'; session_start(); if(isset($_SESSION['username'])) { if(isset($_POST['submit'])) { // print_r($_POST); // die(); date_default_timezone_set('Asia/Kolkata'); $curdate= date('d-m-Y H:i'); $filename1 = $_FILES['file1']['name']; // Upload file move_uploaded_file($_FILES['file1']['tmp_name'],'tourimage/'.$filename1); if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["pdfFile"])) { // Define the target directory to store uploaded PDF files $targetDirectory = "../itinerary/"; // Generate a unique filename to avoid overwriting existing files $targetFileName = $targetDirectory . uniqid() . '_' . basename($_FILES["pdfFile"]["name"]); // Check if the file is a PDF $fileType = strtolower(pathinfo($targetFileName, PATHINFO_EXTENSION)); if ($fileType == "pdf") { // Move the uploaded file to the target directory if (move_uploaded_file($_FILES["pdfFile"]["tmp_name"], $targetFileName)) { echo "File uploaded successfully."; } else { echo "Error uploading file."; } } else { echo "Only PDF files are allowed."; } } $name = addslashes($_POST['name']); $category = addslashes($_POST['category']); $location = addslashes($_POST['location']); $startingfrom = addslashes($_POST['startingfrom']); $duration = addslashes($_POST['duration']); $dec= $_POST['editor']; $sql = "INSERT INTO `tours`(`name`, `category`, `location`, `startingfrom`, `duration`, `image`, `pdf`, `date`) VALUES ('".$name."','".$category."','".$location."','".$startingfrom."','".$duration."','".$filename1."','".$targetFileName."','".$curdate."') "; $result = $con->query($sql); if($result){ echo "<script type='text/javascript'> location.href='tours.php'; </script>";} else { echo "<script type='text/javascript'> location.href='tours.php'; </script>"; } } ?> <!doctype html><html class="fixed dark" data-style-switcher-options="{'backgroundColor': 'dark'}"> <head> <!-- Basic --> <meta charset="UTF-8"> <title>Travexx</title> <!-- Mobile Metas --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- Web Fonts --> <link href="css?family=Poppins:300,400,500,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css"> <!-- Vendor CSS --> <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"> <link rel="stylesheet" href="vendor/animate/animate.compat.css"> <link rel="stylesheet" href="vendor/font-awesome/css/all.min.css"> <link rel="stylesheet" href="vendor/boxicons/css/boxicons.min.css"> <link rel="stylesheet" href="vendor/magnific-popup/magnific-popup.css"> <link rel="stylesheet" href="vendor/bootstrap-datepicker/css/bootstrap-datepicker3.css"> <!-- Specific Page Vendor CSS --> <!-- Theme CSS --> <link rel="stylesheet" href="css/theme.css"> <!-- Theme Custom CSS --> <link rel="stylesheet" href="css/custom.css"> <!-- Head Libs --> <script src="vendor/modernizr/modernizr.js"></script> <script src="master/style-switcher/style.switcher.localstorage.js"></script> </head> <body> <section class="body"> <!-- start: header --> <?php include("header.php"); ?> <!-- end: header --> <div class="inner-wrapper"> <!-- start: sidebar --> <?php include("leftnav.php"); ?> <!-- end: sidebar --> <section role="main" class="content-body card-margin"> <header class="page-header"> <h2>Add Tour</h2> <div class="right-wrapper text-end"> <ol class="breadcrumbs"> <li> <a href="index.php"> <i class="bx bx-home-alt"></i> </a> </li> <li><span>Add Tour</span></li> </ol> <a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fas fa-chevron-left"></i></a> </div> </header> <!-- start: page --> <div class="row"> <div class="col-lg-12"> <section class="card"> <header class="card-header"> <div class="card-actions"> <a href="#" class="card-action card-action-toggle" data-card-toggle=""></a> </div> <h2 class="card-title">Add Tour</h2> </header> <form action="" method="post" enctype="multipart/form-data"> <div class="card-body"> <div class="row form-group pb-3"> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Name</label> <input type="text" class="form-control" name="name" placeholder="" required> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Category</label> <select name="category" class="form-control"> <option value="Weekend Departures">Weekend Departures</option> <option value="Daily Departures">Daily Departures</option> <option value="Explore India">Explore India</option> </select> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Location</label> <input type="text" class="form-control" name="location" placeholder="" required> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Starting From</label> <input type="text" class="form-control" name="startingfrom" placeholder="" required> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Duration</label> <input type="text" class="form-control" name="duration" placeholder="" required> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">Image</label> <input type="file" class="form-control" name="file1" id="file1" > </div> </div> <div class="col-lg-4"> <div class="form-group"> <label class="col-form-label" for="formGroupExampleInput">PDF URL</label> <input type="file" name="pdfFile" id="pdfFile" accept=".pdf" required class="form-control"> </div> </div> </div> </div> <footer class="card-footer text-end"> <center> <button class="mb-1 mt-1 me-1 btn btn-success" name="submit">Submit</button></center> </footer> </form> </section> </div> </div> <!-- end: page --> </section> </div> <?php include("rightnav.php"); ?> </section> <!-- Vendor --> <script src="vendor/jquery/jquery.js"></script> <script src="vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script> <script src="vendor/jquery-cookie/jquery.cookie.js"></script> <script src="vendor/popper/umd/popper.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script> <script src="vendor/common/common.js"></script> <script src="vendor/nanoscroller/nanoscroller.js"></script> <script src="vendor/magnific-popup/jquery.magnific-popup.js"></script> <script src="vendor/jquery-placeholder/jquery.placeholder.js"></script> <!-- Specific Page Vendor --> <!-- Theme Base, Components and Settings --> <script src="js/theme.js"></script> <!-- Theme Custom --> <script src="js/custom.js"></script> <!-- Theme Initialization Files --> <script src="js/theme.init.js"></script> <!-- Analytics to Track Preview Website --> </body> </html> <?php } else { header("location:login.php"); } ?>