/
home
/
u839856410
/
domains
/
frajuuconnect.online
/
public_html
/
Upload File
HOME
<?php session_start(); $conn = new mysqli("localhost", "u839856410_Frajuu", "Frajuuweb000@", "u839856410_Frajuuconnect"); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if (!isset($_SESSION['agent_id'])) { header("Location: login.php"); exit(); } $agent_id = $_SESSION['agent_id']; if (isset($_GET['table'], $_GET['id'])) { $table = $_GET['table']; $id = (int)$_GET['id']; // Verify table name is allowed $allowed_tables = ['houses_for_sale','houses_for_rent','rooms_for_rent','plots_for_sale']; if (!in_array($table, $allowed_tables)) { die("Invalid table."); } // Verify ownership $check = $conn->query("SELECT * FROM $table WHERE id='$id' AND agent_id='$agent_id'"); if ($check->num_rows > 0) { $conn->query("DELETE FROM $table WHERE id='$id'"); header("Location: admin-dashboard.php?msg=deleted"); exit(); } else { die("You do not have permission to delete this property."); } } else { die("Invalid request."); }