include 'header.php'; // Includes config.php + theme require_once __DIR__ . '/../core/Storage.php'; $message = ""; $redirect = false; if ($_SERVER["REQUEST_METHOD"] === "POST") { $its_id = trim($_POST['its_id']); $password = trim($_POST['password']); // Name parts $first_name = trim($_POST['first_name']); $middle_name = trim($_POST['middle_name']); $surname = trim($_POST['surname']); $area = trim($_POST['area']); $street = trim($_POST['street']); $building = trim($_POST['building']); $flat_no = trim($_POST['flat_no']); $full_address = trim($_POST['full_address']); $mobile = trim($_POST['mobile']); $email = trim($_POST['email']); $whatsapp = trim($_POST['whatsapp']); // Cloudflare R2 configuration $r2Prefix = "qardan/"; // ITS Card $its_ext = strtolower(pathinfo($_FILES["its_card"]["name"], PATHINFO_EXTENSION)); $its_card = $r2Prefix . $its_id . "-ITSCard." . $its_ext; Storage::upload($_FILES["its_card"]["tmp_name"], $its_card); // Aadhar $aadhar_ext = strtolower(pathinfo($_FILES["aadhar"]["name"], PATHINFO_EXTENSION)); $aadhar = $r2Prefix . $its_id . "-Aadhar." . $aadhar_ext; Storage::upload($_FILES["aadhar"]["tmp_name"], $aadhar); // PAN $pan_ext = strtolower(pathinfo($_FILES["pan"]["name"], PATHINFO_EXTENSION)); $pan = $r2Prefix . $its_id . "-PAN." . $pan_ext; Storage::upload($_FILES["pan"]["tmp_name"], $pan); // Check if ITS ID already exists $stmt = $conn->prepare("SELECT * FROM qh_users WHERE its_id = ?"); $stmt->bind_param("s", $its_id); $stmt->execute(); $result = $stmt->get_result(); if ($result && $result->num_rows > 0) { // User exists → check if partial record (used as guarantor before) $existing = $result->fetch_assoc(); if ( empty($existing['password']) || empty($existing['full_name']) || empty($existing['address']) || empty($existing['mobile']) || empty($existing['email']) ) { // Update user with full details $update = $conn->prepare("UPDATE qh_users SET password=?, first_name=?, middle_name=?, surname=?, area=?, street=?, building=?, flat_no=?, full_address=?, mobile=?, email=?, whatsapp=?, its_card=?, aadhar=?, pan=?, status='pending' WHERE its_id=?"); $update->bind_param("ssssssssssssssss", $password, $first_name, $middle_name, $surname, $area, $street, $building, $flat_no, $full_address, $mobile, $email, $whatsapp, $its_card, $aadhar, $pan, $its_id ); $update->execute(); $message = "Registration completed successfully. Redirecting to login..."; $redirect = true; } else { // Already full member echo ""; exit; } } else { // Insert new record $insert = $conn->prepare("INSERT INTO qh_users (its_id, password, first_name, middle_name, surname, area, street, building, flat_no, full_address, mobile, email, whatsapp, its_card, aadhar, pan, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'pending')"); $insert->bind_param("ssssssssssssssss", $its_id, $password, $first_name, $middle_name, $surname, $area, $street, $building, $flat_no, $full_address, $mobile, $email, $whatsapp, $its_card, $aadhar, $pan ); $insert->execute(); $message = "Registration successful. Redirecting to login..."; $redirect = true; } } ?>

HMP QH Sign Up

Create Account

WhatsApp Number

Already have an account? Login here