connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Function to get a setting value
function getSettingValue($mysqli, $setting) {
$query = $mysqli->prepare("SELECT value FROM tbl_appconfig WHERE setting = ?");
$query->bind_param("s", $setting);
$query->execute();
$result = $query->get_result();
if ($row = $result->fetch_assoc()) {
return $row['value'];
}
return '';
}
// Fetch hotspot title and description from tbl_appconfig
$hotspotTitle = getSettingValue($mysqli, 'hotspot_title');
$description = getSettingValue($mysqli, 'description');
$phone = getSettingValue($mysqli, 'phone');
$company = getSettingValue($mysqli, 'CompanyName');
// Fetch router name and router ID from tbl_appconfig
$routerName = getSettingValue($mysqli, 'router_name');
$routerId = getSettingValue($mysqli, 'router_id');
// Fetch available plans
$planQuery = "SELECT id, type, name_plan, price, validity, validity_unit FROM tbl_plans WHERE routers = ? AND type = 'Hotspot'";
$planStmt = $mysqli->prepare($planQuery);
$planStmt->bind_param("s", $routerName);
$planStmt->execute();
$planResult = $planStmt->get_result();
$htmlContent = "";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " $company\n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
$company HOTSPOT LOGIN
\n";
$htmlContent .= "
\n";
$htmlContent .= " - Click on your preferred package
\n";
$htmlContent .= " - Enter Mpesa No.
\n";
$htmlContent .= " - Enter pin
\n";
$htmlContent .= " - Wait to be connected
\n";
$htmlContent .= "
\n";
$htmlContent .= "
For any enquiries contact : $phone
\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
// New HTML content added
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
Enter code to reconnect
\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
Already Have an Active Package?
\n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= " \n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
© " . date("Y") . ". Powered by NestICT
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "
\n";
$htmlContent .= "\n";
// Add the closing script section as well, if necessary
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$htmlContent .= "\n";
$planStmt->close();
$mysqli->close();
// Check if the download parameter is set
if (isset($_GET['download']) && $_GET['download'] == '1') {
// Prepare the HTML content for download
// ... build your HTML content ...
// Specify the filename for the download
$filename = "login.html";
// Send headers to force download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($filename));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . strlen($htmlContent));
// Output the content
echo $htmlContent;
// Prevent any further output
exit;
}
// Regular page content goes here
// ... HTML and PHP code to display the page ...