Error: [' . $exception->getCode() . '] ' . $exception->getMessage() . '

'; }); require_once 'xmlrpc/lib/xmlrpc.inc'; require_once 'sipgateAPI.php'; require_once 'blacklist.php'; require_once 'config.php'; $sipgate = new sipgateAPI($username, $password); $balance = $sipgate->getBalance(); //echo '

Guthaben: ' . round($balance['CurrentBalance']['TotalIncludingVat'], 2) . ' ' . $balance['CurrentBalance']['Currency'] . '

'; if ($_POST) { $message = str_replace("\r", "", trim($_POST['message'])); $blacklist = read_blacklist($blocked); if (!isset($_POST['message'])) { throw new Exception('No message!', 5); } if ($_POST['antispam'] != md5($message)) { throw new Exception('Are you cheating me?! Please activate Javascript!', 1); } if (strlen($message) > 160) { throw new Exception('Your message is too long!'); } if ($balance['CurrentBalance']['TotalIncludingVat'] < 1) { throw new Exception('No balance left!', 2); } if ($time = is_blacklisted($blacklist, $_SERVER['REMOTE_ADDR'])) { throw new Exception('You can only send one SMS per day! Please wait ' . format_duration($blocked - (time() - $time)) . '!', 3); } //$sipgate->sendSMS($mobilenumber, $message, NULL, $mobilenumber); if ($_SERVER['REMOTE_ADDR'] != '172.0.0.1') $blacklist[] = array($_SERVER['REMOTE_ADDR'], time()); echo '

SMS has been send!

Thank you :)

back

'; write_blacklist($blacklist); } else { $message = (isset($_REQUEST['message'])) ? $_REQUEST['message'] : ''; echo '
To++' . $mobilenumber . '
Message
Length' . strlen($message) . ' (left: ' . (160 - strlen($message)) . ')
'; } function format_duration($time) { if ($time < 60) { return $time . ' seconds'; } elseif ($time < 3600) { return floor($time/60) . ' minutes'; } else { return floor($time/3600) . ':' . floor(($time%3600)/60) . ' hours'; } } ?>