-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcall_authenticate.php
More file actions
34 lines (29 loc) · 1.03 KB
/
call_authenticate.php
File metadata and controls
34 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
session_start();
// report all errors
error_reporting(E_ALL);
ini_set('display_errors', 1);
// load the SureDone library
require_once ('includes/SureDone_Startup.php');
// if Authentication option is selected
// start - Authentication
echo "---- Testing Authentication ----<br>";
echo 'Parameters <br>';
echo 'username: <br>';
echo($_REQUEST['username']);
echo '<br> password: <br>';
echo($_REQUEST['password']);
echo '<br> token: <br>';
echo($_REQUEST['token']);
echo '<br>';
$rbody = SureDone_Store::authenticate($_REQUEST['username'], $_REQUEST['password'], $_REQUEST['token']);
$responseObj = json_decode($rbody);
if (isset($responseObj->token)) {
$token = $responseObj->token;
$_SESSION['username'] = $_REQUEST['username'];
$_SESSION['token'] = $token;
echo (isset($token) ? "Authentication successful" : "" ) . "<br>" . "token:" . $token . "<br>";
} else {
echo "Invalid username or password/token.";
}
?>