query("SHOW COLUMNS FROM `centers`"); if ($columns_res) { $existing_columns = []; while ($row = $columns_res->fetch_assoc()) { $existing_columns[] = strtolower($row['Field']); } // Database ke existing columns se match karenge foreach ($possible_columns as $col) { if (in_array(strtolower($col), $existing_columns)) { $target_column = $col; break; } } // Fallback agar koi match na mile if (empty($target_column) && !empty($existing_columns)) { $target_column = in_array('username', $existing_columns) ? 'username' : $existing_columns[1]; } } if (empty($target_column)) { $error_message = 'Could not detect any valid column for Institute ID in "centers" table.'; } else { $detected_column_name = $target_column; // ===== 4. SAFE PREPARED STATEMENT ===== $stmt = $db->prepare("SELECT * FROM `centers` WHERE `$target_column` = ? AND `status` = 1"); if ($stmt === false) { $error_message = 'SQL Prepare Error: ' . $db->error; } else { $stmt->bind_param("s", $institute_id_input); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $verification_result = $result->fetch_assoc(); // ===== 5. FETCH STATE & CITY (EXACTLY LIKE BACKEND) ===== if (!empty($verification_result['state_id'])) { $state_escaped = $db->real_escape_string($verification_result['state_id']); $state_res = $db->query("SELECT * FROM `states` WHERE `id` = '$state_escaped'"); if ($state_res && $state_row = $state_res->fetch_assoc()) { $state_name = $state_row['state_name']; } } if (!empty($verification_result['city_id'])) { $city_escaped = $db->real_escape_string($verification_result['city_id']); $city_res = $db->query("SELECT * FROM `city` WHERE `id` = '$city_escaped'"); if ($city_res && $city_row = $city_res->fetch_assoc()) { $city_name = $city_row['city_name']; } } } else { $error_message = 'Invalid Institute ID! No active record found.'; } $stmt->close(); } } } } ?>
| Institute ID | = htmlspecialchars($verification_result[$detected_column_name]) ?> |
|---|---|
| Institute Name | = htmlspecialchars($verification_result['institute_name'] ?? 'N/A') ?> |
| Director Name | = htmlspecialchars($verification_result['name'] ?? 'N/A') ?> |
| Contact Number | = htmlspecialchars($verification_result['contact_number'] ?? 'N/A') ?> |
| Email Address | = htmlspecialchars($verification_result['email'] ?? 'N/A') ?> |
| Full Address | = htmlspecialchars($verification_result['center_full_address'] ?? 'N/A') ?>, = htmlspecialchars($city_name) ?>, = htmlspecialchars($state_name) ?> |
| Status | ACTIVE & LICENSED |
| Authorization Date | = !empty($verification_result['timestamp']) ? date('d M Y', strtotime($verification_result['timestamp'])) : 'Active' ?> |
Institute / Center Verification Portal