470,832 Members | 2,075 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,832 developers. It's quick & easy.

No redirection? Please help.

Raj
Hi,

The following script outputs 12345. It should go to intro_page.php after the
4 session variables have been populated. Can you see what I'm doing wrong?

Many thanks,

Raj (newbie)
start.php

<?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);
print("1");
$num=mysql_num_rows($result);
print("2");
if ($num==0)
{
print("3");
$query="SELECT * FROM site_data WHERE site_number='1'";
print("4");
$result=@mysql_query($query);
print("5");
while ($Row=mysql_fetch_array($result))
{
print("6");
$_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>0)
{
print("7");
while ($Row=mysql_fetch_array($result))
{
print("8");
$_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");
?>
header1.php

<?php
ob_start();
session_start();
include('../outer/mysql_connect_fdd.php');

//limit is number of users listed per search page
$limit=10;

//live_limit is time to wait till offline
$live_limit=15*60;

//the limit to the number of pages appearing on the bottom of pages
$menu_max=25;

//log refrsh time
$log_refresh=30;

//time to wait till wipe instant message - seconds
$instant_message_wipe=15*60;

//time to wait till wipe old other - seconds
$other_points_wipe=30*24*60*60;

//address to send photos for verification
$photo_verify_address="http://www.freedatingdatabase.com/admin777/photo_verifi
cation.php?user_id="
?>
footer1.php

<?php
ob_end_flush();
?>
mysql_connect_fdd.php

<?
define('DB_USER', 'lkjsdflkdf');
define('DB_PASSWORD', 'lkhjdsflkhj');
define('DB_HOST', 'localhost');
define ('DB_NAME', 'db1');
$dbc=@mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect
to database. Please try later. Error: '.mysql_error());;
mysql_select_db(DB_NAME);
@mysql_select_db (DB_NAME) OR die ('Could not select the
database:'.mysql_error());
?>

Oct 19 '05 #1
3 1279

"Raj" <ra*@nospam.com> wrote in message
news:00*****************************@news.zen.co.u k...
Hi,

The following script outputs 12345. It should go to intro_page.php after
the
4 session variables have been populated. Can you see what I'm doing wrong?

Unless you buffer your output, header()'s have to be written before any
output to your client screen.

Check this out:

http://us3.php.net/header

-Don
--
Ever had one of those days where you just felt like:
http://cosmoslair.com/BadDay.html ?
Oct 19 '05 #2
Yes, but the script isn't getting that far. There are no lines in the
returned dataset, so either there is something wrong with the sql, or
there is no site_number 1.

Ian

Oct 19 '05 #3
Raj wrote:
Hi,

The following script outputs 12345. It should go to intro_page.php after the
4 session variables have been populated. Can you see what I'm doing wrong?

Many thanks,

Raj (newbie)


Once you do any output, you cannot use the header() function and get it
to do what you expect. Calling header *must* be done *before* any other
output.

Try changing the print() to some form of debug logging instead if you
want to trace your code this way.

-david-

Oct 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by RX | last post: by
5 posts views Thread by Jerry | last post: by
4 posts views Thread by Dustin | last post: by
52 posts views Thread by Gerard M Foley | last post: by
2 posts views Thread by Mitul | last post: by
8 posts views Thread by Luciano A. Ferrer | last post: by
13 posts views Thread by souissipro | last post: by
4 posts views Thread by segis bata | last post: by
9 posts views Thread by Nick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.