Poprawka generatora QR i ukrycie imienia
This commit is contained in:
@@ -19,7 +19,14 @@ echo "<!DOCTYPE html>
|
||||
th { background: #eee; }
|
||||
a { color: #0066cc; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
.btn-qr { padding: 5px 10px; background: #3b82f6; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
|
||||
.btn-qr:hover { background: #2563eb; }
|
||||
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
|
||||
.modal-content { background: #fff; padding: 20px; border-radius: 8px; text-align: center; max-width: 400px; width: 90%; }
|
||||
.close { float: right; font-size: 24px; font-weight: bold; cursor: pointer; line-height: 20px; }
|
||||
#qrcode { margin-top: 20px; display: flex; justify-content: center; }
|
||||
</style>
|
||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Linki do aplikacji (Kody QR)</h1>
|
||||
@@ -29,6 +36,7 @@ echo "<!DOCTYPE html>
|
||||
<th>Nazwa stolika</th>
|
||||
<th>Hash (ID z bazy)</th>
|
||||
<th>Bezpieczny Link (KOD QR)</th>
|
||||
<th>Akcje</th>
|
||||
</tr>";
|
||||
|
||||
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
@@ -39,10 +47,51 @@ while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
|
||||
<td><strong>$nazwa</strong></td>
|
||||
<td style='font-size: 0.8em; color: #666;'>$id</td>
|
||||
<td><a href='$link' target='_blank'>$link</a></td>
|
||||
<td><button class='btn-qr' onclick='openQR(\"$link\", \"$nazwa\")'>Pokaż QR</button></td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
echo " </table>
|
||||
|
||||
<div id='qrModal' class='modal'>
|
||||
<div class='modal-content'>
|
||||
<span class='close' onclick='closeQR()'>×</span>
|
||||
<h2 id='qrTitle'>Kod QR</h2>
|
||||
<div id='qrcode'></div>
|
||||
<p style='margin-top:20px;'><a id='qrLink' href='' target='_blank' style='color: #3b82f6;'>Otwórz link w nowym oknie</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function openQR(link, nazwa) {
|
||||
document.getElementById('qrModal').style.display = 'flex';
|
||||
document.getElementById('qrTitle').innerText = 'Stolik: ' + nazwa;
|
||||
document.getElementById('qrLink').href = link;
|
||||
|
||||
var qrContainer = document.getElementById('qrcode');
|
||||
qrContainer.innerHTML = ''; // Wyczyść poprzedni kod
|
||||
|
||||
new QRCode(qrContainer, {
|
||||
text: link,
|
||||
width: 250,
|
||||
height: 250,
|
||||
colorDark : '#000000',
|
||||
colorLight : '#ffffff',
|
||||
correctLevel : QRCode.CorrectLevel.H
|
||||
});
|
||||
}
|
||||
|
||||
function closeQR() {
|
||||
document.getElementById('qrModal').style.display = 'none';
|
||||
}
|
||||
|
||||
window.onclick = function(event) {
|
||||
var modal = document.getElementById('qrModal');
|
||||
if (event.target == modal) {
|
||||
closeQR();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user