ok

Mini Shell

Direktori : /home2/selectio/public_html/subamangala/admin/api/
Upload File :
Current File : /home2/selectio/public_html/subamangala/admin/api/bulk-updates.php

<?php include"../config/config.php";

if($_POST['type']=="bulk_attendance"){
    
    // $id = $_POST['assign_id'];
    
    $assign_id = implode(',', $_POST['assign_id']);
    $attendance_type = $_POST['attendance_type'];
    
    // Attendance Type (1=Present, 2=Absent)
    
    if($attendance_type==1){
        $statement = $pdo->prepare("UPDATE tbl_tickets SET attendance=1 WHERE id in (".$assign_id.");");
        $result = $statement->execute();
        $statement_1 = $pdo->prepare("UPDATE tbl_tickets SET trip_status=2 WHERE id in (".$assign_id.");");
        $results = $statement_1->execute();
    }else if($attendance_type==2){
        $statement = $pdo->prepare("UPDATE tbl_tickets SET attendance=2 WHERE id in (".$assign_id.");");
        $result = $statement->execute();
        $statement_1 = $pdo->prepare("UPDATE tbl_tickets SET trip_status=6 WHERE id in (".$assign_id.");");
        $results = $statement_1->execute();
    }
    
    if($results==1)
    	{
    	    $message='Success..';
    	    $error='1';
    	}
    	else
    	{
    	    $message='Failed..';
    	    $error='0';
    	}
    		$datas[] = array('message' => $message, 'error' => $error);                   
            echo $message;
    }

if($_POST['type']=="bulk_cancel"){
    
    $id = $_POST['assign_id'];
    
    $booking_id = implode(',', $_POST['assign_id']);
    
    
        $statement = $pdo->prepare("UPDATE tbl_bookings SET status=2 WHERE id in (".$booking_id.");");
        $result = $statement->execute();
    
    if($result){
        $statement = $pdo->prepare("UPDATE tbl_tickets SET status=2 WHERE booking_id in (".$booking_id.");");
        $results = $statement->execute();
    }
    if($results==1)
    	{
    	    $message='Success..';
    	    $error='1';
    	}
    	else
    	{
    	    $message='Failed..';
    	    $error='0';
    	}
    		$datas[] = array('message' => $message, 'error' => $error);                   
            echo $message;
    }
?>

Zerion Mini Shell 1.0