| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/abyogasms.com/html/iyd/ |
Upload File : |
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once("config.php");
// ─────────────────────────────────────────────
// HELPERS
// ─────────────────────────────────────────────
function db_connect(): PDO {
$dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4';
$pdo = new PDO($dsn, DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);
return $pdo;
}
if ($_REQUEST['fullname'] !== '' && $_REQUEST['mobile'] !== '') {
try {
$pdo = db_connect();
$sql = "INSERT INTO registrations (`title`, `fullname`, `mobile`, `email`, `state`, `district`) VALUES (:title, :fullname, :mobile, :email, :statename, :district)";
// 3. Prepare the statement
$stmt = $pdo->prepare($sql);
// 4. Map data to the placeholders and execute
$data = [
'title' => $_REQUEST['title'],
'fullname' => $_REQUEST['fullname'],
'mobile' => $_REQUEST['mobile'],
'email' => $_REQUEST['email'],
'statename' => $_REQUEST['state'],
'district' => $_REQUEST['district']
];
$stmt->execute($data);
// 5. Get the auto-incremented ID of the new record (Optional)
$lastId = $pdo->lastInsertId();
header("Location:index.php?id=".$lastId);
} catch (PDOException $e) {
http_error(500, 'Database error: ' . $e->getMessage());
}
}