I have this login.php and a javascript to sync the date and time from the client browser to the server of my openwrt router. What I want is, every time a user successfully logs in, it'll execute that javascript and then redirect to status.php which is the home page. Here's what I've tried so far
if ($_POST['username'] == $user[0] && $_POST['password'] == $pass[0]) {
$_SESSION['loggedin'] = 1;
echo '<script src="date.js"></script>';
header("Location: status.php");
exit;
}
But it gives me this error:
Warning: Cannot modify header information - headers already sent by (output started at /www/login.php:10) in /www/login.php on line 11
How do I fix it ?
Some of you may think my question is a duplicate but please understand that I need to execute that javascript after successful login.