Stempeluhr
von uname- SNIPPET_TEXT:
-
- <!DOCTYPE html>
- <html lang="de">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script>
- document.querySelectorAll('button').forEach(function(button) {
- button.addEventListener('click', function(e) {
- e.preventDefault();
- var xhr = new XMLHttpRequest();
- xhr.open('POST', 'index.php');
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4 && xhr.status === 200) {
- location.reload();
- }
- };
- xhr.send(document.getElementById('klick').serialize() + '&submit=' + button.getAttribute("value"));
- });
- });
- </script>
- </head>
- <body>
- <form action="" method="post" id="klick">
- <button type="submit" name="send_form" value="kommt">kommt</button>
- <button type="submit" name="send_form" value="geht">geht</button>
- </form>
- <?php
- {
- $update = $_POST['send_form'];
- }
- $filename="time.txt";
- if ($fp)
- {
- }
- if ($update)
- {
- $t = $time . ";" . $update;
- $backupfile = 'backup/'.$day.'.txt';
- if ($fp)
- {
- }
- if ($fp)
- {
- }
- }
- foreach ($file as $line)
- {
- echo $line;
- echo "<br>";
- }
- ?>
- </body>
- </html>
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN