Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Тут задаём пароль
- $pass = '154575';
- if (is_file('base.txt')) $all = json_decode(file_get_contents("base.txt"), 1);
- $logg = false;
- if ($_POST['plus'] > 0) {
- $all['total'] = $all['total'] + $_POST['plus'];
- }
- if ($_POST['minus'] > 0) {
- $all['total'] = $all['total'] - $_POST['minus'];
- }
- if ($_COOKIE['pass2'] == 'lg') {
- $logg = true;
- }elseif ($_POST['pass'] == $pass) {
- setcookie('pass2', 'lg');
- $logg = true;
- }
- ?><!DOCTYPE html>
- <html>
- <head>
- <title>КАБИНЕТ</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- </head>
- <body>
- <?php
- if ($logg) {
- echo '<p>Текущий промежуток длинной: <b>' . $all['total'] . '</b> дн.</p>';
- $start = & $all['start'];
- if (!isset($start)) $start = date('Y-m-d H:i');
- $seconds = time() - strtotime($start);
- $dd = floor($seconds / 86400);
- $hh = floor(($seconds - ($dd * 86400)) / 3600);
- $hs = 24 - $hh;
- $ds = $all['total'] - $dd - 1;
- echo 'Держимся от: ' . $start . ' \ ' . $dd . ' дн. ' . $hh . ' час.';
- echo ' \ осталось <b>' . $ds . ' дн. ' . $hs . ' час.</b><br/><br/>';
- $dateDo = strtotime($start) + $all['total'] * 86400;
- $dayarr = array('понедельника', 'вторника', 'среды', 'четверга', 'пятницы', 'субботы', 'воскресенья');
- $dayarr2 = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
- echo 'Держимся до: ' . str_replace($dayarr2, $dayarr, date('D, Y-m-d H:i:s', $dateDo)) . '<br><br>';
- echo '<b>Добавить</b><br>
- <form method="post">
- <input name="plus" value="1"><input type="submit" value="OK">
- </form><br>';
- echo '<b>Уменьшить</b><br>
- <form method="post">
- <input name="minus" value="1"><input type="submit" value="OK">
- </form>';
- file_put_contents("base.txt", json_encode($all));
- }
- ELSE {
- echo ' <form method="post">
- <input type="password" name="pass"><input type="submit" value="OK">
- </form>';
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement