$floID, "pubKey" => $pubKey, "message" => $s_id, "sign" => $sign ); $make_call = callAPI('POST', 'https://flo-sign-validator.duckdns.org', json_encode($data_array)); $response = json_decode($make_call, true); if ($response['success'] == 1) { //store $s_id (session ID) in SQl ob_end_clean(); ob_start(); setcookie("exchange[flo_id]", $floID, time () + (86400 * $cookie_life_days)); setcookie("exchange[session_id]", $s_id, time () + (86400 * $cookie_life_days)); setcookie("exchange[pub_key]", $pubKey,time () + (86400 * $cookie_life_days)); $_SESSION['page_action']='welcome'; header('Location: '.$_SERVER['PHP_SELF']); exit(); } else { echo ''; } } echo <<

Login using FLO Private Key


END; } if ($_SESSION['page_action']=='welcome'){ if (!isset($_COOKIE['exchange'])) { $_SESSION['page_action']='verify_login'; ob_end_clean(); ob_start(); header('Location: '.$_SERVER['PHP_SELF']); exit(); } echo << Exchange

Welcome

Logged in as {$_COOKIE['exchange']['flo_id']}
END; } if ($_SESSION['page_action']=='logout_request'){ if (isset($_COOKIE['exchange'])) { unset($_COOKIE['exchange[flo_id]']); setcookie('exchange[flo_id]', null, -1); unset($_COOKIE['exchange[session_id]']); setcookie('exchange[session_id]', null, -1); unset($_COOKIE['exchange[pub_key]']); setcookie('exchange[pub_key]', null, -1); unset($_COOKIE['exchange']); setcookie('exchange', null, -1); } ob_end_clean(); ob_start(); $_SESSION['page_action']='verify_login'; header('Location: '.$_SERVER['PHP_SELF']); exit(); } ?>