51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../config/database.php';
|
|
|
|
$tsql = "SELECT ID, Nazwa FROM dbo.NGastroStolik ORDER BY Nazwa";
|
|
$stmt = sqlsrv_query($conn, $tsql);
|
|
|
|
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
|
$baseUrl = "http://$host/karczma-stoliki/public/stolik2_api.html?h=";
|
|
|
|
echo "<!DOCTYPE html>
|
|
<html lang='pl'>
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<title>Generator Linków QR - Stoliki</title>
|
|
<style>
|
|
body { font-family: sans-serif; padding: 20px; }
|
|
table { border-collapse: collapse; width: 100%; max-width: 800px; }
|
|
th, td { border: 1px solid #ccc; padding: 10px; text-align: left; }
|
|
th { background: #eee; }
|
|
a { color: #0066cc; text-decoration: none; }
|
|
a:hover { text-decoration: underline; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Linki do aplikacji (Kody QR)</h1>
|
|
<p>Skopiuj poniższe linki lub wygeneruj z nich kody QR do umieszczenia na stolikach.</p>
|
|
<table>
|
|
<tr>
|
|
<th>Nazwa stolika</th>
|
|
<th>Hash (ID z bazy)</th>
|
|
<th>Bezpieczny Link (KOD QR)</th>
|
|
</tr>";
|
|
|
|
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
|
$id = strtoupper($row['ID']);
|
|
$nazwa = htmlspecialchars($row['Nazwa']);
|
|
$link = $baseUrl . $id;
|
|
echo "<tr>
|
|
<td><strong>$nazwa</strong></td>
|
|
<td style='font-size: 0.8em; color: #666;'>$id</td>
|
|
<td><a href='$link' target='_blank'>$link</a></td>
|
|
</tr>";
|
|
}
|
|
|
|
echo " </table>
|
|
</body>
|
|
</html>";
|
|
|
|
sqlsrv_free_stmt($stmt);
|
|
sqlsrv_close($conn);
|