Re: [PHP] redirecting output for a spawned child process..

2009-02-23 Thread Alpár Török
You can use a PHP workarround. Install a custom ob_handler, that has a
static file descriptor, and writes all output to the file. In order to also
see everything, you need to also activate implicit flush. i know that there
would be lots of elegant ways to do this on linux in C, but AFAIK php
doesn't ofer anything like that.

here's some code (untested)

?php
function _myObHandler($sBuf)
{
   static $rFile = null;
   if ($rFile === null)
   {
  /// open the file here
   }
   fwrite($rFile,$sBuf);
   return $sBuf;
}

ob_start('_myObHandler');
ob_implicit_flush();

2009/2/21 Per Jessen p...@computer.org

 bruce wrote:

  hi...
 
  got a situation where i have a parent app that spawns children. trying
  to figure out how to get the output of the spawned/forked children to
  be written to an external file...

 Normally I would use freopen() on stdout and stderr, but that's not
 available in PHP :-(

  can't seem to find any examples of how to accomplish this... do i have
  to insert something within the child php app itself to redirect the
  output that's currently being sent to the term? i'd prefer to have the
  output displayed, as well as redirected...

 You basically need to do something about the stdin, stdout and stderr
 file descriptors that your child inherited from the parent at time of
 fork().  I can't seem to find many PHP functions that deal with file
 descriptors though.



 --
 Per Jessen, Zürich (2.6°C)


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Alpar Torok


[PHP] redirecting output for a spawned child process..

2009-02-21 Thread bruce
hi...

got a situation where i have a parent app that spawns children. trying to
figure out how to get the output of the spawned/forked children to be
written to an external file...

can't seem to find any examples of how to accomplish this... do i have to
insert something within the child php app itself to redirect the output
that's currently being sent to the term? i'd prefer to have the output
displayed, as well as redirected...

these are cli apps...

code chunks would be appreciated..

thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting output for a spawned child process..

2009-02-21 Thread Per Jessen
bruce wrote:

 hi...
 
 got a situation where i have a parent app that spawns children. trying
 to figure out how to get the output of the spawned/forked children to
 be written to an external file...

Normally I would use freopen() on stdout and stderr, but that's not
available in PHP :-(

 can't seem to find any examples of how to accomplish this... do i have
 to insert something within the child php app itself to redirect the
 output that's currently being sent to the term? i'd prefer to have the
 output displayed, as well as redirected...

You basically need to do something about the stdin, stdout and stderr
file descriptors that your child inherited from the parent at time of
fork().  I can't seem to find many PHP functions that deal with file
descriptors though. 



-- 
Per Jessen, Zürich (2.6°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Richard Heyes
 ...

Really, for URLs that don't exist you should be showing a 404, This
way the user doesn't falsely believe that the URL is a valid one and
keep using it. By using the ErrorDocument directive like Per
suggested, you can customise it to be distinct helpful, like this:

http://www.phpguru.org/oh%20crap

Using this method allows users to easily get to where they actually
need to be, plus you can potentially promote anything of yours that
you want to.

-- 
Richard Heyes

HTML5 Graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 17th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Per Jessen
Richard Heyes wrote:

 ...
 
 Really, for URLs that don't exist you should be showing a 404, This
 way the user doesn't falsely believe that the URL is a valid one and
 keep using it. By using the ErrorDocument directive like Per
 suggested, you can customise it to be distinct helpful

Apache also comes with a good example of how to cobble that with content
negotiation to present error documents in the users preferred language. 


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Morris
What if the file exists, but it's kinda file to update database, like

// get request $_REQUEST
// execute sql statement to update database
// redirect to the other page, showing results?

in this case 404 approach does not mean to do correctly, so what else is
suggested?

2009/1/22 Per Jessen p...@computer.org

 Richard Heyes wrote:

  ...
 
  Really, for URLs that don't exist you should be showing a 404, This
  way the user doesn't falsely believe that the URL is a valid one and
  keep using it. By using the ErrorDocument directive like Per
  suggested, you can customise it to be distinct helpful

 Apache also comes with a good example of how to cobble that with content
 negotiation to present error documents in the users preferred language.


 /Per Jessen, Zürich


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Richard Heyes
 What if the file exists, but it's kinda file to update database, like

GET requests shouldn't really modify data.

-- 
Richard Heyes

HTML5 Graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 17th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Per Jessen
Morris wrote:

 What if the file exists, but it's kinda file to update database, like
 
 // get request $_REQUEST
 // execute sql statement to update database
 // redirect to the other page, showing results?
 
 in this case 404 approach does not mean to do correctly, so what else
 is suggested?

I would use a 303 redirect, just like after processing a POST.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-22 Thread Jochem Maas
Richard Heyes schreef:
 ...
 
 Really, for URLs that don't exist you should be showing a 404, This
 way the user doesn't falsely believe that the URL is a valid one and
 keep using it. 

if the invalid URL (which outputs a 404 header) then automatically redirects
to another URL then I think it's pretty clear that the original invalid
URL is not being shown, even grandma understands the change in the addressbar
(which is normally highlighted by a background progress-bar effect).

technically you are right, often there are reasons for doing it wrong ...
usually we refer to them as clients :-P

 By using the ErrorDocument directive like Per
 suggested, you can customise it to be distinct helpful, like this:
 
 http://www.phpguru.org/oh%20crap
 
 Using this method allows users to easily get to where they actually
 need to be, plus you can potentially promote anything of yours that
 you want to.

yeehaw promote some crap I don't want ... we don't have enough of that on
the tubes ... chocolate-covered adWord anyone? :-D



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting from unreachable page on website

2009-01-21 Thread Dušan Novaković
Hi,

Is there some elegant solution how to redirect if someone try to open
some non existing page (e.g www.domain.com/nonexistingpage.php) to
main page www.domain.com on website?

thnx, Dusan

-- 
made by Dusan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Kyle Terry
On Wed, Jan 21, 2009 at 10:12 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 thnx, Dusan

 --
 made by Dusan

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Google for apache 404 redirect and read around a bit. Checkout the
documentation on apache.org as well.

-- 
Kyle Terry | www.kyleterry.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Kyle Terry
2009/1/21 Kyle Terry k...@kyleterry.com:
 On Wed, Jan 21, 2009 at 10:12 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 thnx, Dusan

 --
 made by Dusan

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Google for apache 404 redirect and read around a bit. Checkout the
 documentation on apache.org as well.

 --
 Kyle Terry | www.kyleterry.com


That was assuming you are using apache by the way. What web server are
you using?

-- 
Kyle Terry | www.kyleterry.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Dušan Novaković
apache :-)

2009/1/21 Kyle Terry k...@kyleterry.com:
 2009/1/21 Kyle Terry k...@kyleterry.com:
 On Wed, Jan 21, 2009 at 10:12 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 thnx, Dusan

 --
 made by Dusan

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Google for apache 404 redirect and read around a bit. Checkout the
 documentation on apache.org as well.

 --
 Kyle Terry | www.kyleterry.com


 That was assuming you are using apache by the way. What web server are
 you using?

 --
 Kyle Terry | www.kyleterry.com




-- 
made by Dusan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Kyle Terry
On Wed, Jan 21, 2009 at 10:40 AM, Dušan Novaković ndu...@gmail.com wrote:
 apache :-)

 2009/1/21 Kyle Terry k...@kyleterry.com:
 2009/1/21 Kyle Terry k...@kyleterry.com:
 On Wed, Jan 21, 2009 at 10:12 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 thnx, Dusan

 --
 made by Dusan

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Google for apache 404 redirect and read around a bit. Checkout the
 documentation on apache.org as well.

 --
 Kyle Terry | www.kyleterry.com


 That was assuming you are using apache by the way. What web server are
 you using?

 --
 Kyle Terry | www.kyleterry.com




 --
 made by Dusan

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



This will be your best friend then.
http://httpd.apache.org/docs/2.2/custom-error.html

-- 
Kyle Terry | www.kyleterry.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Per Jessen
Dušan Novaković wrote:

 Hi,
 
 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?
 

See Apache ErrorDocument directive.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Jochem Maas
Per Jessen schreef:
 Dušan Novaković wrote:
 
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 
 See Apache ErrorDocument directive.


ai,

ErrorDocument 404   /404.php

?php // 404.php

// do something with query args?

// or just redirect
header('Location: /'); // there should really be FQDN there, but I never bother.
?

or just have apache do all of it ... having a php script
handle the 404 allows you to do fun things with requested URI, GET string, etc

 
 /Per Jessen, Zürich
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-04 Thread Daniel Brown
On Feb 3, 2008 10:08 PM, Richard Lynch [EMAIL PROTECTED] wrote:


 On Fri, February 1, 2008 10:58 pm, js wrote:
  Hi,
 
  I was trying to write a script  in PHP that takes a program name
  as an argument and invoke it as a daemon.
  PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
  so it was easy.
  However, I couldn't find a way  to redirect STDERR a file.
  I like to have the daemon write its log to its  own logfile, like
  apache and mysql do.
 
  So is there any way to accomplish that?
  Any pointers, suggestions would be greatly appreciated.

 http://php.net/set_error_handler

 You can catch (almost) all the errors and send them wherever you want.

 Or maybe you just want to write this as a shell script instead of
 using PHP in the first place. :-)

 in which case

#!/bin/bash
# Name: daemonize.sh (chmod 755)
# Run as: sh daemonize.sh [PROG_TO_DAEMONIZE] [LOG_FILE]
# Daniel P. Brown [EMAIL PROTECTED]
# To disable logging, just use /dev/null as LOG_FILE

if [ $1 ==  ]; then
echo Missing PROG_TO_DAEMONIZE
echo Usage: $0 [PROG_TO_DAEMONIZE] [LOG_FILE]
exit 1
fi

if [ $2 ==  ]; then
echo Missing LOG_FILE (if you don't want logging, use /dev/null)
echo Usage: $0 [PROG_TO_DAEMONIZE] [LOG_FILE]
exit 1
fi

exec $1 21  $2 

if [ $? != 0 ]; then
echo There was an error daemonizing $1.
if [ $2 != /dev/null ]; then
echo Please check the log file ($2) for errors.
fi
exit 1
fi

echo Daemonized $1 with PID $! (from $0 with PID $$).

if [ $2 != /dev/null ]; then
echo All output will be logged to $2.
fi

exit 0


-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-03 Thread Richard Lynch


On Fri, February 1, 2008 10:58 pm, js wrote:
 Hi,

 I was trying to write a script  in PHP that takes a program name
 as an argument and invoke it as a daemon.
 PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
 so it was easy.
 However, I couldn't find a way  to redirect STDERR a file.
 I like to have the daemon write its log to its  own logfile, like
 apache and mysql do.

 So is there any way to accomplish that?
 Any pointers, suggestions would be greatly appreciated.

http://php.net/set_error_handler

You can catch (almost) all the errors and send them wherever you want.

Or maybe you just want to write this as a shell script instead of
using PHP in the first place. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 I was trying to write a script  in PHP that takes a program name
 as an argument and invoke it as a daemon.
 PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
 so it was easy.
 However, I couldn't find a way  to redirect STDERR a file.
 I like to have the daemon write its log to its  own logfile, like
 apache and mysql do.

I think nohup program 2errorlog will do what you're after.


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
nohup would work in some ways, but that's not a real daemon
because the process will have tty, in a session and has a process group.
I like to have a real daemon.

On Feb 2, 2008 5:25 PM, Per Jessen [EMAIL PROTECTED] wrote:
 js wrote:

  I was trying to write a script  in PHP that takes a program name
  as an argument and invoke it as a daemon.
  PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
  so it was easy.
  However, I couldn't find a way  to redirect STDERR a file.
  I like to have the daemon write its log to its  own logfile, like
  apache and mysql do.

 I think nohup program 2errorlog will do what you're after.


 /Per Jessen, Zürich

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 nohup would work in some ways, but that's not a real daemon
 because the process will have tty, in a session and has a process
 group. I like to have a real daemon.

Well, it depends on what you're after.  Are you solving a problem or are
you doing an exercise because you can? 

If you're solving a problem, and my nohup suggestion isn't sufficient,
just write your daemon in C.  If it's an exercise, take a look at
proc_open().


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
Hi Per,

  nohup would work in some ways, but that's not a real daemon
  because the process will have tty, in a session and has a process
  group. I like to have a real daemon.

 Well, it depends on what you're after.  Are you solving a problem or are
 you doing an exercise because you can?

Not an exercise. This is for my day job...

 If you're solving a problem, and my nohup suggestion isn't sufficient,
 just write your daemon in C.  If it's an exercise, take a look at
 proc_open().

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to me.

I took your advice and tried proc_open, but it seems blocking the
parent process.
 (BTW, I didn't know this function, thanks!)

I've already spent a lot of time solving this, os might beter to give
up this problem
and go for the other solution...

Anyway, thanks for you help.
I do appreciate it very much.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 C would be the last resort. I suppose it would be easily done in Perl,
 but most of my colleagues prefer PHP.
 I love to make taking over the code easy, so PHP is more preferable to
 me.

That makes perfect sense, but sometimes PHP is not the best/right
answer. 

What I think you need to do is: 

parent:   fork() your child process, then do whatever. 
child:use proc_open to call your program and redirect stderr. 



/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
  C would be the last resort. I suppose it would be easily done in Perl,
  but most of my colleagues prefer PHP.
  I love to make taking over the code easy, so PHP is more preferable to
  me.

 That makes perfect sense, but sometimes PHP is not the best/right
 answer.

 What I think you need to do is:

 parent:   fork() your child process, then do whatever.
 child:use proc_open to call your program and redirect stderr.

That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Richard Heyes

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to
me.

That makes perfect sense, but sometimes PHP is not the best/right
answer.

What I think you need to do is:

parent:   fork() your child process, then do whatever.
child:use proc_open to call your program and redirect stderr.


That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.


Having come to this rather late, I recently wrote some code that may be 
of some help to you which forks processes: 
http://www.phpguru.org/downloads/pcntl/


You need pcntl and it only works on *nix (I understand). It does make 
fork()ing somewhat easier though. Be careful of defunct processes though.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299pa hosted for you -
no installation, no maintenance, new features automatic and free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting STDERR to a file?

2008-02-01 Thread js
Hi,

I was trying to write a script  in PHP that takes a program name
as an argument and invoke it as a daemon.
PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
so it was easy.
However, I couldn't find a way  to redirect STDERR a file.
I like to have the daemon write its log to its  own logfile, like
apache and mysql do.

So is there any way to accomplish that?
Any pointers, suggestions would be greatly appreciated.

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [BULK] [PHP] Redirecting to a parent page

2007-06-13 Thread clive

Yamil Ortega wrote:


Lets say that I have the next structure on my web directory
/file1.php

/procces/file2.php

/file3.php


 http://localhost/apache2/file1.php

try this:

header( refresh:'3'; url=./apache2/file3.php);

Regards,

Clive.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

2007-06-13 Thread Yamil Ortega
Ok, but what happens if I change server and there is no more apache2
directory?

Do I have to change all the headers in my 37 web pages?

Thanks in advance
Yamil

-Mensaje original-
De: clive [mailto:[EMAIL PROTECTED] 
Enviado el: Miércoles, 13 de Junio de 2007 05:37 a.m.
Para: PHP General List
Asunto: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

Yamil Ortega wrote:

 Lets say that I have the next structure on my web directory
 /file1.php
 
 /procces/file2.php
 
 /file3.php

  http://localhost/apache2/file1.php

try this:

header( refresh:'3'; url=./apache2/file3.php);

Regards,

Clive.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

2007-06-13 Thread Darren Whitlen

Yamil Ortega wrote:

Ok, but what happens if I change server and there is no more apache2
directory?

Do I have to change all the headers in my 37 web pages?


The same code in 37 pages??? Place the code in 1 page, and use 
require(my_code_page.php); where you need it in your scripts. You will 
only then have to change it in one place.


Darren



Thanks in advance
Yamil

-Mensaje original-
De: clive [mailto:[EMAIL PROTECTED] 
Enviado el: Miércoles, 13 de Junio de 2007 05:37 a.m.

Para: PHP General List
Asunto: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

Yamil Ortega wrote:


Lets say that I have the next structure on my web directory
/file1.php

/procces/file2.php

/file3.php


  http://localhost/apache2/file1.php

try this:

header( refresh:'3'; url=./apache2/file3.php);

Regards,

Clive.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to a parent page

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 11:12 pm, Yamil Ortega wrote:
 Lets say that I have the next structure on my web directory

 /file1.php

 /procces/file2.php

 /file3.php

 So, when I see the file1.php on the browser I  see the page in this
 route

 http://localhost/apache2/file1.php

  I have a button that sends information to the /process/file2.php.
 When the
 process is finished, I have to come back to the parent directory page.

 Im using this instruction

 header( refresh:'3'; url=./file3.php);

You need a COMPLETE url here, not just relative pathname, almost for
sure.

 But I got the error that in http://localhost/file3.php does not exists
 any
 page

 If I use this

 header( refresh:'3'; url=file3.php);

 I got the error that in http://localchost/procces/file3.php does not
 exists

 So, how can I redirect the file2.php to the file3.php in the parent
 directory?

You also should consider just doing:
include('file3.php');
instead of bouncing the user back-and-forth between the server/client
in slow HTTP connnections...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [BULK] RE: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

2007-06-13 Thread clive

Yamil Ortega wrote:

Ok, but what happens if I change server and there is no more apache2
directory?

Do I have to change all the headers in my 37 web pages?



do this:

// in a config file, or header file
$sitename = http:/localhost/apache2/; eader file

// whereever it is needed
header(Location: $sitename/file3.php);

You may also want to look at the object buffer and perhaps clear that 
before doing a redirect.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting (after output has started)

2007-04-25 Thread Don Don
  Hi all,  whats the best way to perform a redirect after out put has started ? 
 using header:location will not work unless theres been no output.
   
  I usuall use the method below, however am concerned for browsers that do not 
support javascript.
   
  $location = 'index.php';
  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;

   
-
Ahhh...imagining that irresistible new car smell?
 Check outnew cars at Yahoo! Autos.

Re: [PHP] Redirecting (after output has started)

2007-04-25 Thread Philip Thompson

On Apr 25, 2007, at 8:25 AM, Don Don wrote:

  Hi all,  whats the best way to perform a redirect after out put  
has started ?  using header:location will not work unless theres  
been no output.


  I usuall use the method below, however am concerned for browsers  
that do not support javascript.


  $location = 'index.php';
  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;


Use this at the beginning of the script (before output is displayed):

ob_start();


~Philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting (after output has started)

2007-04-25 Thread tedd

At 6:25 AM -0700 4/25/07, Don Don wrote:
  Hi all,  whats the best way to perform a redirect after out put 
has started ?  using header:location will not work unless theres 
been no output.
  
  I usuall use the method below, however am concerned for browsers 
that do not support javascript.
  
  $location = 'index.php';

  echo script language='javascript'\n;
  echo document.location.href = ' . $location . ';\n;
  echo /script\n;



Check out ob_start  http://us.php.net/ob_start

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting (after output has started)

2007-04-25 Thread Richard Lynch
On Wed, April 25, 2007 8:25 am, Don Don wrote:
   Hi all,  whats the best way to perform a redirect after out put has
 started ?  using header:location will not work unless theres been no
 output.

The BEST way is to re-structure your code logically, with the heavy
lifting calculations done up-front, and the HTML output at the end,
long after any decision about headers has been done.

The SECOND BEST way is to just turn on output_buffering in php.ini or
with http://php.net/ob_start so PHP can pull your ass out of the fire
you've built around yourself.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-15 Thread clive

Larry Bradley wrote:
I need to goto  different PHP pages in my web site depending on what 
happens within some PHP code.


For example, if the user is not logged in when he goes to a page, I want 
to send him to a LOGIN page.


I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo script language='javascript'\n;
echo document.location.href = ' . $location . ';\n;
echo /script\n;

I also played around with using the header(location: ...) function.

I understand that the header() function must be issued before any HMTL 
is output.


But I'm not sure about the Javascript code. In every instance in my 
code, I use the Javascript before any HTML - this type of action 
normally occurs in PHP code called via a form POST.


I presume that the Javascript code really does the same as the PHP 
stuff, and thus must obey the same rules, but I'm not sure.

Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA


You could just put the bit of code that does the redirect above the HTML,

or use ob_start() at the beginning of your php file and
ob_end_flush() at the end, if you need to do a redirect then call 
ob_end_clean() before the header() function.


and as some one else mentioned with clever use of a switch-case and 
includes you can avoid header() redirects entirely.



Clive

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-15 Thread tedd

At 11:28 PM -0500 3/14/07, Richard Lynch wrote:

On Tue, March 13, 2007 11:54 pm, Chris Shiflett wrote:

 Tijnema wrote:

 Did you guys ever noted that little arrow down just right of
 the back button, where you can go back 2 steps at once, so you
 don't have to click very fast?


 I think we both remember browsing before that feature was invented.


I remember the fire-storm when the IMG tag was introduced.

Death of the Internet. Film at 11

Various news posts went like this:

I mean, my God, man, you're going to include a FIFTEEN KILOBYTE file
on your web page?!!!

What, are you crazy???!

That's going to melt-down the entire Internet!

:-) :-) :-)


Yeah, I remember similar comments about using a mouse -- hey, things change.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-15 Thread Satyam
- Original Message - 
From: tedd [EMAIL PROTECTED]




At 11:28 PM -0500 3/14/07, Richard Lynch wrote:

On Tue, March 13, 2007 11:54 pm, Chris Shiflett wrote:

 Tijnema wrote:

 Did you guys ever noted that little arrow down just right of
 the back button, where you can go back 2 steps at once, so you
 don't have to click very fast?


 I think we both remember browsing before that feature was invented.


I remember the fire-storm when the IMG tag was introduced.

Death of the Internet. Film at 11

Various news posts went like this:

I mean, my God, man, you're going to include a FIFTEEN KILOBYTE file
on your web page?!!!

What, are you crazy???!

That's going to melt-down the entire Internet!

:-) :-) :-)


Yeah, I remember similar comments about using a mouse -- hey, things 
change.


tedd
--


And this nonsense of a glass-tty! how are you supposed to really make sense 
of a program staring at that thing, seeing just 24 lines at a time?  It 
can't compare with browsing through fanfold paper in the confort of your 
desk, or even at home! Whenever, wherever an idea hits you, paper and pencil 
is just so handy.


Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-14 Thread Tijnema !

On 3/14/07, Chris Shiflett [EMAIL PROTECTED] wrote:

Tijnema wrote:
 Did you guys ever noted that little arrow down just right of
 the back button, where you can go back 2 steps at once, so you
 don't have to click very fast?

I think we both remember browsing before that feature was invented.

Chris


How long ago is that? Was it before i came to earth? ... LOL
It was in Win95 right?

I never worked on Win3.x so maybe it was there :)

Tijnema


--
Chris Shiflett
http://shiflett.org/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-14 Thread Ben Ramsey

On 3/13/07 4:50 PM, Tijnema ! wrote:

Did you guys ever noted that little arrow down just right of the back
button, where you can go back 2 steps at once, so you don't have to
click very fast??


Browsers have buttons in them? Next thing, you'll be telling me I can 
see images and color in my browser! What craziness! ;-)


--
Ben Ramsey
http://benramsey.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-14 Thread Richard Lynch
On Tue, March 13, 2007 3:41 pm, Chris Shiflett wrote:
 Robert Cummings wrote:
 I've found clicking really fast can get you back :)

 I, too, have successfully used this technique. :-)

+1

Sometimes back button followed at just the right time by top so I
get the HTML, but no JS runs.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-14 Thread Richard Lynch
On Tue, March 13, 2007 3:50 pm, Tijnema ! wrote:
 On 3/13/07, Chris Shiflett [EMAIL PROTECTED] wrote:
 Robert Cummings wrote:
  I've found clicking really fast can get you back :)

 I, too, have successfully used this technique. :-)

 Chris
 Did you guys ever noted that little arrow down just right of the back
 button, where you can go back 2 steps at once, so you don't have to
 click very fast??

Yes, but 2 pages back is not where I want to be.

I want to be on the page with the stupid JS or META re-direct, without
getting bounced forward.

Quick-draw McGraw says back + stop == DWIM

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-14 Thread Richard Lynch
On Tue, March 13, 2007 11:54 pm, Chris Shiflett wrote:
 Tijnema wrote:
 Did you guys ever noted that little arrow down just right of
 the back button, where you can go back 2 steps at once, so you
 don't have to click very fast?

 I think we both remember browsing before that feature was invented.

I remember the fire-storm when the IMG tag was introduced.

Death of the Internet. Film at 11

Various news posts went like this:

I mean, my God, man, you're going to include a FIFTEEN KILOBYTE file
on your web page?!!!

What, are you crazy???!

That's going to melt-down the entire Internet!

:-) :-) :-)

And boy that blink tag was fun... For about 5 minutes. :-v

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-13 Thread Eric Butera

On 3/12/07, Larry Bradley [EMAIL PROTECTED] wrote:

I need to goto  different PHP pages in my web site depending on what
happens within some PHP code.

For example, if the user is not logged in when he goes to a page, I want to
send him to a LOGIN page.

I've have everything working fine, using the following Javascript code:
 $location = 'login.php';
 echo script language='javascript'\n;
 echo document.location.href = ' . $location . ';\n;
 echo /script\n;

I also played around with using the header(location: ...) function.

I understand that the header() function must be issued before any HMTL is
output.

But I'm not sure about the Javascript code. In every instance in my code, I
use the Javascript before any HTML - this type of action normally occurs in
PHP code called via a form POST.

I presume that the Javascript code really does the same as the PHP stuff,
and thus must obey the same rules, but I'm not sure.
Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA


Just to throw my two cents into this...

I set my scripts up so they run something like this:
class SomePage {
function process($controller) {
if (! logged in)
  return $controller-foward('Login', 'Form');
[page code]
}
}

This way I don't have to issue header redirects to make a user see a
totally different part of the script.  I just tell the controller to
foward the request to another controller action.  You could use this
method on saving records where the post page can redisplay the form on
an error.

The only time I use header redirects is when I don't want the user to
accidentally resubmit the form when they click the back button or if I
need to change the url to remove a variable from it.

On any of my pages that accept POST data I issue a redirect to a page
that thanks the user.  This way they can hit refresh all day and I
don't get extra posts or that nasty page has expired message in IE.

One thing you might also want to consider is the fact people can turn
off JavaScript.  Spam bots also do not have JavaScript.  Anything that
is important such as making sure a user is logged in should have a
server side check otherwise they will blaze right past your JS
redirect.

To do something like the controller above in procedural code it would
be easy enough:

---page.php---
if (! logged in) {
   require 'templates/login_form.php';
} else {
   echo 'user is logged in and okay!';
}
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-13 Thread Dave Goodchild

If you do want to use the header function after html has been output, you
can always look at using output buffering (ob_start()).


Re: [PHP] Redirecting in a PHP script

2007-03-13 Thread Robert Cummings
On Tue, 2007-03-13 at 21:50 +0100, Tijnema ! wrote:
 On 3/13/07, Chris Shiflett [EMAIL PROTECTED] wrote:
  Robert Cummings wrote:
   I've found clicking really fast can get you back :)
 
  I, too, have successfully used this technique. :-)
 
  Chris

 Did you guys ever noted that little arrow down just right of the back
 button, where you can go back 2 steps at once, so you don't have to
 click very fast??

Sure have... but where's the fun in it? ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting in a PHP script

2007-03-13 Thread Chris Shiflett
Tijnema wrote:
 Did you guys ever noted that little arrow down just right of
 the back button, where you can go back 2 steps at once, so you
 don't have to click very fast?

I think we both remember browsing before that feature was invented.

Chris

-- 
Chris Shiflett
http://shiflett.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting in a PHP script

2007-03-12 Thread Larry Bradley
I need to goto  different PHP pages in my web site depending on what 
happens within some PHP code.


For example, if the user is not logged in when he goes to a page, I want to 
send him to a LOGIN page.


I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo script language='javascript'\n;
echo document.location.href = ' . $location . ';\n;
echo /script\n;

I also played around with using the header(location: ...) function.

I understand that the header() function must be issued before any HMTL is 
output.


But I'm not sure about the Javascript code. In every instance in my code, I 
use the Javascript before any HTML - this type of action normally occurs in 
PHP code called via a form POST.


I presume that the Javascript code really does the same as the PHP stuff, 
and thus must obey the same rules, but I'm not sure.

Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA 

Re: [PHP] Redirecting in a PHP script

2007-03-12 Thread Tijnema !

On 3/12/07, Larry Bradley [EMAIL PROTECTED] wrote:


I need to goto  different PHP pages in my web site depending on what
happens within some PHP code.

For example, if the user is not logged in when he goes to a page, I want
to
send him to a LOGIN page.

I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo script language='javascript'\n;
echo document.location.href = ' . $location . ';\n;
echo /script\n;

I also played around with using the header(location: ...) function.

I understand that the header() function must be issued before any HMTL is
output.

But I'm not sure about the Javascript code. In every instance in my code,
I
use the Javascript before any HTML - this type of action normally occurs
in
PHP code called via a form POST.

I presume that the Javascript code really does the same as the PHP stuff,
and thus must obey the same rules, but I'm not sure.
Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA



There's a difference in them, as the php header function defines the
redirect in the header, meaning that all body is not even parsed. And it
works also if javascript is disabled.
I prefer the header function, but if you already have data parsed, the
javascript could to the job, but even then it needs to be inside the head
tags i believe, or else it won't get automatically executed.

Tijnema


Re: [PHP] Redirecting in a PHP script

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 22:43 +0100, Satyam wrote:
 The only way to actually go back in 
 those is to open the dropdown list for the back button and skip over one 
 item.

I've found clicking really fast can get you back :)

 That does not happen when using the header() PHP function.

That is my recommendation also despite the success of frantic clicking
*grin*

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting some values from one page to other in php

2005-07-22 Thread Richard Lynch
On Wed, July 20, 2005 1:04 pm, Matt Darby said:
 babu wrote:

It will become a big mess up for me if i combine all the files as they
 are large files.

Scenario #1:
Use include/require to suck in the files, when needed.

Scenario #2:
Use header(Location: ) to re-direct the browser to another file.

In both scenarios, the server has to load the second file from the hard
drive.

In both scenarios, the files are separate for code-maintenance purposes.

In #2, however you are *WASTING* an HTTP response, forcing the browser to
use an extra HTTP connection, and essentially *DOUBLING* the load on
your Apache server.

If you have any kind of state data of any size, you will have to maintain
it in session and/or db and then re-create it in the second HTTP exchange,
so that's even MORE overhead.

I have *NEVER* understood why this is considered standard practice in
PHP scripts.

I doubt that I ever will understand why it's so prevalent.

I can think of very few instances where a simple include doesn't make
more sense from a structured code point of view.

In fact, except for documents that actually *HAVE* moved and you want the
browser and any intermediate caches notified of that fact, I can't think
of any other cases where header(Location: ) is better than include...

Unless the resource doesn't actually live on your server, and it's doing
some kind of brokering or load-balancing or something...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form  has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing  on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail

Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Mikey

babu wrote:


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form  has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing  on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
 

You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php


Mikey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu
It will become a big mess up for me if i combine all the files as they are 
large files.

Matt Darby [EMAIL PROTECTED] wrote:

babu wrote:

I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But 
i want to get the values selected by user from html form.

Thanks for the help.
babu

 
-
 


Why not just combine all three files into one? So long as you place the 
form processing code over the actual HTML  PHP code that generates your 
webpage, all will be fine..

To do this all you need to do is set your form action=

Matt Darby

Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
 




-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail

Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Matt Darby



babu wrote:


It will become a big mess up for me if i combine all the files as they are 
large files.

Matt Darby [EMAIL PROTECTED] wrote:

babu wrote:

 


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


-


   



Why not just combine all three files into one? So long as you place the 
form processing code over the actual HTML  PHP code that generates your 
webpage, all will be fine..


To do this all you need to do is set your form action=

Matt Darby

 


Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail


   





-
Yahoo! Messen



Sorry -- Hit Reply instead of Reply to All :)


ger NEW - crystal clear PC to PCcalling worldwide with voicemail
 



Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu
does session.auto_start should be set to 1 for sessions to work.

Mikey [EMAIL PROTECTED] wrote:babu wrote:

I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But 
i want to get the values selected by user from html form.

Thanks for the help.
babu

 
-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
 

You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php

Mikey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Matt Darby



babu wrote:


does session.auto_start should be set to 1 for sessions to work.

Mikey [EMAIL PROTECTED] wrote:babu wrote:

 


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail


   

You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php


Mikey

 



So long as  you call session_start(); at the very top of your scripts, 
sessions will work.

session.auto_start is fine if your entire site will be using sessions.

Matt Darby


[PHP] redirecting to a success page

2004-11-22 Thread Judson Vaughn
Group,
I have a create_login.php page, which works (it inserts data into the 
database), but I need for the script once executed to redirect to a 
success.php page.

It doesn't do this and I can't figure out how to do it. I've included a 
portion of the script below. This was created by Dreamweaver MX and 
modified by me.

The original script, created by Dreamweaver, gives an error that says 
header has already been sent. I tried different options to no avail. I 
realize this script is now seriously hosed but thought I would include 
it anyway since others may be using Dreamweaver.

Anybody know a simple fix for this? I have a feeling that it's right in 
front of me but I'm just not getting it.

Jud.
Judson Vaughn
[EMAIL PROTECTED] | [EMAIL PROTECTED]
Seiter Vaughn  Communications
12455 Plowman Court
Herndon, VA 20170
703.450.9740
svc
===
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= ? . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS[MM_insert]))  
($HTTP_POST_VARS[MM_insert] == form1)) {
  $insertSQL = sprintf(INSERT INTO xcart_customers (login, usertype, 
membership, password, firstname, lastname, email, pending_membership) 
VALUES ( %s ,%s, %s, %s, %s, %s, %s, %s),
   GetSQLValueString($HTTP_POST_VARS['login'], text),
   GetSQLValueString($HTTP_POST_VARS['usertype'], 
text),
   GetSQLValueString($HTTP_POST_VARS['membership'], 
text),
   GetSQLValueString($HTTP_POST_VARS['password'], 
text),
	   GetSQLValueString($HTTP_POST_VARS['firstname'], text),
	   GetSQLValueString($HTTP_POST_VARS['lastname'], text),
	   GetSQLValueString($HTTP_POST_VARS['email'], text),

GetSQLValueString($HTTP_POST_VARS['pending_membership'], text));
  mysql_select_db($database_courses1, $courses1);
  $Result1 = mysql_query($insertSQL, $courses1) or die(mysql_error());
  $insertGoTo = success.php;
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] redirecting to a success page

2004-11-22 Thread Randy Rinehart
You can send a header to redirect like below.
?php

header(location: successpage.php);
?

Or you can print out some javascript
location.href='successpage.php';



-randy rinehart


- Original Message - 
From: Judson Vaughn [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, November 22, 2004 8:13 AM
Subject: [PHP] redirecting to a success page


 Group,

 I have a create_login.php page, which works (it inserts data into the
 database), but I need for the script once executed to redirect to a
 success.php page.

 It doesn't do this and I can't figure out how to do it. I've included a
 portion of the script below. This was created by Dreamweaver MX and
 modified by me.

 The original script, created by Dreamweaver, gives an error that says
 header has already been sent. I tried different options to no avail. I
 realize this script is now seriously hosed but thought I would include
 it anyway since others may be using Dreamweaver.

 Anybody know a simple fix for this? I have a feeling that it's right in
 front of me but I'm just not getting it.

 Jud.

 Judson Vaughn
 [EMAIL PROTECTED] | [EMAIL PROTECTED]
 Seiter Vaughn  Communications
 12455 Plowman Court
 Herndon, VA 20170
 703.450.9740
 svc

 ===

 $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= ? . $HTTP_SERVER_VARS['QUERY_STRING'];
 }

 if ((isset($HTTP_POST_VARS[MM_insert])) 
 ($HTTP_POST_VARS[MM_insert] == form1)) {
$insertSQL = sprintf(INSERT INTO xcart_customers (login, usertype,
 membership, password, firstname, lastname, email, pending_membership)
 VALUES ( %s ,%s, %s, %s, %s, %s, %s, %s),
 GetSQLValueString($HTTP_POST_VARS['login'],
text),
 GetSQLValueString($HTTP_POST_VARS['usertype'],
 text),
 GetSQLValueString($HTTP_POST_VARS['membership'],
 text),
 GetSQLValueString($HTTP_POST_VARS['password'],
 text),
GetSQLValueString($HTTP_POST_VARS['firstname'], text),
GetSQLValueString($HTTP_POST_VARS['lastname'], text),
GetSQLValueString($HTTP_POST_VARS['email'], text),

 GetSQLValueString($HTTP_POST_VARS['pending_membership'], text));

mysql_select_db($database_courses1, $courses1);
$Result1 = mysql_query($insertSQL, $courses1) or die(mysql_error());


$insertGoTo = success.php;

 ===

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] redirecting to a success page

2004-11-22 Thread Jay Blanchard
[snip]
I have a create_login.php page, which works (it inserts data into the 
database), but I need for the script once executed to redirect to a 
success.php page.
[/snip]

http://www.php.net/header

header(Location: success.php); exit();

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to a success page

2004-11-22 Thread Robby Russell
On Mon, 2004-11-22 at 09:13 -0500, Judson Vaughn wrote:
 Group,
 
 I have a create_login.php page, which works (it inserts data into the 
 database), but I need for the script once executed to redirect to a 
 success.php page.
 
 It doesn't do this and I can't figure out how to do it. I've included a 
 portion of the script below. This was created by Dreamweaver MX and 
 modified by me.
 
 The original script, created by Dreamweaver, gives an error that says 
 header has already been sent. I tried different options to no avail. I 
 realize this script is now seriously hosed but thought I would include 
 it anyway since others may be using Dreamweaver.
 
Sounds like you are displaying information then trying to redirect a
user? The way the internet works is that you load a page...and the
browser shouldn't be sent more headers until the next browser action.
Javascript can do this with a meta refresh, or you can use ob_start() at
the start of your php code, which will allow you to send headers at any
point during your php code, as it waits until it goes through all your
php code before sending any headers.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] redirecting to a success page

2004-11-22 Thread Richard Davey
Hello Judson,

Monday, November 22, 2004, 2:13:13 PM, you wrote:

JV The original script, created by Dreamweaver, gives an error that says
JV header has already been sent. I tried different options to no avail. I
JV realize this script is now seriously hosed but thought I would include
JV it anyway since others may be using Dreamweaver.

Two options: Either use output buffering, or search for the extra
whitespace in the file - it could be before (or after) closing PHP
tags, or if you have any kind of HTML in the same script that would
cause it - basically anywhere you break out of PHP and into HTML
again.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] redirecting to a success page

2004-11-22 Thread Richard Davey
Hello Randy,

Monday, November 22, 2004, 2:22:31 PM, you wrote:

RR You can send a header to redirect like below.

I think he already had that (although it wasn't in the source code
posted) because he said the error was the headers already sent one.

Dreamweaver has a lot to answer for :)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirecting to another page

2004-09-25 Thread AMC
Hi,

What code do I use to redirect a user to a different page in php?

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to another page

2004-09-25 Thread Jason Davidson
eh hem,,, that is a great question to consult the manual... but as for a
hint, search for header()

Jason

AMC [EMAIL PROTECTED] wrote: 
 
 Hi,
 
 What code do I use to redirect a user to a different page in php?
 
 Thanks
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to another page

2004-09-25 Thread Chris Shiflett
--- AMC [EMAIL PROTECTED] wrote:
 What code do I use to redirect a user to a different page in php?

There are several methods, but my favorite is to use a Location header
which also changes the response status code. This method is transparent to
the history mechanism, so users can still click the Back button.

header('Location: http://example.org/');

Another method is to use the Refresh header, which also allows you to set
a timer for the redirect. One disadvantage is that it can prevent a user
from using the Back button.

header('Refresh: 0; url=http://example.org/');

There are also client-side methods of redirecting the user, but this is a
PHP list. :-)

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirecting to another frame using php header function

2004-08-11 Thread bruce
hi...

can anyone point me to a way to do a page redirect using the php 'Header'
function to another frame. I have a page in one frame, when the user does a
submit, i want to have the app do a redirect using the 'Header' function,
with the subsequent page being displayed in another frame.

didn't find anything from google/php.net

thanks

-bruce



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] redirecting to another frame using php header function

2004-08-11 Thread John Nichel
bruce wrote:
hi...
can anyone point me to a way to do a page redirect using the php 'Header'
function to another frame. I have a page in one frame, when the user does a
submit, i want to have the app do a redirect using the 'Header' function,
with the subsequent page being displayed in another frame.
didn't find anything from google/php.net
Can't do this with php.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] redirecting to another frame using php header function

2004-08-11 Thread John Holmes
bruce wrote:
can anyone point me to a way to do a page redirect using the php 'Header'
function to another frame. 
No. Use Javascript.
--
John Holmes
php|architect - The magazine for PHP professionals - http://www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] redirecting to another frame using php header function

2004-08-11 Thread Matthew Sims
 hi...

 can anyone point me to a way to do a page redirect using the php 'Header'
 function to another frame. I have a page in one frame, when the user does
 a
 submit, i want to have the app do a redirect using the 'Header' function,
 with the subsequent page being displayed in another frame.

 didn't find anything from google/php.net

 thanks

 -bruce


Javascript, javascript, javascript.

If you want the browser to do something, use client-side instructions.
If you want the server to do something, use server-side instructions.

A header simply sends, well, HTTP headers. You're asking the browser to
reload a frame which is different.

-- 
--Matthew Sims
--http://killermookie.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting a user

2004-07-01 Thread Shaun
Hi,

Please could someone tell me how I can redirect a user to the page they came
from including any query strings attached to the URL?

Many thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] redirecting

2004-02-18 Thread adwinwijaya
Hello Ian,
Wednesday, February 18, 2004, 5:42:34 PM, you wrote:



IF Stick something like this in your html head/head:

IF meta HTTP-EQUIV=REFRESH CONTENT=5; URL=blah.php

IF Location won't work because you've already sent output to the browser.

IF Ian

IF On Wed, 2004-02-18 at 07:19, ajay wrote:
 hi!
 
 after having trawled through many google articles, i've been told that the best
 way to redirect a person is using header(Location:url);
 
 the problem is, i have form that is posted to another php script. This script then
 processes the form and then writes up a html page and includes in that page any
 warnings etc.
 i want the user to have say 5s to read that page and then be redirected to
 another page.
 so i have something like
 //process form
 //write page
 sleep(10);
 header(Location:blah.php);
 
 the problem is i get an error when the script gets to the header part, the error
 being
 Warning: Cannot modify header information - headers already sent by (output
 started at c:\program files\apache
 group\apache\htdocs\usydbasketball\subscribe_mailing_list.php:6) in c:\program
 files\apache
 group\apache\htdocs\usydbasketball\subscribe_mailing_list.php on
 line 67
 
 so how do i workaround that?
 
 thanks
 
 regards
 
 -- 
 ajay


-- the best way to solve your problem is by using output buffering.
try to start with ob_start(); and at the end of your script call with
ob_end_flush() ;

hope it will work :)

-- 
Best regards,
 adwinwijayamailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirecting

2004-02-17 Thread ajay
hi!

after having trawled through many google articles, i've been told that the best
way to redirect a person is using header(Location:url);

the problem is, i have form that is posted to another php script. This script then
processes the form and then writes up a html page and includes in that page any
warnings etc.
i want the user to have say 5s to read that page and then be redirected to
another page.
so i have something like
//process form
//write page
sleep(10);
header(Location:blah.php);

the problem is i get an error when the script gets to the header part, the error
being
Warning: Cannot modify header information - headers already sent by (output
started at c:\program files\apache
group\apache\htdocs\usydbasketball\subscribe_mailing_list.php:6) in c:\program
files\apache group\apache\htdocs\usydbasketball\subscribe_mailing_list.php on
line 67

so how do i workaround that?

thanks

regards

-- 
ajay
---
Who Dares Wins

-
This mail sent through IMP: www-mail.usyd.edu.au

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting

2004-02-17 Thread - Edwin -
On Wed, 18 Feb 2004 17:19:03 +1100
ajay [EMAIL PROTECTED] wrote:

snip
 i want the user to have say 5s to read that page and then be
 redirected to another page.
/snip

'Not sure if it's only me but I think I've seen this recently ;)

http://marc.theaimsgroup.com/?t=10769831404r=1w=2
http://marc.theaimsgroup.com/?l=php-generalw=2r=1s=headersq=b

--

- E -

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting

2004-02-17 Thread John Nichel
ajay wrote:
hi!

after having trawled through many google articles, i've been told that the best
way to redirect a person is using header(Location:url);
the problem is, i have form that is posted to another php script. This script then
processes the form and then writes up a html page and includes in that page any
warnings etc.
i want the user to have say 5s to read that page and then be redirected to
another page.
so i have something like
//process form
//write page
sleep(10);
header(Location:blah.php);
the problem is i get an error when the script gets to the header part, the error
being
Warning: Cannot modify header information - headers already sent by (output
started at c:\program files\apache
group\apache\htdocs\usydbasketball\subscribe_mailing_list.php:6) in c:\program
files\apache group\apache\htdocs\usydbasketball\subscribe_mailing_list.php on
line 67
so how do i workaround that?

thanks

regards

JavaScript or META refresh.

You cannot send headers after you have sent content to the browser.

(Let the war begin again ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] redirecting

2004-02-17 Thread Ian Firla


Stick something like this in your html head/head:

meta HTTP-EQUIV=REFRESH CONTENT=5; URL=blah.php

Location won't work because you've already sent output to the browser.

Ian

On Wed, 2004-02-18 at 07:19, ajay wrote:
 hi!
 
 after having trawled through many google articles, i've been told that the best
 way to redirect a person is using header(Location:url);
 
 the problem is, i have form that is posted to another php script. This script then
 processes the form and then writes up a html page and includes in that page any
 warnings etc.
 i want the user to have say 5s to read that page and then be redirected to
 another page.
 so i have something like
 //process form
 //write page
 sleep(10);
 header(Location:blah.php);
 
 the problem is i get an error when the script gets to the header part, the error
 being
 Warning: Cannot modify header information - headers already sent by (output
 started at c:\program files\apache
 group\apache\htdocs\usydbasketball\subscribe_mailing_list.php:6) in c:\program
 files\apache group\apache\htdocs\usydbasketball\subscribe_mailing_list.php on
 line 67
 
 so how do i workaround that?
 
 thanks
 
 regards
 
 -- 
 ajay
 ---
 Who Dares Wins
 
 -
 This mail sent through IMP: www-mail.usyd.edu.au

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting and get length problems

2004-01-07 Thread Chris W
In this application I am working on, if there is a problem with the 
data, I use a redirect to go back to the form and send the data with an 
error message in a get.  That way the user doesn't need to retype 
everything.  Most errors can be caught with java script before they post 
the form but not all.  3 of the fields in this form are to store various 
URL's so if they are long URL's it is easy to see how I could go over 
the limit of the max url length.  So my question is what is the best 
alternative?  Is there a way to redirect and use a post instead of a get 
to send the data?  The only other Idea I have is to put the information 
in a temporary table and just send a get with the key for the record in 
the table.

Chris W

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Redirecting and get length problems

2004-01-07 Thread Chris Shiflett
--- Chris W [EMAIL PROTECTED] wrote:
 3 of the fields in this form are to store various URL's so if they
 are long URL's it is easy to see how I could go over the limit of
 the max url length. So my question is what is the best alternative?
 Is there a way to redirect and use a post instead of a get to send
 the data?

No, thankfully. :-) Imagine how bad it would be if by visiting a Web site,
you could be tricked into posting data to some other Web site.

 The only other Idea I have is to put the information in a temporary
 table and just send a get with the key for the record in the table.

Yes, this is what sessions are, and it sounds like a potentially good
option for you. You can read here for more information:

www.php.net/session

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting and get length problems

2004-01-07 Thread John W. Holmes
Chris W wrote:

In this application I am working on, if there is a problem with the 
data, I use a redirect to go back to the form and send the data with an 
error message in a get.  That way the user doesn't need to retype 
everything.  Most errors can be caught with java script before they post 
the form but not all.  3 of the fields in this form are to store various 
URL's so if they are long URL's it is easy to see how I could go over 
the limit of the max url length.  So my question is what is the best 
alternative?  Is there a way to redirect and use a post instead of a get 
to send the data?  The only other Idea I have is to put the information 
in a temporary table and just send a get with the key for the record in 
the table.
Easy way is with sessions. Throw $_GET into session and pull it back out 
on the next page.

$_SESSION['get'] = $_GET;
$_GET = $_SESSION['get'];
As an alternative, how about you rethink the flow of your page? Make the 
part that displays your form into a function, class, or include file. 
Then you can just include it wherever you need it, without the need to 
actually redirect back to another page.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] redirecting to a url..

2003-07-20 Thread Louie Miranda
yes, got it working. thanks a lot.. i did use header

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])


- Original Message - 
From: Chris Shiflett [EMAIL PROTECTED]
To: Louie Miranda [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 18, 2003 11:45 PM
Subject: Re: [PHP] redirecting to a url..


 
 --- Louie Miranda [EMAIL PROTECTED] wrote:
  echo meta http-equiv=\REFRESH\ CONTENT=\0; URL=us/index.php\;
  
  Or you may have other more advance alternatives?
 
 You can use a protocol redirect rather than relying on HTML:
 
 header('Location: http://yoursite.org/us/index.php');
 
 Chris
 
 =
 Become a better Web developer with the HTTP Developer's Handbook
 http://httphandbook.org/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] redirecting to a url..

2003-07-20 Thread Ow Mun Heng
Me, 

I have 2 functions. 1 I call - immediate and other refresh.. the
difference is one as the name implies is immediate - (like chris pointed out
below ) - 

header('Location: http://yoursite.org/us/index.php');

The other is more of a refresh kind, waits a default of 2 secs (for me so
that I can show a warning message before it redirects..

function header_refresh_html($l_refresh_url)
{
// This is taken from php-manual
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);
// Date in the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);  //
always modified
header(Cache-Control: no-store, no-cache, must-revalidate);   //
HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
// HTTP/1.0
header( Refresh:2;url=$l_refresh_url );   // Wait
default of 2 seconds
}
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
Sent: Friday, July 18, 2003 11:46 PM
To: Louie Miranda; [EMAIL PROTECTED]
Subject: Re: [PHP] redirecting to a url..


--- Louie Miranda [EMAIL PROTECTED] wrote:
 echo meta http-equiv=\REFRESH\ CONTENT=\0; URL=us/index.php\;
 
 Or you may have other more advance alternatives?

You can use a protocol redirect rather than relying on HTML:

header('Location: http://yoursite.org/us/index.php');

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirecting to a url..

2003-07-18 Thread Louie Miranda
I have this form with 2 values under 1 name ColTemplate. I was hoping if i
can redirect it to another url? on the ?? if templateone or templatetwo.

Anyhelp would be good.

-- code -
$v_get_template = $_POST['ColTemplate'];


if ($v_get_template === 'TemplateOne') {
 ??

} elseif ($v_get_template === 'TemplateTwo') {
 ??
}
-- code -



--
Thank you,
Louie Miranda ([EMAIL PROTECTED])



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to a url..

2003-07-18 Thread Louie Miranda
My solution..

echo meta http-equiv=\REFRESH\ CONTENT=\0; URL=us/index.php\;

Or you may have other more advance alternatives?

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])


- Original Message -
From: Louie Miranda [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 18, 2003 2:08 PM
Subject: [PHP] redirecting to a url..


 I have this form with 2 values under 1 name ColTemplate. I was hoping if i
 can redirect it to another url? on the ?? if templateone or templatetwo.

 Anyhelp would be good.

 -- code -
 $v_get_template = $_POST['ColTemplate'];


 if ($v_get_template === 'TemplateOne') {
  ??

 } elseif ($v_get_template === 'TemplateTwo') {
  ??
 }
 -- code -



 --
 Thank you,
 Louie Miranda ([EMAIL PROTECTED])



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to a url..

2003-07-18 Thread Curt Zirzow

Louie Miranda [EMAIL PROTECTED] wrote:
 I have this form with 2 values under 1 name ColTemplate. I was hoping if i
 can redirect it to another url? on the ?? if templateone or templatetwo.

header('Location: http://domain/file');

 
Curt
--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to a url..

2003-07-18 Thread Louie Miranda
thanks, this is much better.

--
Thank you,
Louie Miranda ([EMAIL PROTECTED])


- Original Message -
From: Curt Zirzow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 18, 2003 2:29 PM
Subject: Re: [PHP] redirecting to a url..



 Louie Miranda [EMAIL PROTECTED] wrote:
  I have this form with 2 values under 1 name ColTemplate. I was hoping if
i
  can redirect it to another url? on the ?? if templateone or templatetwo.

 header('Location: http://domain/file');


 Curt
 --


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting to a url..

2003-07-18 Thread Chris Shiflett
--- Louie Miranda [EMAIL PROTECTED] wrote:
 echo meta http-equiv=\REFRESH\ CONTENT=\0; URL=us/index.php\;
 
 Or you may have other more advance alternatives?

You can use a protocol redirect rather than relying on HTML:

header('Location: http://yoursite.org/us/index.php');

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting to index.php from index.html

2003-06-17 Thread Michael
I'm a relative newbie to PHP coming from the Zope/Python/DTML world.  Does 
anyone know of a good way, short of a javascript, to redirect from index.html 
to index.php.   Also, can I use PHP to test for browsers, then redirect them 
to the appropriate page.  In DTML/Python it would be :

dtml-if _.string.find(HTTP_USER_AGENT, 'Mozilla/4') = 0
dtml-call RESPONSE.redirect('moz4_page.php')
/dtml-if

This can be called from anywhere in the page.  I know that PHP does not work 
this way and that this would need to be done before html, but I'm even 
having problems with that.  I guess I'm just having a hard time THINKING like 
php.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Ralph
?php

if(strstr = ($HTTP_USER_AGENT, Mozilla/4)){
   header(Location: http://www.mydomain.com/moz4_page.php;)
} 

elseif(strstr = ($HTTP_USER_AGENT, MSIE)){
   header(Location: http://www.mydomain.com/ie_page.php;)
}

etc...

?

HTML
HEAD
TITLEMy Page/TITLE
/HEAD

etc..


-Original Message-
From: Michael [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2003 11:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Redirecting to index.php from index.html

I'm a relative newbie to PHP coming from the Zope/Python/DTML world.
Does 
anyone know of a good way, short of a javascript, to redirect from
index.html 
to index.php.   Also, can I use PHP to test for browsers, then redirect
them 
to the appropriate page.  In DTML/Python it would be :

dtml-if _.string.find(HTTP_USER_AGENT, 'Mozilla/4') = 0
dtml-call RESPONSE.redirect('moz4_page.php')
/dtml-if

This can be called from anywhere in the page.  I know that PHP does not
work 
this way and that this would need to be done before html, but I'm even

having problems with that.  I guess I'm just having a hard time THINKING
like 
php.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Michael
If I use this on index.html, it does nothing.  If I use it on index.php I get:

Parse error: parse error, unexpected '=' in 
/path/to/file_named/main.php on line 3

What am I doing wrong


On Tuesday 17 June 2003 02:11 pm, Ralph wrote:
 ?php

 if(strstr = ($HTTP_USER_AGENT, Mozilla/4)){
header(Location: http://www.mydomain.com/moz4_page.php;)
 }

 elseif(strstr = ($HTTP_USER_AGENT, MSIE)){
header(Location: http://www.mydomain.com/ie_page.php;)
 }

 etc...

 ?

 HTML
 HEAD
 TITLEMy Page/TITLE
 /HEAD

 etc..


 -Original Message-
 From: Michael [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 17, 2003 11:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Redirecting to index.php from index.html

 I'm a relative newbie to PHP coming from the Zope/Python/DTML world.
 Does
 anyone know of a good way, short of a javascript, to redirect from
 index.html
 to index.php.   Also, can I use PHP to test for browsers, then redirect
 them
 to the appropriate page.  In DTML/Python it would be :

 dtml-if _.string.find(HTTP_USER_AGENT, 'Mozilla/4') = 0
 dtml-call RESPONSE.redirect('moz4_page.php')
 /dtml-if

 This can be called from anywhere in the page.  I know that PHP does not
 work
 this way and that this would need to be done before html, but I'm even

 having problems with that.  I guess I'm just having a hard time THINKING
 like
 php.

-- 
Exasource Inc.
Web: http://www.exasource.com
Email: [EMAIL PROTECTED]
Phone: 970-206-4556

The Israelite army looked at Goliath and said,  he's so big we can't 
 possibly win.  David looked at Goliath and said, wait a minute, he's 
 so big I can't possibly miss

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Jay Blanchard
[snip]
If I use this on index.html, it does nothing.  If I use it on index.php
I get:

Parse error: parse error, unexpected '=' in 
/path/to/file_named/main.php on line 3

What am I doing wrong


On Tuesday 17 June 2003 02:11 pm, Ralph wrote:
 ?php

 if(strstr = ($HTTP_USER_AGENT, Mozilla/4)){
header(Location: http://www.mydomain.com/moz4_page.php;)
 }

 elseif(strstr = ($HTTP_USER_AGENT, MSIE)){
header(Location: http://www.mydomain.com/ie_page.php;)
 }

[/snip]


Shouldn't it  be 
 if(strstr($HTTP_USER_AGENT, Mozilla/4)){
header(Location: http://www.mydomain.com/moz4_page.php;)
 }

 elseif(strstr($HTTP_USER_AGENT, MSIE)){
header(Location: http://www.mydomain.com/ie_page.php;)
 }

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Michael
With that I get:

Parse error: parse error, unexpected T_STRING in /path/to/file_named/main.php 
on line 4

Michael


On Tuesday 17 June 2003 02:50 pm, Jay Blanchard wrote:
 [snip]
 If I use this on index.html, it does nothing.  If I use it on index.php
 I get:

 Parse error: parse error, unexpected '=' in
 /path/to/file_named/main.php on line 3

 What am I doing wrong

 On Tuesday 17 June 2003 02:11 pm, Ralph wrote:
  ?php
 
  if(strstr = ($HTTP_USER_AGENT, Mozilla/4)){
 header(Location: http://www.mydomain.com/moz4_page.php;)
  }
 
  elseif(strstr = ($HTTP_USER_AGENT, MSIE)){
 header(Location: http://www.mydomain.com/ie_page.php;)
  }

 [/snip]


 Shouldn't it  be 

  if(strstr($HTTP_USER_AGENT, Mozilla/4)){
 header(Location: http://www.mydomain.com/moz4_page.php;)
  }
 
  elseif(strstr($HTTP_USER_AGENT, MSIE)){
 header(Location: http://www.mydomain.com/ie_page.php;)
  }

 HTH

-- 
Exasource Inc.
Web: http://www.exasource.com
Email: [EMAIL PROTECTED]
Phone: 970-206-4556

The Israelite army looked at Goliath and said,  he's so big we can't 
 possibly win.  David looked at Goliath and said, wait a minute, he's 
 so big I can't possibly miss

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Ralph
Oops. Typos. Try this:

if(strstr($HTTP_USER_AGENT, Mozilla/4)){
header(Location: http://www.mydomain.com/moz4_page.php;);
}

elseif(strstr($HTTP_USER_AGENT, MSIE)){
   header(Location: http://www.mydomain.com/ie_page.php;);
}

-Original Message-
From: Michael [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2003 1:12 PM
To: Jay Blanchard; Ralph; [EMAIL PROTECTED]
Subject: Re: [PHP] Redirecting to index.php from index.html

With that I get:

Parse error: parse error, unexpected T_STRING in
/path/to/file_named/main.php 
on line 4

Michael


On Tuesday 17 June 2003 02:50 pm, Jay Blanchard wrote:
 [snip]
 If I use this on index.html, it does nothing.  If I use it on
index.php
 I get:

 Parse error: parse error, unexpected '=' in
 /path/to/file_named/main.php on line 3

 What am I doing wrong

 On Tuesday 17 June 2003 02:11 pm, Ralph wrote:
  ?php
 
  if(strstr = ($HTTP_USER_AGENT, Mozilla/4)){
 header(Location: http://www.mydomain.com/moz4_page.php;)
  }
 
  elseif(strstr = ($HTTP_USER_AGENT, MSIE)){
 header(Location: http://www.mydomain.com/ie_page.php;)
  }

 [/snip]


 Shouldn't it  be 

  if(strstr($HTTP_USER_AGENT, Mozilla/4)){
 header(Location: http://www.mydomain.com/moz4_page.php;)
  }
 
  elseif(strstr($HTTP_USER_AGENT, MSIE)){
 header(Location: http://www.mydomain.com/ie_page.php;)
  }

 HTH

-- 
Exasource Inc.
Web: http://www.exasource.com
Email: [EMAIL PROTECTED]
Phone: 970-206-4556

The Israelite army looked at Goliath and said,  he's so big we can't 
 possibly win.  David looked at Goliath and said, wait a minute, he's 
 so big I can't possibly miss



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread David Nicholson
Hello,


This is a reply to an e-mail that you wrote on Tue, 17 Jun 2003 at 22:27,
lines prefixed by '' were originally written by you.
 Oops. Typos. Try this:
 if(strstr($HTTP_USER_AGENT, Mozilla/4)){
 header(Location: http://www.mydomain.com/moz4_page.php;);
 elseif(strstr($HTTP_USER_AGENT, MSIE)){
header(Location: http://www.mydomain.com/ie_page.php;);

This doesn't really matter as in this case the performance difference
wouldn't be noticable but I thought I would point out anyway...

On the strstr manual page it states:
Note:  If you only want to determine if a particular needle  occurs
within haystack, use the faster and less memory intensive function
strpos() instead.

All the best,

David

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Michael

Parse error: parse error, unexpected T_STRING in /path/to/file_named/main.php 
on line 4

Here is my actual code so you can look at it and see what I am doing 
something wrong.  I know I must be, since I don't see how php could become so 
popular for site development when it appears to be so difficult to do a 
simple test and redirect.  

It works fine in forms such as:

input type=text name=phrase size=
?php
if (strstr(getenv(HTTP_USER_AGENT), MSIE)) {
echo 50;
  } else {
echo 35;
  }
?
 maxlength=50

But I have yet to be able to do a redirect after a test.

index.html is a dhtml splash screen to allow time for image preloading.  It 
does not work on Opera or Konqueror.

?

if(strstr($HTTP_USER_AGENT, Opera)){
    header(Location: http://www.servantsmc.com/main.php;);
}

elseif(strstr($HTTP_USER_AGENT, Konqueror)){
   header(Location: http://www.servantsmc.com/main.php;);
}

?
html
head
titleMotorcycle Clubs. Servants For Christ - Northern Colorado/title
meta name=generator content=NEdit 5.1


On Tuesday 17 June 2003 03:26 pm, Ralph wrote:
Oops. Typos. Try this:

 if(strstr($HTTP_USER_AGENT, Mozilla/4)){
     header(Location: http://www.mydomain.com/moz4_page.php;);
 }

 elseif(strstr($HTTP_USER_AGENT, MSIE)){
    header(Location: http://www.mydomain.com/ie_page.php;);
 }


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread Ralph

Well it does appear to be working because according to this error, the
problem is with main.php on line 4.

-Original Message-
From: Michael [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2003 2:27 PM
To: Ralph; 'Jay Blanchard'; [EMAIL PROTECTED]
Subject: Re: [PHP] Redirecting to index.php from index.html


Parse error: parse error, unexpected T_STRING in
/path/to/file_named/main.php 
on line 4

Here is my actual code so you can look at it and see what I am doing 
something wrong.  I know I must be, since I don't see how php could
become so 
popular for site development when it appears to be so difficult to do a 
simple test and redirect.  

It works fine in forms such as:

input type=text name=phrase size=
?php
if (strstr(getenv(HTTP_USER_AGENT), MSIE)) {
echo 50;
  } else {
echo 35;
  }
?
 maxlength=50

But I have yet to be able to do a redirect after a test.

index.html is a dhtml splash screen to allow time for image preloading.
It 
does not work on Opera or Konqueror.

?

if(strstr($HTTP_USER_AGENT, Opera)){
    header(Location: http://www.servantsmc.com/main.php;);
}

elseif(strstr($HTTP_USER_AGENT, Konqueror)){
   header(Location: http://www.servantsmc.com/main.php;);
}

?
html
head
titleMotorcycle Clubs. Servants For Christ - Northern Colorado/title
meta name=generator content=NEdit 5.1


On Tuesday 17 June 2003 03:26 pm, Ralph wrote:




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting to index.php from index.html

2003-06-17 Thread David Otton
On Tue, 17 Jun 2003 12:41:34 -0600, you wrote:

I'm a relative newbie to PHP coming from the Zope/Python/DTML world.  Does 
anyone know of a good way, short of a javascript, to redirect from index.html 
to index.php.   Also, can I use PHP to test for browsers, then redirect them 
to the appropriate page.  In DTML/Python it would be :

dtml-if _.string.find(HTTP_USER_AGENT, 'Mozilla/4') = 0
dtml-call RESPONSE.redirect('moz4_page.php')
/dtml-if

This can be called from anywhere in the page.  I know that PHP does not work 
this way and that this would need to be done before html, but I'm even 
having problems with that.  I guess I'm just having a hard time THINKING like 
php.

I can understand that, I kick and scream when forced to think in DTML ('-'
in variable names? Turning the stack inside out? Blah).

Anyway... I suspect, as you're going from index.html - index.php, you
actually want to add index.php as a Directory Index. Try adding this to your
httpd.conf file:

IfModule mod_dir.c
DirectoryIndex index.html index.php
/IfModule

and now, /my/path/index.php will be called when you run
http://myhost.com/my/path/

(If I answered the wrong question, I apologise; forcing a redirect from a
pure HTML page will probably need Javascript or meta refresh.)

As to your other question yes, it's possible to use PHP to test for
incoming browsers, but it's not exactly good practice. Check
$HTTP_USER_AGENT.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting STDOUT to a file pointer

2003-02-28 Thread Jeff Bearer
I'm working on a shell script in php. The script has an option to write
to standard output, or to a file.  If the filehandle is opened I'd like
to redirect standard output to the file pointer.  This would allow me
not to have to handle every output statement twice, once with an echo
and again with an fputs.

Can this be done in PHP?


-- 
Jeff Bearer, RHCE
Webmaster, PittsburghLIVE.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirecting STDOUT to a file pointer

2003-02-28 Thread Jeff Bearer
Argh, I was thinking about the problem backwards, redirect the fp to stdout 
is the way to do it.

if(!$argv[1]) $argv[1] = php://stdout;
$fp = fopen($argv[1], w);
fputs($fp,blah\n);
fclose($fp);

On Fri, 2003-02-28 at 15:11, Jeff Bearer wrote:
 I'm working on a shell script in php. The script has an option to write
 to standard output, or to a file.  If the filehandle is opened I'd like
 to redirect standard output to the file pointer.  This would allow me
 not to have to handle every output statement twice, once with an echo
 and again with an fputs.
 
 Can this be done in PHP?
 
 
 -- 
 Jeff Bearer, RHCE
 Webmaster, PittsburghLIVE.com
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Jeff Bearer, RHCE
Webmaster, PittsburghLIVE.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Redirecting to PHP

2003-02-05 Thread Alberto Brea
Dear list,
My home page is index.html, that doesn't run PHP.
I also have index.php which shows the same content with PHP.
Can I do to automatically redirect a visitor from index.html to index.php?
TIA

Alberto



Re: [PHP] Redirecting to PHP

2003-02-05 Thread John Nichel
You can do it with JavaScript or a Meta refresh, but why?

If both the pages are the same, why even use the HTML one?

Alberto Brea wrote:

Dear list,
My home page is index.html, that doesn't run PHP.
I also have index.php which shows the same content with PHP.
Can I do to automatically redirect a visitor from index.html to index.php?
TIA

Alberto





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  1   2   >