login($name, $password); if ($token == null) { header('Location:index.php'); } else { setcookie('token', $token, time() + 3600); header('Location:main.php'); } } ?>