diff --git a/download.php b/download.php new file mode 100644 index 0000000..13fec7a --- /dev/null +++ b/download.php @@ -0,0 +1,907 @@ +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 .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "

$company

\n"; +$htmlContent .= "
\n"; +$htmlContent .= "

HOTSPOT LOGIN

\n"; +$htmlContent .= "
\n"; +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= "

\n"; +$htmlContent .= " Empowering businesses with reliable WiFi solutions and seamless connectivity across Kenya.\n"; +$htmlContent .= "

\n"; +$htmlContent .= "
\n"; +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= "

How to Connect

\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " 1\n"; +$htmlContent .= " Click on your preferred package\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " 2\n"; +$htmlContent .= " Enter Mpesa No.\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " 3\n"; +$htmlContent .= " Enter pin\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " 4\n"; +$htmlContent .= " Wait to be connected\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= "

\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 .= "

Have a Voucher Code?

\n"; +$htmlContent .= "

Redeem your voucher for instant access

\n"; +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; + + + + + + + + + +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= "

Choose Your Package

\n"; +$htmlContent .= "

Select the perfect plan for your internet needs

\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 .= "

Reconnect with M-Pesa Code

\n"; +$htmlContent .= "

Enter your M-Pesa transaction code to reconnect

\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 .= "

Already Have an Active Package?

\n"; +$htmlContent .= "

Login with your account details

\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"; +$htmlContent .= "
\n"; +$htmlContent .= "
\n"; +$htmlContent .= " \n"; +$htmlContent .= "
\n"; +$htmlContent .= " Powered by NestICT\n"; +$htmlContent .= "
\n"; +$htmlContent .= "

\n"; +$htmlContent .= " © " . date("Y") . " Billing System\n"; +$htmlContent .= "

\n"; +$htmlContent .= " \n"; +$htmlContent .= " \n"; +$htmlContent .= " Visit NestICT\n"; +$htmlContent .= " \n"; +$htmlContent .= " \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 ... + +