Redirect in PHP
Posted: Mon Feb 27, 2006 11:42 pm
Hi
I have a question in ASP we have Response.Redirect" ";
What do we use in PHP?
I have a question in ASP we have Response.Redirect" ";
What do we use in PHP?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$url = "main.php";
if ($name == "Heba" && $pass == "123")
{
header('Location: $url'); /* Redirect browser */
exit;
?>
<?
}
else
{
echo ("Sorry. You are not authorized to access this page");
echo ("<br>"."Go <a href='Index.php'> Back </a>");
} ?>Code: Select all
$url = "http://localhost/Warehouse_Services_Operations_System/main.php"Code: Select all
<?
$url = "main.php";
if ($name == "nicky" && $pass == "123")
{
header('Location:http://localhost/Warehouse_Services_Operations_System/'.$url); /* Redirect browser */
exit;
}
else
{
echo ("Sorry. You are not authorized to access this page");
echo ("<br>"."Go <a href='Index.php'> Back </a>");
} ?>Code: Select all
<?
$url = "http://localhost/Warehouse_Services_Operations_System/main.php";
if ($name == "nicky" && $pass == "123")
{
header("Location:$url"); /* Redirect browser */
exit;
}
else
{
echo ("Sorry. You are not authorized to access this page");
echo ("<br>"."Go <a href='Index.php'> Back </a>");
} ?>Code: Select all
<?php
if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') //if form has been submitted
{
$url = "main.php";
$denied = "";
$name = $_POST['name'];
$pass = $_POST['pass'];
if ($name == "Heba" && $pass == "123")
{
header('Location: '.$url.''); /* Redirect browser */
exit;
}
else {
$denied = "Sorry. You are not authorized to access this page<br>Go <a href='index.php' onclick='history.go(-1);return false'> Back </a>";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>TITLE</title>
<body>
<?php
if(!empty($denied))
{
echo $denied;
}
?>
</body>
</html>