473,503 Members | 6,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1374

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1626
by: RX | last post by:
I try to use PHP to redirect to other page and failed. Please give me a help. Thanks. The script is: if($rows_num>0) { session_start(); session_register("userid");...
5
1983
by: Jerry | last post by:
Hi All I would very much appreciate your help: I have two scripts alternating in the background triggering themselves mutually. Here is how: 1.) Script A does something and then calls Script...
4
4221
by: Dustin | last post by:
I am trying to connect a camera through my router to put up onto a website. The camera (even after a firmware update) starts to get funny when i try to watch the video feed from above the router...
52
5385
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. ...
2
1673
by: Mitul | last post by:
Hello friends. I have some problem while submitting page. The alert will popup and display following message. So Please help me as soon as possible. I am not able to submit the page due to this....
8
2513
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
13
2677
by: souissipro | last post by:
Hi, I have written a C program that does some of the functionalities mentionned in my previous topic posted some days ago. This shell should: 1- execute input commands from standard input,...
4
27492
by: segis bata | last post by:
Hello all, I have a page (located at mywebsite/a.asp) that redirects to another page (theirwebsite/b.asp) located in other server. This other page probably will redirect to another link again...
9
1991
by: Nick | last post by:
Hi there, I'm passing an HTML encoded string to an URL in the query parameter. This query string works perfect in the website if you are already logged on, if you are not logged on the...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.