how to redirect from php page

A

Anonymous

Guest
hi, is there a way to redirect to a different page from a php page? for example. i want a user after log into my website, check the user password and so on, if it correct, i want to redirect to a different correct page, if the user and password is wrong, then i redirect to error page and so on. is there a way to redirect a page or load other page from a php page without using <meta > tag?

Thanks
 
yes, that's possible.
Code:
header("Location: script2.php?password=xxxxx");
that will not work if you already have sent a header information or some (echo/print) - text...

||EDIT:
another way:
Code:
if ($password == "example") include("rightpw.php");
else include("falsepw.php");
 
Another way to redirect the user is to use a meta header
you can see a message something like

You are bein redirected, if your browser does not support meta redirection then click here

eg.
Code:
echo ("<meta htt-equiv='refresh' content='3; newpage.php'>");
Just include the above code into your
 
Remember on the file where the correct password has taken them - To check they are authorised to view that page.
 
Back
Top