Rev 2 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 4 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | require_once __DIR__ . '/../vendor/autoload.php'; |
21 | require_once __DIR__ . '/../vendor/autoload.php'; |
22 | } |
22 | } |
23 | 23 | ||
24 | require_once __DIR__ . '/../ClientChallenge.class.php'; |
24 | require_once __DIR__ . '/../ClientChallenge.class.php'; |
25 | 25 | ||
26 | define('MAX_TIME', 10); // seconds |
26 | require_once __DIR__ . '/config.inc.php'; |
27 | 27 | ||
28 | if (isset($_REQUEST['action']) && ($_REQUEST['action'] === 'add_numbers')) { |
28 | if (isset($_REQUEST['action']) && ($_REQUEST['action'] === 'add_numbers')) { |
29 | 29 | ||
30 | // Check request field "vts_validation_result" for valid response of the Challenge |
30 | // Check request field "vts_validation_result" for valid response of the Challenge |
- | 31 | try { |
|
31 | \ViaThinkSoft\RateLimitingChallenge\ClientChallenge::checkValidation(MAX_TIME); |
32 | \ViaThinkSoft\RateLimitingChallenge\ClientChallenge::checkValidation(MAX_TIME, VTS_CS_SERVER_SECRET); |
- | 33 | } catch (\Exception $e) { |
|
- | 34 | $res = array("error" => $e->getMessage()); |
|
- | 35 | header('Content-Type:application/json'); |
|
- | 36 | die(json_encode($res)); |
|
- | 37 | } |
|
32 | 38 | ||
33 | // Do your stuff here. Example: |
39 | // Do your stuff here. Example: |
34 | $a = $_REQUEST['a']; |
40 | $a = $_REQUEST['a']; |
35 | $b = $_REQUEST['b']; |
41 | $b = $_REQUEST['b']; |
36 | 42 |