Posted by Raj on 10/18/05 22:12
Hi,
I have a website that redirects users to the "intro_page" via the start page
if they enter the website anywhere except the start page. Here's the script
for the start page. The first bit checks to see if the forwarding page has
set the "s" value. If it has then it finds the appropriate website name, logo
etc. This is to tailor make the look and feel of the site according to where
it has come from.
Here's the script. It doesn't go to intro_page.php. It just sits on
start.php.
I'm using PHP5 and MySQL 4.1.14.
Many thanks,
Raj
Here's the script:
<?php
session_start();
session_destroy();
include("./general_scripts_etc/header1.php");
$s=$_GET['s'];
$query="SELECT * FROM site_data WHERE site_name='$s'";
$result=@mysql_query($query);
$num=mysql_num_rows($result);
if ($num==0)
{
$query="SELECT * FROM site_data WHERE site_number='1'";
$result=@mysql_query($query);
while ($Row=mysql_fetch_array($result))
{
$_SESSION['site_name']=$Row[site_name];
$_SESSION['site_logo_location']=$Row[site_logo_location];
$_SESSION['site_admin_email']=$Row[site_admin_email];
$_SESSION['site_number']=$Row[site_number];
ob_end_clean();
header("Location: intro_page.php");
}
}
if ($num==1)
{
while ($Row=mysql_fetch_array($result))
{
$_SESSION['site_name']=$Row[site_name];
$_SESSION['site_logo_location']=$Row[site_logo_location];
$_SESSION['site_admin_email']=$Row[site_admin_email];
$_SESSION['site_number']=$Row[site_number];
ob_end_clean();
header("Location: intro_page.php");
}
}
include("./general_scripts_etc/footer1.php");
?>
Navigation:
[Reply to this message]
|