.jpg)
.jpg)
.jpg)



moto sands for yes yuppee
1,150.00 omr
include_once "settings.php"; // Ensure this file sets up $connessione (database connection)
//include 'ar.php';
if(isset($_GET["accessCat"])) $_SESSION["ad"]=$_GET["accessCat"]; //for the cntrol to dsply ads && (HIDE) not to display the cars brands logos
$bId = htmlspecialchars($_GET['bId'] ?? $_GET['bId']);
// Check if the 'accessCat' GET parameter is set
$accessCat = isset($_GET['accessCat']) ? $_GET['accessCat'] : '';
// Define available categories and their fields
$categories = $_SESSION['translations']['category'];
// Process form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$category = $connessione->real_escape_string($_POST['accessCat'] ?? $_GET['accessCat']);
$title = $connessione->real_escape_string($_POST['title'] ?? '');
$berid = $connessione->real_escape_string($_POST['berid'] ?? '');
$hetef = $connessione->real_escape_string($_POST['hetef'] ?? '');
$country = $connessione->real_escape_string($_POST['country'] ?? '');
$location_city = $connessione->real_escape_string($_POST['location_city'] ?? '');
$price = $connessione->real_escape_string($_POST['price'] ?? '');
$el3omla = $connessione->real_escape_string($_POST['el3omla'] ?? '');
$description = $connessione->real_escape_string($_POST['description'] ?? '');
$quantity = $connessione->real_escape_string($_POST['quantity'] ?? '');
$yearModel = $connessione->real_escape_string($_POST['yearModel'] ?? $_GET['year']);
$views = intval($_POST['views'] ?? 0);
//$attributes = $connessione->real_escape_string($_POST['attributes'] ?? '');
// Collect prod attributes data with default values
$attributes__ = [
'brand' => $_GET['brand'] ?? '',
'year' => $yearModel ?? '',
'regional_specifications' => $_POST['property3'] ?? '',
'odometer' => $_POST['property4'] ?? '',
'cylinders' => $_POST['property5'] ?? '',
'transmission' => $_POST['property6'] ?? '',
'keys' => $_POST['property7'] ?? '',
'full_options' => $_POST['property8'] ?? '',
'fuel' => $_POST['property9'] ?? '',
'wheel_drive' => $_POST['property10'] ?? '',
'exterior_color' => $_POST['property11'] ?? '',
'interior_color' => $_POST['property12'] ?? '',
'maintenance_report' => $_POST['property13'] ?? '',
'car_status' => $_POST['property17'] ?? ''
];
// Initialize an array to hold form data
$formData = [];
$formHtml = isset($_POST['form_html']) ? $_POST['form_html'] : '';
// Check if 'form_html' is set and is an array
if (isset($_POST['form_html']) && is_array($_POST['form_html'])) {
foreach ($_POST['form_html'] as $key => $value) {
// Sanitize each value
$formData[$key] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
} else {
echo 'Error: form_html is not set or not an array.';
}
// Output the sanitized form data
foreach ($formData as $key => $value) {
echo htmlspecialchars($key) . ': ' . htmlspecialchars($value) . '
';
}
// Build the JSON object for the attributes field
$attributes = [
'form_html' => $formHtml,
'data' => $formData
];
// Convert the attributes array to a JSON string
$attributesJson = json_encode($attributes);
// Sanitize the JSON string for safe insertion
$attributes = $connessione->real_escape_string($attributesJson);
//$attributes = $connessione->real_escape_string(json_encode($attributes));
$delivery_available = isset($_POST['delivery_available']) ? 1 : 0;
$negotiable_price = isset($_POST['negotiable_price']) ? 1 : 0;
$status = $connessione->real_escape_string($_POST['status'] ?? '');
$collector = $connessione->real_escape_string($_POST['collector'] ?? '');
// Handle file uploads
$images = [];
if (isset($_FILES['images']) && !empty($_FILES['images']['name'][0])) {
$uploadDir = 'uploads/';
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0755, true);
}
foreach ($_FILES['images']['tmp_name'] as $key => $tmp_name) {
$fileName = basename($_FILES['images']['name'][$key]);
$uploadFile = $uploadDir . $fileName;
if (move_uploaded_file($tmp_name, $uploadFile)) {
$images[] = $uploadFile;
}
}
}
$imagesList = implode(',', $images);
try {
$sql = mysqli_query($connessione, "INSERT INTO `bathae3i` (
`idBathae3i`,
`images`,
`category`,
`title`,
`berid`,
`hetef`,
`country`,
`location_city`,
`price`,
`el3omla`,
`description`,
`quantity`,
`chronoBathae3`,
`views`,
`attributes`,
`delivery_available`,
`negotiable_price`,
`status`,
`collector`
) VALUES (
NULL, '$imagesList', '$category', '$title', '$berid', '$hetef', '$country',
'$location_city', '$price', '$el3omla', '$description', '$quantity',
'".time()."', $views, '$attributes', $delivery_available, $negotiable_price,
'$status', '$collector'
)");
if (!$sql) {
die('Error: ' . htmlspecialchars($connessione->error));
}
} catch(Exception $e) {
echo "Exception: " . $e->getMessage();
}
}
// Retrieve records from the database
$sql = "SELECT * FROM `bathae3i` WHERE idBathae3i = '" . $bId . "'";
$result = $connessione->query($sql);
?>
>
Bathae3i Management
//include 'ar.php';
if(isset($_GET["accessCat"])) $_SESSION["ad"]=$_GET["accessCat"]; //for the cntrol to dsply ads && (HIDE) not to display the cars brands logos
$bId = htmlspecialchars($_GET['bId'] ?? $_GET['bId']);
// Check if the 'accessCat' GET parameter is set
$accessCat = isset($_GET['accessCat']) ? $_GET['accessCat'] : '';
// Define available categories and their fields
$categories = $_SESSION['translations']['category'];
// Process form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$category = $connessione->real_escape_string($_POST['accessCat'] ?? $_GET['accessCat']);
$title = $connessione->real_escape_string($_POST['title'] ?? '');
$berid = $connessione->real_escape_string($_POST['berid'] ?? '');
$hetef = $connessione->real_escape_string($_POST['hetef'] ?? '');
$country = $connessione->real_escape_string($_POST['country'] ?? '');
$location_city = $connessione->real_escape_string($_POST['location_city'] ?? '');
$price = $connessione->real_escape_string($_POST['price'] ?? '');
$el3omla = $connessione->real_escape_string($_POST['el3omla'] ?? '');
$description = $connessione->real_escape_string($_POST['description'] ?? '');
$quantity = $connessione->real_escape_string($_POST['quantity'] ?? '');
$yearModel = $connessione->real_escape_string($_POST['yearModel'] ?? $_GET['year']);
$views = intval($_POST['views'] ?? 0);
//$attributes = $connessione->real_escape_string($_POST['attributes'] ?? '');
// Collect prod attributes data with default values
$attributes__ = [
'brand' => $_GET['brand'] ?? '',
'year' => $yearModel ?? '',
'regional_specifications' => $_POST['property3'] ?? '',
'odometer' => $_POST['property4'] ?? '',
'cylinders' => $_POST['property5'] ?? '',
'transmission' => $_POST['property6'] ?? '',
'keys' => $_POST['property7'] ?? '',
'full_options' => $_POST['property8'] ?? '',
'fuel' => $_POST['property9'] ?? '',
'wheel_drive' => $_POST['property10'] ?? '',
'exterior_color' => $_POST['property11'] ?? '',
'interior_color' => $_POST['property12'] ?? '',
'maintenance_report' => $_POST['property13'] ?? '',
'car_status' => $_POST['property17'] ?? ''
];
// Initialize an array to hold form data
$formData = [];
$formHtml = isset($_POST['form_html']) ? $_POST['form_html'] : '';
// Check if 'form_html' is set and is an array
if (isset($_POST['form_html']) && is_array($_POST['form_html'])) {
foreach ($_POST['form_html'] as $key => $value) {
// Sanitize each value
$formData[$key] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
} else {
echo 'Error: form_html is not set or not an array.';
}
// Output the sanitized form data
foreach ($formData as $key => $value) {
echo htmlspecialchars($key) . ': ' . htmlspecialchars($value) . '
';
}
// Build the JSON object for the attributes field
$attributes = [
'form_html' => $formHtml,
'data' => $formData
];
// Convert the attributes array to a JSON string
$attributesJson = json_encode($attributes);
// Sanitize the JSON string for safe insertion
$attributes = $connessione->real_escape_string($attributesJson);
//$attributes = $connessione->real_escape_string(json_encode($attributes));
$delivery_available = isset($_POST['delivery_available']) ? 1 : 0;
$negotiable_price = isset($_POST['negotiable_price']) ? 1 : 0;
$status = $connessione->real_escape_string($_POST['status'] ?? '');
$collector = $connessione->real_escape_string($_POST['collector'] ?? '');
// Handle file uploads
$images = [];
if (isset($_FILES['images']) && !empty($_FILES['images']['name'][0])) {
$uploadDir = 'uploads/';
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0755, true);
}
foreach ($_FILES['images']['tmp_name'] as $key => $tmp_name) {
$fileName = basename($_FILES['images']['name'][$key]);
$uploadFile = $uploadDir . $fileName;
if (move_uploaded_file($tmp_name, $uploadFile)) {
$images[] = $uploadFile;
}
}
}
$imagesList = implode(',', $images);
try {
$sql = mysqli_query($connessione, "INSERT INTO `bathae3i` (
`idBathae3i`,
`images`,
`category`,
`title`,
`berid`,
`hetef`,
`country`,
`location_city`,
`price`,
`el3omla`,
`description`,
`quantity`,
`chronoBathae3`,
`views`,
`attributes`,
`delivery_available`,
`negotiable_price`,
`status`,
`collector`
) VALUES (
NULL, '$imagesList', '$category', '$title', '$berid', '$hetef', '$country',
'$location_city', '$price', '$el3omla', '$description', '$quantity',
'".time()."', $views, '$attributes', $delivery_available, $negotiable_price,
'$status', '$collector'
)");
if (!$sql) {
die('Error: ' . htmlspecialchars($connessione->error));
}
} catch(Exception $e) {
echo "Exception: " . $e->getMessage();
}
}
// Retrieve records from the database
$sql = "SELECT * FROM `bathae3i` WHERE idBathae3i = '" . $bId . "'";
$result = $connessione->query($sql);
?>
>
Insert New Record
Existing Records
ID | Images | Category | Attributes / Delivery Available / Negotiable Price | Status | Collector |
---|---|---|---|---|---|
$images = explode(',', $row['images']); foreach ($images as $image): ?> | // Start session if not already started if (session_status() === PHP_SESSION_NONE) { session_start(); } // Decode the JSON-encoded attributes field $attributes = json_decode($row['attributes'], true); ?> $formHtml = $attributes['form_html']; $formData = $attributes['data']; ?> $value): ?> // Find the translation for the current key $translation = ''; //foreach ($_SESSION['translations']['category']['vehicles']['cars'] as $category) { foreach ($_SESSION['translations'] as $category) { if (isset($category[$key])) { $translation = $category[$key]; break; }else if (isset($category['vehicles'][$key])) { $translation = $category[$key]; break; } } ?> : : |
Form_html:
Warning: Array to string conversion in /home/u423793718/domains/dadabay.com/public_html/item.php on line 288
Data: Array