| Current Path : /home/emeraadmin/public_html/4d695/ |
| Current File : /home/emeraadmin/public_html/4d695/submit_service.php.tar |
home/emeraadmin/public_html/pages/taskprovider/submit_service.php 0000644 00000002567 15167742156 0021500 0 ustar 00 <?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.php 0000644 00000002561 15167742200 0021045 0 ustar 00 <?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.";
}
?>