Porządki
This commit is contained in:
50
public/staff/generator.php
Normal file
50
public/staff/generator.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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);
|
||||
Reference in New Issue
Block a user