Server IP : 162.214.80.37 / Your IP : 216.73.216.68 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/imyrqtmy/public_html/dspublicschoolgzb/AdminPanel/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include'include/connection.php';?> <!DOCTYPE html> <html> <head> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css"> <link rel="stylesheet" href="https://sweetalert.js.org/assets/css/app.css"> <script src="https://sweetalert.js.org/assets/sweetalert/sweetalert.min.js"></script> <style type="text/css"> /*.swal-title { font-size: 100px; } .swal-button,.swal-text { font-size: 50px; } .swal-modal { width: 80%; padding:50px; }*/ </style> </head> <body> <?php if(isset($_POST['brand'])) { $path=""; $id=$_POST['id']; $title=$_POST['name']; $img=$_FILES['image1']['name']; if($img=="") { $newFilePath=$_POST['image']; } else { $filename = $_FILES['image1']['name']; $tmp=$_FILES['image1']['tmp_name']; date_default_timezone_set('Asia/Kolkata'); $currentTime = date( 'Ymd-His', time () ); $info = pathinfo($filename); $file_name = basename($filename,'.'.$info['extension']); $ext = pathinfo($filename, PATHINFO_EXTENSION); //Setup our new file path $newFilePath = "./uploads/" .$file_name. $currentTime.".".$ext; $mf=move_uploaded_file($tmp,$path.$newFilePath); } $sql="UPDATE brand SET brand_name='$title',image='$newFilePath' WHERE id='$id'"; if(mysqli_query($db,$sql) or die (mysqli_error($db))) { ?> <script> swal({ title: "Brand Updated!", text: "", type: "success" }).then(function() { window.location = "viewbrand.php"; }); </script> <?php } else { ?> <script> swal({ title: "Sorry!", text: "Something went wrong! Please try again", type: "error" }).then(function() { window.location = "addbrand.php"; }); </script> <?php } } if(isset($_POST['model'])) { $path=""; $id=$_POST['id']; $brand=$_POST['brand']; $title=$_POST['name']; $img=$_FILES['image1']['name']; if($img=="") { $newFilePath=$_POST['image']; } else { $filename = $_FILES['image1']['name']; $tmp=$_FILES['image1']['tmp_name']; date_default_timezone_set('Asia/Kolkata'); $currentTime = date( 'Ymd-His', time () ); $info = pathinfo($filename); $file_name = basename($filename,'.'.$info['extension']); $ext = pathinfo($filename, PATHINFO_EXTENSION); //Setup our new file path $newFilePath = "./uploads/" .$file_name. $currentTime.".".$ext; $mf=move_uploaded_file($tmp,$path.$newFilePath); } $sql="UPDATE model SET brand_id='$brand',model_name='$title',image='$newFilePath' WHERE id='$id'"; if(mysqli_query($db,$sql) or die (mysqli_error($db))) { ?> <script> swal({ title: "Model Updated!", text: "", type: "success" }).then(function() { window.location = "viewmodel.php"; }); </script> <?php } else { ?> <script> swal({ title: "Sorry!", text: "Something went wrong! Please try again", type: "error" }).then(function() { window.location = "addmodel.php"; }); </script> <?php } } ?> </body> </html>