Good day i have written a code for login into a dashboard that works perfectly, my challenge is i want the when logged in i want the response to be displayed on the next page i.e dashboard see the code below.
$data = array(
'EmailAddress' => 'john@example.com',
'Password' => '1234567890',
'SubscriberID' => '1b2b3h4g7s3t9f8s7w'
);
$url = "login.php";
$nextPage = "dashboard.php";
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $data ),
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
$response = json_decode( $result, true );
//echo $result; to see the result remove comment and add comment to header('Location: '.$nextPage);
if ($response["Message"] !== "The request is invalid." && $response["Authenticated"]) {
echo "login successfull";
header('Location: '.$nextPage);
} else {
echo "login failed!";
}
Kindly help