110 lines
3.2 KiB
PHP
110 lines
3.2 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Result Preview</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script>
|
|
tailwind.config = {
|
|
theme: {
|
|
extend: {
|
|
fontFamily: {
|
|
sans: ['Inter', 'sans-serif'],
|
|
},
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<?php
|
|
$userid = session('userid');
|
|
$verif = 0;
|
|
|
|
if(strpos(strtolower($status), "verif") !== false) { $verif = 1; }
|
|
?>
|
|
<body class="bg-gray-50 flex items-start justify-center">
|
|
|
|
<div class="w-full max-w-4xl min-h-screen flex flex-col ">
|
|
<div class="flex-1 flex flex-col h-full bg-white rounded-2xl shadow-2xl space-y-6 p-3 m-2">
|
|
<header>
|
|
<p class="text-end">user : <?=$userid;?></p>
|
|
<p>Result lab# <?=$accessnumber;?><br />Status : <?=$status;?></p>
|
|
</header>
|
|
|
|
<div class='flex-1 flex flex-col relative shadow-inner bg-gray-100 border border-gray-300'>
|
|
<iframe
|
|
id="result-iframe"
|
|
title="PHP Embedded Content Demo"
|
|
class="flex-1"
|
|
src="http://glenlis/spooler_db/main_dev.php?acc=<?=$accessnumber;?>">
|
|
|
|
<p>Your browser does not support iframes. Please contact the technical support.</p>
|
|
</iframe>
|
|
|
|
<?php if($verif == 0) { ?>
|
|
<div class="absolute inset-0 flex items-center justify-center pointer-events-none z-20">
|
|
<span class="text-7xl font-black text-gray-600 opacity-20 transform rotate-[-30deg] select-none">
|
|
Unverified
|
|
</span>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<footer>
|
|
<?php if($verif == 0) { ?>
|
|
<p class='text-end'>
|
|
<button id='result-button'
|
|
class='bg-blue-500 text-white py-2 px-3 text-sm rounded-md
|
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-400 disabled:text-gray-200'
|
|
disabled onclick="validate()">Validate</button>
|
|
</p>
|
|
<?php } ?>
|
|
<p class="mt-2 text-gray-500 text-xs text-center">© 2025 - 5panda</p>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
<?php if($verif == 0) { ?>
|
|
const iframe = document.getElementById('result-iframe');
|
|
const button = document.getElementById('result-button');
|
|
|
|
iframe.addEventListener('load', () => {
|
|
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
const scrollElement = iframeDoc.scrollingElement || iframeDoc.documentElement;
|
|
|
|
iframeDoc.addEventListener('scroll', () => {
|
|
const scrollTop = scrollElement.scrollTop;
|
|
const scrollHeight = scrollElement.scrollHeight;
|
|
const clientHeight = scrollElement.clientHeight;
|
|
|
|
// Check if scrolled to bottom
|
|
if (scrollTop + clientHeight >= scrollHeight - 2) {
|
|
button.disabled = false;
|
|
}
|
|
});
|
|
});
|
|
|
|
function validate() {
|
|
const ok = confirm('Are you sure?');
|
|
if (!ok) return;
|
|
fetch('inc/result_validate.php?accessnumber=<?=$accessnumber;?>&userid=<?=$userid;?>', {
|
|
method: 'GET'
|
|
})
|
|
.then(function (response) {
|
|
if (!response.ok) throw new Error('Failed to send data');
|
|
//return response.json();
|
|
})
|
|
.then(function (data) {
|
|
location.reload();
|
|
})
|
|
.catch(function (error) {
|
|
alert('Error: ' + error.message);
|
|
});
|
|
}
|
|
<?php }?>
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|