MMCT TEAM
Server IP : 82.112.239.40  /  Your IP : 3.22.77.196
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/ajax_distance_fare.php
<?php include 'lib/core.php';


//Show All cities
if($_SERVER['REQUEST_METHOD'] == "GET") {
    if (isset($_GET['show_data'])) {
        $show = "SELECT * FROM distance_fare";
        $result = $conn->query($show);

        if ($result->num_rows > 0) {
            while ($row = $result->fetch_assoc()) {
                $distance[] = $row;
            }
            echo json_encode($distance);
        }
    }
}


if($_SERVER['REQUEST_METHOD'] == "POST") {
    // Adding

    if (isset($_POST['km_from'])) {
        $km_from = $_POST['km_from'];
        $km_to = $_POST['km_to'];
        $sql = $conn->query("INSERT INTO distance_fare(km_from,km_to) VALUES('$km_from','$km_to')");
        $distance_fare_id = $conn->insert_id;
        for($i=0;$i<count($_POST['cab_type_id']);$i++){
            $cab_type_id=$_POST['cab_type_id'][$i];
            $price=$_POST['price'][$i];
            $extra_price=$_POST['extra_price'][$i];
            $sql = $conn->query("INSERT INTO distance_fare_cab(distance_fare_id,cab_typeid,price,extra_price) VALUES('$distance_fare_id','$cab_type_id','$price','$extra_price')");
        }

        if ($sql) {
            echo "Success";
        }
        else {
            echo "Something Wrong";
        }
    }


    //Delete package cities

    if (isset($_POST['delete_id'])) {
        $id = $_POST['delete_id'];

        $query = "DELETE FROM distance_fare WHERE id = " . $id;

        if ($conn->query($query)) {
            echo "Success";
        } else {
            echo "Something Wrong";
        }

    }
}

?>

MMCT - 2023