473,652 Members | 2,935 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_fet ch_array($resul t))
{
print("6");
$_SESSION['site_name']=$Row[site_name];
$_SESSION['site_logo_loca tion']=$Row[site_logo_locat ion];
$_SESSION['site_admin_ema il']=$Row[site_admin_emai l];
$_SESSION['site_number']=$Row[site_number];
ob_end_clean();
header("Locatio n: intro_page.php" );
}
}
if ($num>0)
{
print("7");
while ($Row=mysql_fet ch_array($resul t))
{
print("8");
$_SESSION['site_name']=$Row[site_name];
$_SESSION['site_logo_loca tion']=$Row[site_logo_locat ion];
$_SESSION['site_admin_ema il']=$Row[site_admin_emai l];
$_SESSION['site_number']=$Row[site_number];
ob_end_clean();
header("Locatio n: intro_page.php" );
}
}
include("./general_scripts _etc/footer1.php");
?>
header1.php

<?php
ob_start();
session_start() ;
include('../outer/mysql_connect_f dd.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_messag e_wipe=15*60;

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

//address to send photos for verification
$photo_verify_a ddress="http://www.freedatingd atabase.com/admin777/photo_verifi
cation.php?user _id="
?>
footer1.php

<?php
ob_end_flush();
?>
mysql_connect_f dd.php

<?
define('DB_USER ', 'lkjsdflkdf');
define('DB_PASS WORD', 'lkhjdsflkhj');
define('DB_HOST ', 'localhost');
define ('DB_NAME', 'db1');
$dbc=@mysql_con nect(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_d b (DB_NAME) OR die ('Could not select the
database:'.mysq l_error());
?>

Oct 19 '05 #1
3 1389

"Raj" <ra*@nospam.com > wrote in message
news:00******** *************** ******@news.zen .co.uk...
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
1642
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"); session_register("username");
5
1998
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 B through the header() function. Using something like header("Location:http//mydomain.com/scriptb.php");
4
4228
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 (outside my network). After spending a couple of days trying to correct this i decided that the easiest way to get the camera to work would be to redirect a connection through a computer and then to the camera. I decided to do some research on...
52
5428
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. Happy New Year -- Gerry
2
1684
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. here is the displayed alert. "Redirection limit for this URL exceeded. Unable to reach the requested page. This may be caused by cookies that are blocked."
8
2525
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 %{HTTP_HOST} !^domain\.com.ar RewriteRule ^/(.*) http://domain.com.ar/$1
13
2693
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, and also from a file conatining the commands 2- does the redirection of the input and output from and to files. 3- retrieve the environment variables like HOME,..
4
27520
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 (othersite/c.asp) and finally display the web page I want the user to see (finalwebsite/d.asp) What I want to do is, once they click the link (b.asp) located in the a.asp webpage, to load a "please wait" type of page, like Expedia does while...
9
2004
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 application calls FormsAuthentication.RedirectToLoginPage() then the URL becomes malformed. I then recieve the following error, "The return URL specified for request redirection is invalid."
0
8370
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8590
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.