MMCT TEAM
Server IP : 82.112.239.40  /  Your IP : 18.218.129.191
Web Server : LiteSpeed
System : Linux in-mum-web1676.main-hosting.eu 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
User : u641149403 ( 641149403)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u641149403/domains/cabz4you.com/public_html/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u641149403/domains/cabz4you.com/public_html/admin/vendor_ajax.php
<?php
require_once 'lib/core.php';
if(!auth())
{
  exit;
}
//ADDING DATA TO USER AND USER PROFILES

if(isset($_POST['name']))
{
    $name=test_input($_POST['name']);
    $company_name=test_input($_POST['c_name']);
    $email=test_input($_POST['email']);
    $pass=md5(test_input($_POST['password']));
    $contact=test_input($_POST['contact']);
    $state=test_input($_POST['state']);
    $city=test_input($_POST['city']);
    $sql="insert into vendor_login(contact,email,password,status) values('$contact','$email','$pass',1)";
    if($conn->query($sql)===true)
    {
     $last_id = $conn->insert_id;
     $sql="insert into vendor_profile(vendor_id,company_name,full_name,city,state,profile_status) values($last_id,'$company_name','$name','$city','$state','0')";
     if($conn->query($sql)===true)
     {
        echo "ok";
    }
    else
    {
        echo $conn->error;
    }
}
else
{
    echo $conn->error;
}
}

//DELETING STAFF DATA

if(isset($_POST['delete_id']))
{
   $id_d=$_POST["delete_id"];
   $sql="delete from vendor_profiles where u_id=$id_d";
   if($conn->query($sql))
   {
    $sql="delete from vendor_login where id=$id_d";
    if($conn->query($sql))
     echo "success";
 else
     echo "error";
}
else
    echo "error";
}




//UPDATING STAFF DATA

if(isset($_POST["efname"]))
{
    $staff_id=$_POST["edit"];
    $fname=test_input($_POST['efname']);
    $lname=test_input($_POST['elname']);
    $email=test_input($_POST['eemail']);
    $gender=test_input($_POST['egender']);
    $contact=test_input($_POST['econtact']);
    $sql="update user_profiles set f_name='$fname',l_name='$lname',gender='$gender',contact='$contact' where u_id = $staff_id";
    if($conn->query($sql))
    {
      echo "success";
  }
  else
  {
      echo $sql;
  }
  if(isset($_POST['epassword']))
  {
    $password=test_input($_POST['epassword']);
    $password=md5($password);
    $sql="update users set email='$email',password='$password' where id=$staff_id";
    if($conn->query($sql))
    {	

    }
    else
    {
      echo "error2222";
  }
}
else{
    $sql="update users set email='$email' where id=$staff_id";
    if($conn->query($sql))
    {	

    }
    else
    {
      echo "error2222";
  }
}
}


//FETCHING STAFF DETAILS

if(isset($_POST['vendor_details']))
{
    $vendor_type = $_POST['type'];
    if ($vendor_type=='blocked') {
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and up.profile_status in(0) order by id desc";
    }elseif($vendor_type=='minus wallet'){
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and w_amount<0 order by id desc"; 
    }elseif($vendor_type=='wallet'){
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and w_amount>0 order by id desc"; 
    }elseif($vendor_type=='null'){
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and w_amount=0 order by id desc"; 
    }elseif ($vendor_type=='active') {
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and up.profile_status in(1) order by id desc";
    }else{
        $sql = "select * from vendor_login u,vendor_profile up where u.id=up.vendor_id and up.profile_status in(1) order by id desc"; 
    }

    // if($_POST['type']=='blocked'){
    //     $sql="select u.id,u.email,u.timestamp,u.contact,up.commission,up.full_name,up.city,up.state,up.w_amount,up.profile_status,up.pan_on_name,up.pan_no,up.pincode,up.bank_name,up.bank_branch,up.ifsc_code,up.acc_type,up.upi_id,up.qr_code,up.account_no,up.benificiary_name from vendor_login u,vendor_profile up where u.id=up.vendor_id and up.profile_status in(0) order by id desc";
    // }else{
    //     $sql="select u.id,u.email,u.timestamp,u.contact,up.commission,up.full_name,up.city,up.state,up.w_amount,up.profile_status,up.pan_on_name,up.pan_no,up.pincode,up.bank_name,up.bank_branch,up.ifsc_code,up.acc_type,up.upi_id,up.qr_code,up.account_no,up.benificiary_name from vendor_login u,vendor_profile up where u.id=up.vendor_id and up.profile_status in(1) order by id desc";
    // }
    if($result=$conn->query($sql))
    {
        if($result->num_rows>0)
        {

          while($row=$result->fetch_assoc())
          {
            $membership_vendor=$conn->query("SELECT * FROM membership_log WHERE status=1 AND vendor_id='".$row['id']."'");
        if ($membership_vendor->num_rows>0) {
            $row['vendor_type']='<label class="badge badge-success">Prime</label>';
        }else{
            $row['vendor_type']='<label class="badge badge-danger">Not Prime</label>';
        }

            $bookings=$conn->query("select * from bookings where vendor_id='".$row['id']."'");
                $row['total_booking']=$bookings->num_rows;

                $post_bookings=$conn->query("select * from bookings where post_by_id='".$row['id']."'");
                $row['total_post_booking']=$post_bookings->num_rows;
                $row['reg_date']=date("d-m-Y H:i:s",strtotime($row['timestamp']));

             $staff[]=$row;
         }
         echo json_encode($staff);
     }
     else
        echo "unable to fetch data";
}    
}

//FETCHING DATA FOR EDIT MODAL

if(isset($_POST['show_edit_data']))
{
    $id=$_POST['show_edit_data'];
    $sql="select u.id,u.email,up.f_name,up.l_name,up.contact,up.gender from users u,user_profiles up where u.id=up.u_id and u.type=4 and u.id=$id";
    if($result=$conn->query($sql))
    {
        if($result->num_rows>0)
        {

          while($row=$result->fetch_assoc())
          {
             $staff[]=$row;
         }
         echo json_encode($staff);
     }
     else
        echo "unable to fetch data";
}    
}

//verify 
if(isset($_POST['verify_id']) && isset($_POST['contact']))
{
   $id=test_input($_POST["verify_id"]);
   $contact=test_input($_POST["contact"]);
   $sql="update vendor_profile set profile_status=1 where vendor_id=$id";
   $amount = "1000";
   if($conn->query($sql))
   {
    // $sql = $conn->query(SELECT * FROM vendor_profile WHERE vendor_id='$id');
    // $res =mysqli_fetch_array($sql);
    $result = $conn->query("SELECT * FROM vendor_login INNER JOIN vendor_profile ON vendor_profile.vendor_id=vendor_login.id WHERE vendor_login.id='$id'");
    $row = $result->fetch_assoc();
    $contact = $row['contact'];

$msg = "Hi, ".$row['full_name']." 

👏👏Congratulations! 🥳🎉

Your account has been verified successfully. 
Welcome to  cabz4U Taxi  

24x7 Help & Support: 
7830530004, 7830530005

Visit us: 
cabz4you.com";
whatsapp($contact,$msg);

    echo "success";
}
else
    echo "error";
}

?>

MMCT - 2023