MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.1
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/insertt.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['addbrand']))
{
    $path="";

    $title=$_POST['name'];

    $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="insert into brand(brand_name,image) values('$title','$newFilePath')"; 
    $dsa=mysqli_query($db,$sql) or die (mysqli_error($db));
    if($dsa)
    {
        ?>
       <script>
         swal({
                title: "Brand Added!",
                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['addmodel']))
{
    $path="";

    $title=$_POST['name'];
    $bid=$_POST['brand'];

    $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="insert into model(model_name,image,brand_id) values('$title','$newFilePath','$bid')";
    $sads=mysqli_query($db,$sql) or die (mysqli_error($db)); 
    if($sads)
    {
        ?>
       <script>
         swal({
                title: "Model Added!",
                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['service']))
{
    $path="";
    $brand=$_POST['brand'];
    $model=$_POST['model'];
    $year=$_POST['year'];
    $city=$_POST['city'];

    $title=$_POST['name'];
    $desc=$_POST['desc'];
    $price=$_POST['price'];

    
    $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="insert into service_data(Title,Brand,City,Model,Year,Image,Description,Price) values('$title','$brand','$city','$model','$year','$newFilePath','$desc','$price')"; 
    $das=mysqli_query($db,$sql) or die (mysqli_error($db));
    if($das)
    {
        ?>
       <script>
         swal({
                title: "Service Added!",
                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 = "addservice.php";
            });
       </script> <?php 
    }       
    
}

if(isset($_POST['cat']))
{
 
    $category=mysqli_real_escape_string($db,$_POST['category']);

    $sql="insert into category_data(Category) values('$category')"; 
    if(mysqli_query($db,$sql) or die (mysqli_error($db)))
    {
        ?>
       <script>
         swal({
                title: "Category Added!",
                text: "",
                type: "success"
            }).then(function() {
                window.location = "viewcategory.php";
            });
       </script> <?php
    }
    else
    {
        ?>
       <script>
         swal({
                title: "Sorry!",
                text: "Something went wrong! Please try again",
                type: "error"
            }).then(function() {
                window.location = "addcategory.php";
            });
       </script> <?php 
    }       
    
}

if(isset($_POST['subcat']))
{
 
    $subcategory=mysqli_real_escape_string($db,$_POST['subcategory']);
    $category=$_POST['category'];

    $sql="insert into subcategory_data(Cid,SubCategory) values('$category','$subcategory')"; 
    if(mysqli_query($db,$sql) or die (mysqli_error($db)))
    {
        ?>
       <script>
         swal({
                title: "Sub Category Added!",
                text: "",
                type: "success"
            }).then(function() {
                window.location = "viewsubcategory.php";
            });
       </script> <?php
    }
    else
    {
        ?>
       <script>
         swal({
                title: "Sorry!",
                text: "Something went wrong! Please try again",
                type: "error"
            }).then(function() {
                window.location = "addsubcategory.php";
            });
       </script> <?php 
    }       
    
}

if(isset($_POST['doc']))
{
    $reg_id=$_POST['code'];
    $email=$_POST['email'];
    $duration=$_POST['duration'];
    $amount=$_POST['amount'];
    $fname=$_POST['fname'];
    $age=$_POST['age'];
    $address=$_POST['address'];
    $purpose=$_POST['purpose'];
    $wit1=$_POST['wit1'];
    $wit_phn1=$_POST['wit_phn1'];
    $rel1=$_POST['rel1'];
    $wit2=$_POST['wit2'];
    $wit_phn2=$_POST['wit_phn2'];
    $rel2=$_POST['rel2'];
    $aadhar_no=$_POST['aadhar_no'];
    $pan_no=$_POST['pan_no'];
    $acc_no=$_POST['acc_no'];
    $ifsc=$_POST['ifsc_code'];
    $branch=$_POST['branch'];
    $bank=$_POST['bank'];
    $chq_no=$_POST['chq_no'];

    date_default_timezone_set("Asia/Kolkata");
    $date=date("d-m-Y / h:i:s a");

    $filename = $_FILES['user_photo']['name'];
    $tmp=$_FILES['user_photo']['tmp_name'];

    date_default_timezone_set('Asia/Kolkata');
    $currentTime = date( 'Y-m-d--H-i-s', 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;
    
    compressImage($_FILES['user_photo']['tmp_name'],$newFilePath,60);
    $mf=move_uploaded_file($tmp,$newFilePath);

    

    $filename1 = $_FILES['aadhar_photo']['name'];
    $tmp1=$_FILES['aadhar_photo']['tmp_name'];

    date_default_timezone_set('Asia/Kolkata');
    $currentTime1 = date( 'Y-m-d--H-i-s', time () );

    $info1 = pathinfo($filename1);
    $file_name1 =  basename($filename1,'.'.$info1['extension']);
 
    $ext1 = pathinfo($filename1, PATHINFO_EXTENSION);

    //Setup our new file path
    $newFilePath1 = "./uploads/" .$file_name1. $currentTime1.".".$ext;
    
    compressImage($_FILES['aadhar_photo']['tmp_name'],$newFilePath1,60);
    $mf1=move_uploaded_file($tmp1,$newFilePath1);


    $filename2 = $_FILES['pan_photo']['name'];
    $tmp2=$_FILES['pan_photo']['tmp_name'];

    date_default_timezone_set('Asia/Kolkata');
    $currentTime2 = date( 'Y-m-d--H-i-s', time () );

    $info2 = pathinfo($filename2);
    $file_name2 =  basename($filename2,'.'.$info2['extension']);
 
    $ext2 = pathinfo($filename2, PATHINFO_EXTENSION);

    //Setup our new file path
    $newFilePath2 = "./uploads/" .$file_name2. $currentTime2.".".$ext2;
    
    compressImage($_FILES['pan_photo']['tmp_name'],$newFilePath2,60);
    $mf2=move_uploaded_file($tmp2,$newFilePath2);




    $filename3 = $_FILES['cheque_photo']['name'];
    $tmp3=$_FILES['cheque_photo']['tmp_name'];

    date_default_timezone_set('Asia/Kolkata');
    $currentTime3 = date( 'Y-m-d--H-i-s', time () );

    $info3 = pathinfo($filename3);
    $file_name3 =  basename($filename3,'.'.$info3['extension']);
 
    $ext3 = pathinfo($filename3, PATHINFO_EXTENSION);

    //Setup our new file path
    $newFilePath3 = "./uploads/" .$file_name3. $currentTime3.".".$ext3;
    
    compressImage($_FILES['cheque_photo']['tmp_name'],$newFilePath3,60);
    $mf3=move_uploaded_file($tmp3,$newFilePath3);




    $filename4 = $_FILES['sign_photo']['name'];
    $tmp4=$_FILES['sign_photo']['tmp_name'];

    date_default_timezone_set('Asia/Kolkata');
    $currentTime4 = date( 'Y-m-d--H-i-s', time () );

    $info4 = pathinfo($filename4);
    $file_name4 =  basename($filename4,'.'.$info4['extension']);
 
    $ext4 = pathinfo($filename4, PATHINFO_EXTENSION);

    //Setup our new file path
    $newFilePath4 = "./uploads/" .$file_name4. $currentTime4.".".$ext4;
    
    compressImage($_FILES['sign_photo']['tmp_name'],$newFilePath4,60);
    $mf4=move_uploaded_file($tmp4,$newFilePath4);


    
    $sql="UPDATE login_data SET Duration='$duration', Amount='$amount', Fname='$fname', Age='$age', Address='$address', Purpose='$purpose' , Wit1='$wit1', Wit_phn1='$wit_phn1', Rel1='$rel1' ,  Wit2='$wit2', Wit_phn2='$wit_phn2', Rel2='$rel2' ,Aadhar_No='$aadhar_no',PAN_No='$pan_no',Acc_No='$acc_no',IFSC_Code='$ifsc',Branch='$branch',Bank='$bank', Chq_No='$chq_no',User_Photo='$newFilePath',Aadhar_Photo='$newFilePath1',PAN_Photo='$newFilePath2', Cheque_Photo='$newFilePath3', Sign_Photo='$newFilePath4' ,Loan_Status='1',Loan_Date='$date'  WHERE Email='$email' AND Reg_id='$reg_id'";
    $run=mysqli_query($db,$sql) or die(mysqli_error($db));
    
    if($run)
    {
        
        echo"<script>
         swal({
                title: 'Successfully!',
                text: 'Your Document Details completed!',
                type: 'success',
                icon: 'success'
            }).then(function() {
                window.location = 'try.php';
            });
       </script>";
    }
    else
    {
        echo"<script>
         swal({
                title: 'Something went wrong!',
                text: 'Please enter valid details !',
                type: 'error',
                icon: 'error'
            }).then(function() {
                window.location = 'doc.php';
            });
       </script>";
    }
}


?>
</body>
</html>














<?php 

if (isset($_POST['submit'])) 
	{
		$n=$_POST['name'];
		$p=$_POST['phone'];
		$e=$_POST['email'];
		
		$ins="insert into login_data(Name,PhoneNo,Email) values('$n','$p','$e','$m','$s')";
		$que=mysqli_query($db,$ins) or die('error');
	    if ($que) 
	    {
	    	
	     ?>
            <script type="text/javascript">alert("Enquiry sent Successfully !");
            </script>
	    <?php
	    echo"<script>location.href='main.php';</script>";
	    }
	    else 
	    { ?>
           <script type="text/javascript">alert("Something went wrong !");</script> 
	    <?php
	    echo"<script>location.href='main.php';</script>";
	    }
	}

	// Compress image
function compressImage($source, $destination, $quality) {

  $info = getimagesize($source);

  if ($info['mime'] == 'image/jpeg') 
    $image = imagecreatefromjpeg($source);

  elseif ($info['mime'] == 'image/jpg') 
    $image = imagecreatefromjpg($source);

  elseif ($info['mime'] == 'image/png') 
    $image = imagecreatefrompng($source);

  elseif ($info['mime'] == 'video/mp4') 
    $image = imagecreatefrommp4($source);

  imagejpeg($image, $destination, $quality);

}

?>

MMCT - 2023