Your IP : 216.73.216.86


Current Path : /home/emeraadmin/www/4d695/
Upload File :
Current File : /home/emeraadmin/www/4d695/submit_service.php.tar

home/emeraadmin/public_html/pages/taskprovider/submit_service.php000064400000002567151677421560021500 0ustar00<?php


require_once '../../Classes/Service.php';
require_once '../../Service/ServiceService.php';

function validate_decimal($value) {
    if (is_numeric($value)) {
        return (float) $value;
    }
    return NULL; // Default to NULL if not a valid number
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name = $_POST['name'];
    $region = $_POST['region'];
    $address_line1 = $_POST['address_line1'];
    $address_line2 = $_POST['address_line2'];
    $suburb = $_POST['suburb'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $postal_code = $_POST['postal_code'];
    $country = $_POST['country'];
    //decimal value of latitude and longitude
    $latitude = isset($_POST['latitude']) ? validate_decimal($_POST['latitude']) : NULL;
    $longitude = isset($_POST['longitude']) ? validate_decimal($_POST['longitude']) : NULL;
    $created_at = date('Y-m-d H:i:s');
    $updated_at = date('Y-m-d H:i:s');

    $serviceService = new ServiceService();
    
    $service = new Service("", $name, $region, $address_line1, $address_line2, $suburb, $city, $state, $postal_code, "Australia", "", "", "", "", $created_at, $updated_at);

    if ($serviceService->addService($service)) {
        echo "Service added successfully!";
    } else {
        echo "Failed to add service.";
    }
} else {
    echo "Invalid request method.";
}
?>
home/emeraadmin/public_html/pages/emeraadmin/submit_service.php000064400000002561151677422000021045 0ustar00<?php


require_once '../../Classes/Service.php';
require_once '../../Service/ServiceService.php';

function validate_decimal($value) {
    if (is_numeric($value)) {
        return (float) $value;
    }
    return NULL; // Default to NULL if not a valid number
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name = $_POST['name'];
    $region = $_POST['region'];
    $address_line1 = $_POST['address_line1'];
    $address_line2 = $_POST['address_line2'];
    $suburb = $_POST['suburb'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $postal_code = $_POST['postal_code'];
    $country = $_POST['country'];
    //decimal value of latitude and longitude
    $latitude = isset($_POST['latitude']) ? validate_decimal($_POST['latitude']) : NULL;
    $longitude = isset($_POST['longitude']) ? validate_decimal($_POST['longitude']) : NULL;
    $created_at = date('Y-m-d H:i:s');
    $updated_at = date('Y-m-d H:i:s');

    $serviceService = new ServiceService();
    $service = new Service("", $name, $region, $address_line1, $address_line2, $suburb, $city, $state, $postal_code, "Australia", "", "", "", "", $created_at, $updated_at);

    if ($serviceService->addService($service)) {
        echo "Service added successfully!";
    } else {
        echo "Failed to add service.";
    }
} else {
    echo "Invalid request method.";
}
?>