The Masters Accountants
Contact US
connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
// Fetch dropdown values
$cities = $conn->query(“SELECT City_id, CityName FROM CitiesTB”);
$offences = $conn->query(“SELECT Offence_id, OffenceName FROM OffenceNamesTB”);
$areas = $conn->query(“SELECT Area_id, AreaName FROM AreasTB WHERE approved= 1”);
$ages = $conn->query(“SELECT Age_id, Age_Range FROM AgeTB”); // Fetch Age ranges
// Handle form submission
$successMessage = “”;
if ($_SERVER[“REQUEST_METHOD”] == “POST” && !isset($_SESSION[‘submitted’])) {
$name = htmlspecialchars($_POST[“Name”]);
$lastname = htmlspecialchars($_POST[“LastName”]);
$nicename = htmlspecialchars($_POST[“NiceName”]);
$fullname = htmlspecialchars($_POST[“FullName”]);
$city_id = htmlspecialchars($_POST[“City_id”]);
$area_id = htmlspecialchars($_POST[“Area_id”]);
$new_area_name = htmlspecialchars(trim($_POST[“NewAreaName”]));
$age = htmlspecialchars($_POST[“Age_id”]);
$offence_id = htmlspecialchars($_POST[“Offence_id”]);
$evidence = htmlspecialchars($_POST[“Evidence”]);
$notes = htmlspecialchars($_POST[“Notes”]);
$current_location = htmlspecialchars($_POST[“Current_location”]);
$picture = “”;
$evidence_picture1 = “”;
$evidence_picture2 = “”;
// Handle picture uploads
if (!empty($_FILES[“Picture”][“name”])) {
$target_dir = “Shabiha_pictures/”;
$picture = $target_dir . basename($_FILES[“Picture”][“name”]);
if (!is_dir($target_dir)) {
mkdir($target_dir, 0777, true); // Create directory if it doesn’t exist
}
move_uploaded_file($_FILES[“Picture”][“tmp_name”], $picture);
}
// Handle Evidence_Picture1 upload
if (!empty($_FILES[“Evidence_Picture1”][“name”])) {
$target_dir = “Shabiha_evidences/”;
$evidence_picture1 = $target_dir . basename($_FILES[“Evidence_Picture1”][“name”]);
if (!is_dir($target_dir)) {
mkdir($target_dir, 0777, true); // Create directory if it doesn’t exist
}
move_uploaded_file($_FILES[“Evidence_Picture1”][“tmp_name”], $evidence_picture1);
}
// Handle Evidence_Picture2 upload
if (!empty($_FILES[“Evidence_Picture2”][“name”])) {
$target_dir = “Shabiha_evidences/”;
$evidence_picture2 = $target_dir . basename($_FILES[“Evidence_Picture2”][“name”]);
if (!is_dir($target_dir)) {
mkdir($target_dir, 0777, true); // Create directory if it doesn’t exist
}
move_uploaded_file($_FILES[“Evidence_Picture2”][“tmp_name”], $evidence_picture2);
}
// Add new area if provided
if (!empty($new_area_name)) {
$stmt = $conn->prepare(“SELECT COUNT(*) FROM AreasTB WHERE REPLACE(LOWER(AreaName), ‘ ‘, ”) = REPLACE(LOWER(?), ‘ ‘, ”) AND City_id = ?”);
$stmt->bind_param(“si”, $new_area_name, $city_id);
$stmt->execute();
$stmt->bind_result($area_exists);
$stmt->fetch();
$stmt->close();
if ($area_exists == 0) {
$stmt = $conn->prepare(“INSERT INTO AreasTB (AreaName, City_id) VALUES (?, ?)”);
$stmt->bind_param(“si”, $new_area_name, $city_id);
$stmt->execute();
$area_id = $stmt->insert_id; // Get the newly inserted Area_id
$stmt->close();
}
}
// Define regex pattern for Arabic characters, symbols, and numbers, and include null, empty strings, or spaces
$arabic_pattern = “/^[\p{Arabic}0-9\s\-.,،؛!?()]*$/u”;
// Validate fields
$fields_to_validate = [
“Name” => $_POST[“Name”] ?? ”,
“LastName” => $_POST[“LastName”] ?? ”,
“NiceName” => $_POST[“NiceName”] ?? ”,
“FullName” => $_POST[“FullName”] ?? ”,
“NewAreaName” => $_POST[“NewAreaName”] ?? ”,
“Current_location” => $_POST[“Current_location”] ?? ”,
“Evidence” => $_POST[“Evidence”] ?? ”,
“Notes” => $_POST[“Notes”] ?? ”
];
foreach ($fields_to_validate as $field => $value) {
// Allow null, empty strings, and spaces without matching the pattern
if (!empty($value) && !preg_match($arabic_pattern, $value)) {
die(“
خطأ: يحتوي الحقل ‘{$field}’ على أحرف أو رموز غير مسموح بها.
“);
}
}
// Check for duplicate records in ShabbihaTB
$stmt = $conn->prepare(“SELECT * FROM ShabbihaTB WHERE Name = ? AND LastName = ? AND fullname = ?”);
$stmt->bind_param(“sss”, $name, $lastname, $fullname);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
echo “
echo “
توجد سجلات مشابهة بالفعل. الرجاء التحقق:
“;
echo “
| الاسم الأول | الكنية | الاسم الكامل | المدينة | المنطقة | العمر | الإجراء |
|---|---|---|---|---|---|---|
| ” . htmlspecialchars($row[‘Name’]) . “ | ” . htmlspecialchars($row[‘LastName’]) . “ | ” . htmlspecialchars($row[‘fullname’]) . “ | ” . htmlspecialchars($row[‘City_id’]) . “ | ” . htmlspecialchars($row[‘Area_id’]) . “ | ” . htmlspecialchars($row[‘Age_id’]) . “ |
“;
echo “
“;
$stmt->close();
return; // Prevent further processing
}
$stmt->close();
if ($_SERVER[“REQUEST_METHOD”] == “POST” && isset($_POST[‘agree_id’])) {
$agree_id = intval($_POST[‘agree_id’]);
$stmt = $conn->prepare(“UPDATE ShabbihaTB SET TotalAgree = TotalAgree + 1 WHERE id = ?”);
$stmt->bind_param(“i”, $agree_id);
if ($stmt->execute()) {
echo “
تمت الموافقة بنجاح وزيادة TotalAgree.
“;
} else {
echo “
حدث خطأ أثناء تحديث السجل.
“;
}
$stmt->close();
return; // Prevent further processing
}
// Insert into ShabbihaTB table
$stmt = $conn->prepare(“INSERT INTO ShabbihaTB (Name, LastName, NiceName, fullname, City_id, Area_id, Age_id, Offence_id, Evidence, notes, picture, Evidence_Picture1, Evidence_Picture2, Current_Location) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)”);
$stmt->bind_param(“ssssiiisssssss”, $name, $lastname, $nicename, $fullname, $city_id, $area_id, $age, $offence_id, $evidence, $notes, $picture, $evidence_picture1, $evidence_picture2, $current_location);
if ($stmt->execute()) {
$successMessage = “
تمت الإضافة بنجاح.
“;
$_SESSION[‘submitted’] = true; // Prevent duplicate submission on refresh
} else {
$successMessage = “
حدث خطأ: ” . $stmt->error . “
“;
}
$stmt->close();
}
$conn->close();
?>
تبليغ عن شبيحة و مجرمين- إضافة بيانات جديدة
من فضلك قم بمشاركة هذا الموقع للآخرين فعدد التبليغات مهم
أطمئن فلن يتم استخدام هذه البيانات إلا من قبل الحكومة السورية الحرّة و لن يتم إتخاذ أي رد فعل فردي تجاه أي من المبلّغ عنهم
لا تقوم بتزويدنا بأي معلومات خاصة عنك شخصياً
