public static function test() { echo "PLATFORM: " . Util::getPLATFORM() . "<br/>\n"; echo "DEVICE MAC: " . Util::getDEVICE_MAC() . "<br/>\n"; echo "CAMPAIGN: " . Util::getCAMPAIGN() . "<br/>\n"; echo "CONNECTED MAC: " . Util::getCONNECTED_MAC() . "<br/>\n"; echo "SERVER URL: " . Util::getSERVER_URL() . "<br/>\n"; }
private static function writeToLog($LOGTYPE, $MSG, $TIMEZONE = NULL) { if ($TIMEZONE == NULL) { date_default_timezone_set('UTC'); } else { date_default_timezone_set($TIMEZONE); } $timestamp = date(Util::$DATE_FORMAT); $file = Util::$LOG_DIR . "/" . $LOGTYPE . "_" . Util::getPLATFORM() . "_" . Util::getDEVICE_MAC() . "_" . Util::getCAMPAIGN() . "_{$timestamp}.log"; $file_handle = null; if (file_exists($file)) { $file_handle = fopen($file, 'a') or die("Unable to open {$file}, check permissions"); } else { $file_handle = fopen($file, 'w') or die("Unable to create {$DIR}{$file}, check permissions"); } if (is_writable($file)) { fputs($file_handle, $MSG); fclose($file_handle); return true; } else { echo "{$file} Is not writable."; } return false; }
public static function gatewayForm($buttonName = 'Get Offers') { $mac = Util::getCONNECTED_MAC(NULL); $device_mac = Util::getDEVICE_MAC(); $campaign_id = Util::getCAMPAIGN(); $server = Util::getSERVER_URL(); $formData = '<form method="POST" action="http://' . $server . '/api/gateway"> <input type="hidden" name="device_macaddress" value="' . $device_mac . '"> <input type="hidden" name="user_macaddress" value="' . $mac . '"> <input type="hidden" name="campaign_id" value="' . $campaign_id . '"> <br/><input type="submit" value="' . $buttonName . '"></form> '; print $formData; }