diff --git a/vendor-payouts.php b/vendor-payouts.php index 217b8fe..d4bb7b5 100644 --- a/vendor-payouts.php +++ b/vendor-payouts.php @@ -8,7 +8,22 @@ if ($_SESSION["userId"] <> "") { header("location: login.php"); } -// $customer_data = getCustomerbyLoginId($_SESSION["userId"]); +if (isset($_SESSION["token"])) { + $token = $_SESSION["token"]; + $token_parts = explode(".", $token); + $token_payload = base64_decode($token_parts[1]); + $token_data = json_decode($token_payload); + + $issued_at_time = $token_data->iat; + $expiration_time = $token_data->exp; + $renewal_time = $issued_at_time + 3300; + + if (time() >= $renewal_time || time() >= $expiration_time) { + header("Location:vendor-payoutsTokenRN.php"); + exit; + } +} + $vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]); $vendorLoginIdjson = json_decode($vendorLoginId, true); if (isset($vendorLoginIdjson['results'][0])) { @@ -17,24 +32,8 @@ if (isset($vendorLoginIdjson['results'][0])) { $_SESSION["LoggedInVendorId"] = $vendorId; } -$token = $_SESSION["token"]; - -$token_parts = explode(".", $token); -$token_payload = base64_decode($token_parts[1]); -$token_data = json_decode($token_payload); - -$expiration_time = $token_data->exp; -$issued_at_time = $token_data->iat; - -$renewal_time = $issued_at_time + 3300; - - -if (time() >= $renewal_time) { - $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token); - $_SESSION["token"] = $token; -} - $authToken = $_SESSION['token']; + $response = getAllPayout($authToken); $vendorPayoutData = json_decode($response, true); @@ -81,23 +80,6 @@ $vendorPayoutData = json_decode($response, true); -
@@ -155,19 +137,6 @@ $vendorPayoutData = json_decode($response, true); @@ -269,12 +238,12 @@ $vendorPayoutData = json_decode($response, true); -Someone in new just bought
+10 Minutes ago
+