-
Notifications
You must be signed in to change notification settings - Fork 0
/
session_user.php
33 lines (25 loc) · 1.05 KB
/
session_user.php
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
<?php
session_start();// Starting Session
// Storing Session
$logged_in_user=$_SESSION['login_user'];
// Get the JAID using the username
$headers = array('Content-Type' => 'application/json', 'Authorization' => getAuthorization());
$response = Unirest\Request::get(getAPIURL() . 'client/username/' . $logged_in_user, $headers);
foreach ($response->body as $user) {
$JAID = $user->JAID;
}
// Get the Order ID
$headers = array('Content-Type' => 'application/json', 'Authorization' => getAuthorization());
$response = Unirest\Request::get(getAPIURL() . 'client/' . $JAID . '/order', $headers);
foreach ($response->body as $order) {
$order_ID = $order->OrderID;
}
// Get First Name and Email
$headers = array('Content-Type' => 'application/json', 'Authorization' => getAuthorization());
$response = Unirest\Request::get(getAPIURL() . 'client/' . $JAID, $headers);
$name = $response->body->FirstName;
$email = $response->body->Username;
if(!isset($JAID) && !isset($order_ID)){
header('Location: index.php'); // Redirecting To Home Page
}
?>