[ create a new paste ] login | about

Link: http://codepad.org/ck5rrh0b    [ raw code | fork ]

PHP, pasted on Jun 10:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="de">
<head>
<title>Zeitschaltuhr</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="DISALLOW">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style type="text/css">
    body {
        background-color: #000000;
        color: white;
    }
    .wrapButtons {
        text-align: center;
        font-size: 60px;
        font-family: "Verdana";
    }
    .currentClock  {
        font-size: 25px;
        font-weight: 600;
        padding-right: 15px;
    }
</style>
<script type="text/javascript">
    function addZero(i) {
        if (i < 10) {
            i = "0" + i;
        }
        return i;
    }
    function Clock() {
        var x = document.getElementById("currentClock");
        var time = new Date();
        var h = addZero(time.getHours());
        var m = addZero(time.getMinutes());
        var s = addZero(time.getSeconds());
        x.innerHTML = h + ":" + m + ":" + s;
    }
    setInterval(function(){ Clock() }, 1000);
</script>
</head>
<body onLoad="Clock();">
<div style="float:right; margin-top:-4px;">
    <span id="currentClock" class="currentClock"></span>
</div>
<br/>
<hr noshade size="5">
<?php
$ZeitenDatei = "txt.cron";

// Schreibe neue Schaltzeit in Datei
if (isset($_GET['hour'])) {
    $HOUR = sprintf("%02d", $_GET['hour']);
    if (!isset($_GET['min'])) { $MINUTE = 00; } else { $MINUTE = sprintf("%02d", $_GET['min']); }
    if (!isset($_GET['day'])) { $DAY = date('d'); } else { $DAY = sprintf("%02d", $_GET['day']); }
    if (!isset($_GET['mon'])) { $MONTH = date('m'); } else { $MONTH = sprintf("%02d", $_GET['mon']); }
    file_put_contents($ZeitenDatei, "$HOUR:$MINUTE $DAY.$MONTH\n", FILE_APPEND);
}

if (file_exists($ZeitenDatei)) {
    $Data = file($ZeitenDatei);
    if (!empty($Data)) {
        echo "Erstellte Zeit(en):\n<br/>";
        foreach($Data AS $line_num => $line) {
            echo $line ."<br/>";
        }
    }
}
echo "<br/>";
?>
<!-- Zeit Erstellen -->
<form action="zeitschaltuhr.php" method="GET">
    <input type="number" min="0" max="23" name="hour" required="required"> : <input type="number" min="0" max="59" name="min">
    <input type="submit" value="Erstellen">
</form>
</body>
</html>


Create a new paste based on this one


Comments: