Header function not working

Hello,

On the basis of a condition i am evluating value in php. code is:

<?php
include_once("php_includes/check_login_status.php");
if($user_ok==TRUE)
{
$phpmsg='<font style="color:green;">User Verification Success.</font>';
}
else
 {
	 $phpmsg='<font style="color:red;">User Verification Failed.</font>';
   	}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php echo $phpmsg;?>
<?php if ($phpmsg=="User Verification Failed."){header( "refresh:8;url=login.php" );}?>
</body>
</html>

It is printing the result right, but not getting refreshed to the login page.

Thanks
Shail

http://php.net/header

<?php
// ...
header('Location: login.php');
exit;
1 Like

Before moving to that location , i want to show the message for 6seconds.

<?php
header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Try this !

i solved it… By some reasons, it was not taking the characters, so i change it to 0 for fail and 1 for success. It took that and script worked.

Thanks for your efforts.

Then you will need a javascript

<p>Show your text and...</p>
<script>
setTimeout(function(){
window.location = 'login.php';
}, 6000);
</script>

Is it possible to hold the first result hidden for 5seconds. Then that result appears and on the basis of that result, a redirect will happen after t seconds?

Presently, i m getting the result immediately and then redirecting to next page.