// ================================ 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(); if ($theBuyer['number'] == $receivedFrom) { // check to make sure they have not verified already if (NULL !== $mm->getIsWeekStatusSet()) { $mm->setSendMessage($receivedFrom, 'Sorry, you\'ve already replied a status for this week!'); header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200); exit; } // is this a confirmation from the buyer? if ('yes' == strtolower(substr($messageBody, 0, 4))) { $mm->setSendMessageToAll("Kudos to {$theBuyer['name']}! Monster Monday is a go."); $mm->setWeekStatus(TRUE); // mark this week as a success $mm->logMessage('localhost', "Kudos to {$theBuyer['name']}! Monster Monday is a go."); header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200); exit; } // is this a cancelation from the buyer? if ('no' == strtolower(substr($messageBody, 0, 2))) { $mm->setSendMessage($receivedFrom, "Monster Monday is off. {$theBuyer['name']} has declined. Well, this sucks."); $mm->setWeekStatus(FALSE); // mark this week as a fail $mm->logMessage('localhost', "Monster Monday is off. {$theBuyer['name']} has declined. Well, this sucks."); header($_SERVER['SERVER_PROTOCOL'] . ' OK', true, 200); exit; } }