Startseite
Updates · Suchen

DASH

<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Administration</title>
<style>
body {
	font-size: 1.2em;
	font-family: sans-serif;
	line-height: 1.4em;
}
#box {
	max-width: 200px;
	border: 1px solid #CCC;
	padding: 20px;
	margin: 20px auto;
	background: #EEE;
	border-radius: 5px;
	text-align: center;
}
input {
	padding: 10px;
	font-weight: 700;
}
.send {
	border: 1px solid #333;
	background: #CCC;
	margin: 5px;
}
.send:hover {
	background: #EEE;
	cursor: pointer;
}
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
    color: green;
    opacity: 1; /* Firefox */
}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: green;
}

::-ms-input-placeholder { /* Microsoft Edge */
    color: green;
}

input:focus::-webkit-input-placeholder{
    color: transparent!important;
	background: yellow;
}
input:focus::-moz-placeholder{
    color: transparent!important;
	background: yellow;
}
input:focus:-moz-placeholder{
    color: transparent!important;
	background: yellow;
}
</style>
</head>
<bod>

<?php
$myFile = "tm.txt";
$lines = file($myFile);//file in to an array
?>

<div id="box">
Administration
<form method="post" name="traffic" action="traffic.php">
<input type="text" name="traffic" maxlength="5" size="5" placeholder="<?php echo $lines[0]; ?>">
<input class="send" type="submit" value="TM eintragen">
</form>
<form method="post" name="duty" action="duty.php">
<input type="text" name="duty" maxlength="5" size="5" placeholder="<?php echo $lines[1]; ?>">
<input class="send" type="submit" value="DM eintragen">
</form>
</div>
</body>
</html>

DUTY

<?php
$duty = $_POST['duty'];
$line = 1; // 1 is the second line
$file = "tm.txt";
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
fclose($handle);
$arrCont = explode("\n", $contents);
$arrCont[$line] = $duty;
$handle = fopen($file, "w+");
fwrite($handle, implode("\n", $arrCont));
fclose($handle);
header('Location: dash.php');
exit();
?>

TRAFFIC

<?php
$traffic = $_POST['traffic'];
$line = 0; // 0 is the first line
$file = "tm.txt";
$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));
fclose($handle);
$arrCont = explode("\n", $contents);
$arrCont[$line] = $traffic;
$handle = fopen($file, "w+");
fwrite($handle, implode("\n", $arrCont));
fclose($handle);
header('Location: dash.php');
exit();
?>