MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
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 (0750) :  /home2/imyrqtmy/public_html/leadriding/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/leadriding/vendor_add.php
<?php
session_start();
include 'Admin/Includes/db.php';
 // include'../compression.php';
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
?>
<!DOCTYPE html>
<html>
<?php include 'include/head.php'; ?>
<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>
<body>
    	<div class="main-wrapper">
<?php
// $uid = $_SESSION["userId"];

 date_default_timezone_set('Asia/Kolkata');
 $cudate = date("Y-m-d") ;

extract($_POST);

$allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo']['name'];
                                        if($_FILES['do_photo']['error'] > 0) 
                                        {    
                                           $fgr='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo"];
                                         $thumb =  $_FILES['do_photo']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr = $thumb;
                                            
                                     }
                                     
                                     $allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo1']['name'];
                                        if($_FILES['do_photo1']['error'] > 0) 
                                        {    
                                           $fgr1='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo1"];
                                         $thumb =  $_FILES['do_photo1']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo1']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr1 = $thumb;
                                            
                                     }
                                     
                                     $allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo2']['name'];
                                        if($_FILES['do_photo2']['error'] > 0) 
                                        {    
                                           $fgr2='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo2"];
                                         $thumb =  $_FILES['do_photo2']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo2']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr2 = $thumb;
                                            
                                     }
                                     
                                     $allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo3']['name'];
                                        if($_FILES['do_photo3']['error'] > 0) 
                                        {    
                                           $fgr3='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo3"];
                                         $thumb =  $_FILES['do_photo3']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo3']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr3 = $thumb;
                                            
                                     }
                                     
                                     $allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo4']['name'];
                                        if($_FILES['do_photo4']['error'] > 0) 
                                        {    
                                           $fgr4='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo4"];
                                         $thumb =  $_FILES['do_photo4']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo4']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr4 = $thumb;
                                            
                                     }
                                     
                                      $allowed_type = array('gif','png','jpg','jpeg');
    
                                        //doctor photo
                                        $dr_photo =  $_FILES['do_photo5']['name'];
                                        if($_FILES['do_photo5']['error'] > 0) 
                                        {    
                                           $fgr5='';
                                            //echo "<script>alert('no aviyu');</script>";
                                          }else{
                                
                                             // include("compression.php");
                                         $thumb = $_FILES["do_photo5"];
                                         $thumb =  $_FILES['do_photo5']['name'];
                                         @$thumbpath = "vendor/". $thumb;
                                         move_uploaded_file($_FILES['do_photo5']['tmp_name'], @$thumbpath);
                                            // compress($thumbpath, $thumbpath, 90);
                        $fgr5 = $thumb;
                                            
                                     }
    

$sub1 = implode(',', $sub);

    $single_user = "SELECT * FROM `tbl_vendore` WHERE email ='$email'";
	 $single_user_r = mysqli_query($con,$single_user);
	 $numrow = mysqli_num_rows($single_user_r);
	 if($numrow > 0)
	 {
	 		
    		echo "<script>;
      alert('This email id is already registered ');
                window.location.href='register.php';
                </script>";
	 }
    else
    {

        $sqle = "select * from tbl_package where id='$pak'  ";
        $sql_r = mysqli_query($con, $sqle) or die(mysqli_error($con));
        $mar = mysqli_fetch_assoc($sql_r);
        $amt = $mar['mamt'];
         $da = $mar['da'];
         $pn = $mar['name'];
        
         $cudate;
        
         $edate = date('Y-m-d', strtotime($cudate. ' + '.$da.'days'));
        
       
        
        $a = ($amt*18);
        $a1 = ($a/100);
        $a2 = round($a1);
        $fa = $amt + $a2 ;
        $SQL = "INSERT INTO tbl_vendore set name='$name',cname='$cname',email='$email',phone='$phone',address='$add',pincode='$pincode',city='$city',wh_no='$whno',adhar_img='$fgr',pan_img='$fgr1',
        gst_img='$fgr2',profile_photo='$fgr3',photo1='$fgr4',photo2='$fgr5',categorie='$cat',sub_categorie='$sub1',package='$pak',working_area='$working_area',relationship_manger='$relationship_manger',password='$pass',ptype='$ptype',add_date='$cudate',end_date='$edate'	
        ";
    
        if($ptype == 'cash' || $ptype == 'cheque')
        {
         
             if ($con->query($SQL) === TRUE) {
                 
                                 $html_message .= '<p> Hello, welcome to Leadriding.com </p>';
                                 $html_message  .=   '<p>Congratulations, Your account have been submitted successfully.</p>';
                                 $html_message  .=   '<p> Your Account Details are following:</p>';
                                 
                                 
                                  $html_message  .=   '<p>Customer Name :'.$name.'</p>';
                                  $html_message  .=   '<p>Business Name :'.$cname.'</p>';
                                  $html_message  .=   '<p>Package Name :'.$pn.'</p>';
                                  $html_message  .=   '<p>Payment Type :'.$ptype.'</p>';
                                 
                                  $html_message  .=   '<p>End Date : '. $edate .'</p>';
                                 
                                    $html_message  .=   '<p>Thanks</p>';
                                  
                                   $html_message  .=   '<p>LeadRiding Media Pvt. Ltd.</p>';
                                 
                                  
          
                $to = $email;
                // $to ="shanudev515@gmail.com";
                 $subject = "Vendor Registered";
                 
                 $header = "MIME-Version: 1.0\r\n";
                 $header .= "Content-type: text/html\r\n";
                 
                 $retval = mail ($to,$subject,$html_message,$header);
           
            
          echo "<script>;
            alert('Your Data Added Succesfully');
    								window.location.href='signup.php';
    								</script>";
    
    	 }
           else
           {
              echo "<script>;
               alert('Your category Not Added ');
                        window.location.href='signup.php';
                        </script>";
           }
            
        }
        else if($ptype == 'online')
        {
            // echo "on";
            
            if ($con->query($SQL) === TRUE) {
                
                $last_id = $con->insert_id;
            
            //payment online
    // $apiKey = '099eb0cd-02cf-4e2a-8aca-3e6c6aff0399';
    // $merchantId = 'PGTESTPAYUAT';
    // $keyIndex =1;
    $_SESSION['userid'] = $last_id;
    $_SESSION['vn'] = $name;
    $_SESSION['pn'] = $pn;
    $_SESSION['edate'] = $edate;
    $_SESSION['bn'] = $cname;


    $apiKey = '71289d59-9ce8-427d-975b-61f752d67218';
    $merchantId = 'M22VVI7PSI8GA';
    $keyIndex =3;
    $userid = $last_id;
    $TransactionID= "PAYMENTLEADRIDE".rand(000000,999999);
    
    $paymentData = array(
        'merchantId' => $merchantId,
        'merchantTransactionId' =>$TransactionID,
        "merchantUserId"=>"LEADRIDEUSER_".$userid,
        'amount' => $fa*100, // Amount in paisa (10 INR)
        'redirectUrl'=>"https://leadriding.com/sucess.php",
        'redirectMode'=>"POST",
        'callbackUrl'=>"https://leadriding.com/sucess.php",
        "mobileNumber"=>$phone,
        "paymentInstrument"=> array(    
        "type"=> "PAY_PAGE",
      )
    );
    
    $jsonencode = json_encode($paymentData);
     $payloadMain = base64_encode($jsonencode);
     
     
    $payload = $payloadMain . "/pg/v1/pay" . $apiKey;
    $sha256 = hash("sha256", $payload);
    $final_x_header = $sha256 . '###' . $keyIndex;
    $request = json_encode(array('request'=>$payloadMain));
    
    $curl = curl_init();
    curl_setopt_array($curl, [
      CURLOPT_URL => "https://api.phonepe.com/apis/hermes/pg/v1/pay",
    // CURLOPT_URL => "https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
       CURLOPT_POSTFIELDS => $request,
      CURLOPT_HTTPHEADER => [
        "Content-Type: application/json",
         "X-VERIFY: " . $final_x_header,
         "accept: application/json"
      ],
    ]);
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
     
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
       $res = json_decode($response);
       
    //   echo "<pre>";
    //   print_r($res);
    //   echo "<pre>";
     
    if(isset($res->success) && $res->success=='1'){
    $paymentCode=$res->code;
    $paymentMsg=$res->message;
    $payUrl=$res->data->instrumentResponse->redirectInfo->url;
     
    //  echo "<a href='".$payUrl."' class='btn btn-primary  login-btn'>pay now</a>";
     ?>
     <div class="row" style="margin-top: 130px;">
    
    					<div class="col-md-6 col-lg-6 mx-auto">
    
    						<div class="login-wrap">
    						    
    						    <a href="<?php echo $payUrl; ?>">
    
    								<button class="btn btn-primary w-100 login-btn" type="button">Pay Now</button>
                                </a>
    						</div>
    
    					</div>
    
    				</div>
     <?php
    ?>
     
     <script>
             swal({
                    title: "Data Add successfully !",
                    text: "",
                    type: "success",
                    icon: "success"
                }).then(function() {
                    // window.location = "$a";
                });
             </script>
    
    
     <?php
    
    }
    }
    
            
           
    
    	 }
           else
           {
              echo "<script>;
               alert('Your Data Not Added ');
                        window.location.href='signup.php';
                        </script>";
           }
        }
        else
        {
         
             if ($con->query($SQL) === TRUE) {
                 
                 $html_message .= '<p> Hello, welcome to Leadriding.com </p>';
                                 $html_message  .=   '<p>Congratulations, Your account have been submitted successfully.</p>';
                                 $html_message  .=   '<p> Your Account Details are following:</p>';
                                 
                                 
                                  $html_message  .=   '<p>Customer Name :'.$name.'</p>';
                                  $html_message  .=   '<p>Business Name :'.$cname.'</p>';
                                  $html_message  .=   '<p>Package Name :'.$pn.'</p>';
                                  $html_message  .=   '<p>Payment Type : - </p>';
                                 
                                  $html_message  .=   '<p>End Date : '. $edate .'</p>';
                                  
                                  $html_message  .=   '<p>Thanks</p>';
                                  
                                   $html_message  .=   '<p>LeadRiding Media Pvt. Ltd.</p>';
                                 
                                    

                                  
          
                $to = $email;
                // $to ="shanudev515@gmail.com";
                 $subject = "Vendor Registered";
                 
                 $header = "MIME-Version: 1.0\r\n";
                 $header .= "Content-type: text/html\r\n";
                 
                 $retval = mail ($to,$subject,$html_message,$header);
           
            
           echo "<script>;
            alert('Your Data Added Succesfully');
    								window.location.href='signup.php';
    								</script>";
    
    	 }
           else
           {
              echo "<script>;
               alert('Your category Not Added ');
                        window.location.href='signup.php';
                        </script>";
           }
            
        }
    
         
    }


?>
	<!-- Footer -->

	

		<!-- /Footer -->

		

		<!-- Cursor -->

		<div class="mouse-cursor cursor-outer"></div>

		<div class="mouse-cursor cursor-inner"></div>

		<!-- /Cursor -->	

		

	</div>

	

	<!-- jQuery -->

	<script data-cfasync="false" src="../cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script src="assets/js/jquery-3.6.1.min.js"></script>



	<!-- Bootstrap Core JS -->

	<script src="assets/js/bootstrap.bundle.min.js"></script>



	<!-- Fearther JS -->

	<script src="assets/js/feather.min.js"></script>

		

	<!-- Owl Carousel JS -->

	<script src="assets/js/owl.carousel.min.js"></script>

		

	<!-- Fancybox JS -->

	<script src="assets/plugins/fancybox/jquery.fancybox.min.js"></script>



	<!-- select JS -->

	<script src="assets/plugins/select2/js/select2.min.js"></script>

	<script src="assets/plugins/aos/aos.js"></script>



	<!-- Sticky Sidebar JS -->

	<script src="assets/plugins/theia-sticky-sidebar/ResizeSensor.js"></script>

	<script src="assets/plugins/theia-sticky-sidebar/theia-sticky-sidebar.js"></script>



	<!-- Custom JS -->

	<script src="assets/js/script.js"></script>
</body>
</html>

MMCT - 2023