function logError($e, $errorType) { // Get AWS DynamoDB Client $dbClient = DynamoDBClient::factory(array('region' => 'us-west-2')); // Make insert into errors table in database $errorDate = new DateTime(); $dbClient->putItem(array('TableName' => 'errors', 'Item' => array('errorId' => array('S' => uniqid()), 'errorDate' => array('N' => $errorDate->getTimestamp()), 'errorType' => array('S' => $errorType), 'message' => array('S' => $e->getMessage()), 'code' => array('N' => $e->getCode()), 'fileName' => array('S' => $e->getFile()), 'line' => array('N' => $e->getLine())))); echo json_encode(array('message' => 'error')); }
function getNewEmailToken($email, $tokenId) { $dbClient = DynamoDBClient::factory(array('region' => 'us-west-2')); $dbClient->putItem(array('TableName' => 'tokens', 'Item' => array('tokenId' => array('S' => $tokenId), 'insertedDate' => array('N' => time()), 'email' => array('S' => $email)))); return $tokenId; }