xlusive said:
you have to put the header("Location: url.php"); at the top of your page
example:
if you have:
<?
session_start();
if(!isset($_session[user]) && !isset($_session[pass]))
{
echo " you have to login ";
exit;
header("Location: /url");
}
then you get the header already send becasue basicly you send the output via an echo through the browser to the user.
thats why you get the header already sent error,
First thing.. Echo has to go after the headers.. No output (print, echo,etc) can go before headers.
Now.. There is no other real way.. You can use other programming languages.. Such as VB lol..
<SCRIPT RUNAT=Server Language=VBScript>
Sub Session_OnStart
Dim varStartPage
Dim varCurentPage
'Check to see if current page is the correct login page
varStartPage = "/LogIn/LogIn.asp"
'Get the current page
varCurrentPage = Request.ServerVariables("SCRIPT_NAME")
'If page is not correct then send the visitor to the correct login page
If StrComp(varCurrentPage, varStartPage, 1) Then
Response.Redirect( StartPage)
End If
End Sub
</SCRIPT>
But pretty much there is no HTML code for redirecting. Just JS, PHP, etc..
iNod