Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
timerec3public/terminal.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
64 lines (57 sloc)
1.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<link rel="shortcut icon" href="favicon.ico"> | |
<title>terminal emulator</title> | |
</head> | |
<body> | |
<?php | |
include('dbconnect.php'); | |
if(!empty($_POST['rfid'])){ | |
$jetzt = new DateTime; | |
$jetztstr = $jetzt->format('Y-m-d H:i'); | |
$jetztstr .= ":00"; | |
//$hostname = gethostname(); | |
$hostname = "te ".$_SERVER['REMOTE_ADDR']; | |
$getma = $dbc->query("select maID from transponder where rfid = '$_POST[rfid]';"); | |
$maID = $getma->fetch_array()[0]; | |
if(!empty($maID)){ | |
$getlast = $dbc->query("select status from zeit where maID = '$maID' and date(datumzeit) = date(now()) order by zeit_ID desc limit 1;"); | |
$laststatus = $getlast->fetch_array()[0]; | |
if($laststatus == 'geht' || empty($laststatus)){ | |
$newstatus = "kommt"; | |
}else{ | |
$newstatus = "geht"; | |
} | |
$insert = "insert into zeit (maID, datumzeit, status, userid) values ('$maID', '$jetztstr', '$newstatus', '$hostname');"; | |
//echo $insert; | |
$dbc->query($insert); | |
if($dbc->error){ | |
echo "FEHLER: ".$dbc->error; | |
}else{ | |
$getsaldo = $dbc->query("select sum(saldomin) from saldo where maID = $maID;"); | |
$saldoges = $getsaldo->fetch_array()[0]; | |
$saldostd = intval($saldoges/60); | |
$saldomin = abs($saldoges%60); | |
echo "ERFOLG: Mitarbeiter $maID $newstatus || Saldo: $saldostd:$saldomin Std."; | |
} | |
} | |
} | |
?> | |
<div id='content'> | |
<form id='centered_form' action="#" method="post"> | |
<h3>Terminal Emulator</h3> | |
<table> | |
<tr> | |
<td><input type="text" name="rfid" placeholder="rfid..."></td> | |
</tr> | |
<tr> | |
<td><button id='knopf' type='submit'>set</button></td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
</body> | |
</html> |