473,411 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

One script passing control to the other?

Elo,
I'm having a terrible trouble with a simple, as I think, issue. I need
to stop my script in the middle of proccesing, and, simultanously, start
a new script. The idea is not to sent any output to web browser before
the second script is done. Typical scenario should goes like this:
- script a.php ends its execution with some error, instead of sending
its output to the browser, a.php passes control to b.php
- output is being cleared, script b.php renders it from scratch, then
sends back to the browser

Is it possible (like in ASP.NET lets say - Server.Redirect())?

Many thanks for help!

--
Pawel Halastra 'FrT'
Jan 5 '07 #1
4 1517

Pawel Halastra FrT wrote:
Elo,
I'm having a terrible trouble with a simple, as I think, issue. I need
to stop my script in the middle of proccesing, and, simultanously, start
a new script. The idea is not to sent any output to web browser before
the second script is done. Typical scenario should goes like this:
- script a.php ends its execution with some error, instead of sending
its output to the browser, a.php passes control to b.php
- output is being cleared, script b.php renders it from scratch, then
sends back to the browser

Is it possible (like in ASP.NET lets say - Server.Redirect())?

Many thanks for help!

--
Pawel Halastra 'FrT'
header('Location: b.php');

Jan 5 '07 #2
ZeldorBlat wrote:
header('Location: b.php');
Thanks, but this is totally not what I'm looking for.

header('Location: b.php') will send back the output to the browser, then
the browser will require "b.php", so unnecesary post-back is performed.

--
Pawel Halastra 'FrT'
Jan 5 '07 #3
Rik
Pawel Halastra FrT wrote:
Elo,
I'm having a terrible trouble with a simple, as I think, issue. I need
to stop my script in the middle of proccesing, and, simultanously,
start a new script. The idea is not to sent any output to web browser
before the second script is done. Typical scenario should goes like
this: - script a.php ends its execution with some error, instead of
sending its output to the browser, a.php passes control to b.php
- output is being cleared, script b.php renders it from scratch, then
sends back to the browser

Is it possible (like in ASP.NET lets say - Server.Redirect())?

Many thanks for help!
Well, unless there are fatal errors in a.php, use the output buffering
functions (ob_start() in a.php, ob_end_clean() in b.php).

When there are fatal errors in a.php it's somewhat trickier. You might want
to use set_error_handler() for this one, but be very sure what you're
doing. It will still not be able to catch every error though...
--
Rik Wasmus
Jan 5 '07 #4
Road on ob_start, ob_flush, ob_clean..... and ob related function.
I often redirect my script as well, but I do it simply by including that
file.

Example:
if(!@statement a) {
include('b.php');
exit();
}

PS: BTW the @ sign is to suppress the error msg. And bare in mind that
this is a simple
example. There are more better way to handle error.

Hendri Kurniawan

Pawel Halastra FrT wrote:
Elo,
I'm having a terrible trouble with a simple, as I think, issue. I need
to stop my script in the middle of proccesing, and, simultanously, start
a new script. The idea is not to sent any output to web browser before
the second script is done. Typical scenario should goes like this:
- script a.php ends its execution with some error, instead of sending
its output to the browser, a.php passes control to b.php
- output is being cleared, script b.php renders it from scratch, then
sends back to the browser

Is it possible (like in ASP.NET lets say - Server.Redirect())?

Many thanks for help!

--
Pawel Halastra 'FrT'
Jan 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Gregory | last post by:
Hello, I'm trying to do the above in order to process an image and return the result to an html image control. It fails and my key suspects are either the variable that I'm passing in -...
8
by: jasonbrown1999 | last post by:
Someone told me the following script could be used to run harmful commands on the server, by passing commands into the script. What the script does is encode an affiliate URL, create two frames,...
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
11
by: comp.lang.php | last post by:
On one of my sites, I have a TCL CGI script that has a security hole in spite of it having effective server-side validation (the fact that it's CGI IS its security hole). The front end is a PHP...
10
by: Mark Denardo | last post by:
Hi, I have multi-threaded application that requires one particular thread (Non-Form based) to receive data from other threads. I know how to pass control to Form Threads, but I believe there's no...
11
by: Gregor Kovač | last post by:
Hi! I have an SQL script with bunch of CREATE TABLES, ALTER TABLES, ... I'd like it to run transactially. I have found that id I run a ALTER STATEMENT inside a transaction and then roll it back...
1
by: vvgopal2k | last post by:
Hi Group, I am facing a problem in ASP.net usercontrols. Here is the Program. When a Click a button on the usercontrol page, a panel shows up on the same user control, this panel has some...
6
by: =?iso-8859-1?q?Luis_M._Gonz=E1lez?= | last post by:
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the "setup.py" script for py2exe. It simply prompts for the main executable script...
5
by: Ludwig | last post by:
I have a user control news.ascx that lists news items, and it has add/edit/delete linkbuttons. This user control is on the default.aspx page together with other user controls. When the edit...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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...

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.