real_escape_string($username); $password_md5 = md5($password); $password_sha1 = sha1($password); $password_plain = $password; // Try different password formats and login fields $query = "SELECT * FROM centers WHERE (username = '$username_escaped' OR email = '$username_escaped' OR contact_number = '$username_escaped' OR center_number = '$username_escaped') AND (password = '$password_md5' OR password = '$password_sha1' OR password = '$password_plain') AND status = 1"; $result = $con->query($query); if ($result && $result->num_rows > 0) { $centerData = $result->fetch_assoc(); // Set session variables $_SESSION['center'] = array( 'id' => $centerData['id'], 'name' => $centerData['name'], 'username' => $centerData['username'], 'email' => $centerData['email'], 'center_number' => $centerData['center_number'] ?? $centerData['username'], 'institute_name' => $centerData['institute_name'], 'type' => 'center' ); // Update last login $center_id = $centerData['id']; $con->query("UPDATE centers SET last_login = NOW() WHERE id = '$center_id'"); // Redirect to center dashboard header('Location: /center/index.php'); exit(); } else { $error_message = 'Invalid credentials! Please check your username and password.'; } } else { $error_message = 'Database connection error. Please contact administrator.'; } } } // Kuch conditional error display ke liye variable if (!isset($error_message)) { $error_message = ''; } ?>
You have been successfully logged out.
Logo

GSOS Login Portal

Secure Management Information System