<?php /** * Created by PhpStorm. * User: davidkryzaniak * Date: 24/10/15 * Time: 16:10 */ require_once __DIR__ . '/../classes/MonsterMonday.php'; $mm = new MonsterMonday(); $timeIs = time() - strtotime("today"); //seconds since midnight $dayOfWeekIs = date('N'); // 7 == Sunday $TIME_NOON = 43200; //NOON $TIME_LAST_CALL = 64875; //6:15pm // are we in the correct time slot (Sunday) if (7 == $dayOfWeekIs && $timeIs > 43000 && $timeIs < 64875) { // is this the buyer? $theBuyer = $mm->getWeekBuyer(); $mm->setSendMessage($theBuyer['number'], 'MONSTER MONDAY REMINDER: Ohh Snap! It\'s your turn to buy! Please reply YES or NO to confirm.'); exit; } if (7 == $dayOfWeekIs && $timeIs > 64975 && $mm->getIsWeekStatusSet() === NULL) { // is this the buyer? $theBuyer = $mm->getWeekBuyer(); $mm->setSendMessageToAll("MONSTER MONDAY has been cancelled. {$theBuyer['name']} never replied to the reminder"); exit; }
<div class="container"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <h2 class="text-center">Available Commands:</h2> <p><code>list</code> Shopping list for Monster Monday</p> <p><code>next</code> Who's up next to buy</p> <p><code>broadcast: <em>message</em></code> Text everyone</p> <hr> </div> </div> <?php require_once __DIR__ . '/../classes/MonsterMonday.php'; date_default_timezone_set('America/Chicago'); $mm = new MonsterMonday(); $messages = $mm->getNewestMessages(); ?> <div class="content"> <?php if (count($messages)) { foreach ($messages as $single) { ?> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="testimonials"> <div class="active item"> <blockquote> <p><?php echo $single['message']; ?>
<?php date_default_timezone_set('America/Chicago'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); file_put_contents('logs/.' . time() . '.txt', print_r($_REQUEST, TRUE)); require_once __DIR__ . '/../classes/MonsterMonday.php'; $mm = new MonsterMonday(); //ensure we got a message from a known sender if (!isset($_REQUEST['Body']) || empty($_REQUEST['Body']) || !isset($_REQUEST['From']) || empty($_REQUEST['From'])) { header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); echo "unknown number or invalid body"; exit; } $messageBody = '' . trim($_REQUEST['Body']); $receivedFrom = '' . trim($_REQUEST['From']); $timeIs = time() - strtotime("today"); //seconds since midnight $dayOfWeekIs = date('N'); // 7 == Sunday $TIME_NOON = 43200; //NOON $TIME_LAST_CALL = 64875; //6:15pm $mm->logMessage($receivedFrom, $messageBody); // ================================ Do stuff with the message ================================ // // are we in the correct time slot (Sunday) if (7 == $dayOfWeekIs && $timeIs > 43200 && $timeIs < 64875) { // is this the buyer? $theBuyer = $mm->getWeekBuyer();