Forum Moderators: coopster
First question of many to come :) -
In classic asp I could have a script similar to this (I am stripping out the basic code, so you can get the general idea for those not familiar with Classic ASP)
if username = "somevalue" then
session = 1
response.redirect "abc.html"
else
session = 2
response.redirect "error.html"
In PHP when I write a similar script, I get errors. The only redirect script I have found after many searches, works great if it is the only script on the top of the page.
Any advice is appreciated.
Thanks -
Hal
<?PHP
session_start();
if (isset($_SESSION['mysession']) && $_SESSION['mysession']==1)
{
header("Location: somepage.htm");}
}
else
{
header("Location: errorpage.htm");
}
?>
the header redirect works only if no other output is send to the browser, thus put it on very top of page
<?php
$username = $_POST['USER'];
$passw = $_POST['PASSWORD'];
if ($username == "admin" && $passw=="pw"){
header("Location: /page1.html");
}
else{
header("Location: /page2.html");
}
?>
This isn't the best way to do it if you have alot of members, you probably wan't a MySql Database or something for that.