if ($retval != 0) { die("Failed to unmodify firewall rules: " . $res); } } function set_sleep_off($file = SLEEPFILE) { file_put_contents($file, "0"); } function get_sleep_start($file = SLEEPFILE) { return file_get_contents($file); } // See if today is Sunday, noon or later, and we have not already modified the firewall $day = date('D'); $hour = (int) date('G'); $state = get_firewall_state(); $sleep_start = get_sleep_start(); if ($day == "Sun" && $hour >= 12 || $day == "Mon" && $hour < 9) { if ($state != "modified") { echo "Firewall unmodified.\n"; if ($sleep_start > 0) { if (time() - $sleep_start >= 60 * 30) { echo "30 minute sleep time passed. Modifying firewall.\n"; modify_firewall(); set_sleep_off(); } else { echo "30 minute sleep not passed. (" . (30 * 60 - (time() - $sleep_start)) . " second(s) left)\n"; } } else { echo "No sleep record found.\n"; if (time() - get_firewall_mtime() >= 60 * 60 * 24) {
header("Connection: close"); // print_r($_SERVER); function real_request() { return "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } if ($_SERVER['HTTP_HOST'] != "datc.aaronnet.woot.myvwan.com:81") { header("Location: http://datc.aaronnet.woot.myvwan.com:81/index.php?dest=" . urlencode(real_request())); exit; } require 'webscheduler.inc.php'; if (isset($_POST['trashdone'])) { if ($_POST['trashdone'] == "Yes") { if (isset($_POST['pin']) && $_POST['pin'] == "4042") { if (get_firewall_state() != "unmodified") { unmodify_firewall(); } set_sleep_off(); header("Location: " . (isset($_GET['dest']) ? $_GET['dest'] : "http://www.google.com/ig")); exit; } } else { set_trash_sleep(); unmodify_firewall(); header("Location: " . (isset($_GET['dest']) ? $_GET['dest'] : "http://www.google.com/ig")); exit; } } ?> <html>
} a { color: yellow; } </style> <script type="text/javascript"> function viewandclose() { win1 = window.open("index.php"); self.close(); } </script> </head> <body> <p> Web Access: <span style="font-weight: bold;"><?php echo get_firewall_state() == "unmodified" ? "Permitted" : "Denied"; ?> </span> </p> <?php if ($sleep_start > 0) { ?> <p> Sleep time remaining: <span style="font-weight: bold;"><?php echo pretty_time(30 * 60 - (time() - $sleep_start)); ?> </span> </p> <?php } ?>