Re: [PHP] redirect a shell command to stdout in real time

2012-09-11 Thread shiplu
You can use pipe to run the command and capture the stdout.
Then dump it with proper header to browser.

Note, If the external command (specially video encoding) takes long time
you should probably use cron for this and maintain a queue. I recommend you
apply some sorts of caching also.

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


[PHP] redirect a shell command to stdout in real time

2012-09-11 Thread zonyi besk
Hi All,

I want to redirect the stdout of an executing shell command to stdout of
php called by browser
The command some stream like command like
ffmpeg -i rtmp://192. -
rtmpdump -v  -r rtmp://192  -a app -y stream -o -
so its live video, and the execution not stops,  till the user navigate out
with browser.

What I want loading this php from web based,  to print the live video
content to the stdout of php,
So the call result of  php is video and starts almost with
header("Content-Type: video/x-flv");

Hope there's solution in php
Thanks
Zocs


Re: [PHP] PHP redirect

2011-09-24 Thread muad shibani
it works very well .. thanks a lot for you dajkta you saved my day .. thanks
a lot

On Sat, Sep 24, 2011 at 3:45 AM, Dajka Tamas  wrote:

> Try header(”Location: ”.html_entity_decode($data[’feed_link’]));
>
> ** **
>
> *From:* muad shibani [mailto:muad.shib...@gmail.com]
> *Sent:* Saturday, September 24, 2011 12:41 PM
> *To:* Dajka Tamas
> *Cc:* php-general@lists.php.net
> *Subject:* Re: [PHP] PHP redirect
>
> ** **
>
> it redirecting me to  unavailable/wrong page, the data came from database
> but each time it gives me & instead of &
>
> On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas  wrote:***
> *
>
> If $data['feed_link'] is extracted from $_POST, then it's already
> urldecoded.
>
> BTW, what's the problem? It's not redirecting you, or just redirecting you
> to az unavailable/wrong page? ( most browsers change the  & in titlebar
> to '&', so you don't have to worry about that )
>
>
> -Original Message-
> From: muad shibani [mailto:muad.shib...@gmail.com]
> Sent: Saturday, September 24, 2011 12:36 PM
> To: php-general@lists.php.net
> Subject: [PHP] PHP redirect
>
> when I try to go to a URL by using PHP header function so if the URL
> contains & it converts it to & so the needed page will not
> display correctly I tried to use:
>
>  $url = urldecode($data['feed_link']);
>
>  header ( "Location: $url" );
>
> but I can't get it
>
> ** **
>


RE: [PHP] PHP redirect

2011-09-24 Thread Dajka Tamas
Try header("Location: ".html_entity_decode($data['feed_link']));

 

From: muad shibani [mailto:muad.shib...@gmail.com] 
Sent: Saturday, September 24, 2011 12:41 PM
To: Dajka Tamas
Cc: php-general@lists.php.net
Subject: Re: [PHP] PHP redirect

 

it redirecting me to  unavailable/wrong page, the data came from database
but each time it gives me & instead of &

On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas  wrote:

If $data['feed_link'] is extracted from $_POST, then it's already
urldecoded.

BTW, what's the problem? It's not redirecting you, or just redirecting you
to az unavailable/wrong page? ( most browsers change the  & in titlebar
to '&', so you don't have to worry about that )


-Original Message-
From: muad shibani [mailto:muad.shib...@gmail.com]
Sent: Saturday, September 24, 2011 12:36 PM
To: php-general@lists.php.net
Subject: [PHP] PHP redirect

when I try to go to a URL by using PHP header function so if the URL
contains & it converts it to & so the needed page will not
display correctly I tried to use:

 $url = urldecode($data['feed_link']);

 header ( "Location: $url" );

but I can't get it

 



Re: [PHP] PHP redirect

2011-09-24 Thread muad shibani
it redirecting me to  unavailable/wrong page, the data came from database
but each time it gives me & instead of &

On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas  wrote:

> If $data['feed_link'] is extracted from $_POST, then it's already
> urldecoded.
>
> BTW, what's the problem? It's not redirecting you, or just redirecting you
> to az unavailable/wrong page? ( most browsers change the  & in titlebar
> to '&', so you don't have to worry about that )
>
> -Original Message-
> From: muad shibani [mailto:muad.shib...@gmail.com]
> Sent: Saturday, September 24, 2011 12:36 PM
> To: php-general@lists.php.net
> Subject: [PHP] PHP redirect
>
> when I try to go to a URL by using PHP header function so if the URL
> contains & it converts it to & so the needed page will not
> display correctly I tried to use:
>
>  $url = urldecode($data['feed_link']);
>
>  header ( "Location: $url" );
>
> but I can't get it
>
>


RE: [PHP] PHP redirect

2011-09-24 Thread Dajka Tamas
If $data['feed_link'] is extracted from $_POST, then it's already
urldecoded.

BTW, what's the problem? It's not redirecting you, or just redirecting you
to az unavailable/wrong page? ( most browsers change the  & in titlebar
to '&', so you don't have to worry about that )

-Original Message-
From: muad shibani [mailto:muad.shib...@gmail.com] 
Sent: Saturday, September 24, 2011 12:36 PM
To: php-general@lists.php.net
Subject: [PHP] PHP redirect

when I try to go to a URL by using PHP header function so if the URL
contains & it converts it to & so the needed page will not
display correctly I tried to use:

 $url = urldecode($data['feed_link']);

 header ( "Location: $url" );

but I can't get it


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



[PHP] PHP redirect

2011-09-24 Thread muad shibani
when I try to go to a URL by using PHP header function so if the URL
contains & it converts it to & so the needed page will not
display correctly I tried to use:

 $url = urldecode($data['feed_link']);

 header ( "Location: $url" );

but I can't get it


Re: Re[2]: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 20:31 +0200, Andre Polykanine wrote:
> Hello Steve,
> 
> Btw, the built-in mail() function is to slow to send such amount
> of mail. Consider using SMTP (if you don't).
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
> 
> - Original message -
> From: Steve Staples 
> To: php-general@lists.php.net 
> Date: Monday, December 6, 2010, 6:41:34 PM
> Subject: [PHP] Redirect output to a file on the web server
> 
> On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> > On 6 December 2010 15:46, Ferdi  wrote:
> > > On 6 December 2010 20:47, Steve Staples  wrote:
> > >
> > >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> > >> > Greetings List members,
> > >> >
> > >> > I have a script that takes quite a while to run, one or two hours, I 
> > >> > wish
> > >> to
> > >> > redirect the normal php output to a file on the webserver itself. I 
> > >> > don't
> > >> > mind if in the process, the browser displays a blank page. The reason I
> > >> want
> > >> > to do this is that if the script crashes or the browser Is closed by
> > >> > mistake, I have absolutely no record of where the script stopped 
> > >> > running.
> > >> >
> > >> > I could use code like below
> > >> > At the beginning of the script:
> > >> > ob_start();
> > >> >
> > >> > At the end of the script:
> > >> > $page = ob_get_contents();
> > >> > ob_end_flush();
> > >> > $fp = fopen("output.html","w");
> > >> > fwrite($fp,$page);
> > >> > fclose($fp);
> > >> >
> > >> > However, I see some problems with this:
> > >> > I'm not too sure of the size of the output. It may balloon to over the
> > >> > buffering limit (in PHP? Apache?) and then what happens?
> > >> > Secondly, if the script crashes before the end, I won't get any output.
> > >> > Finally, I am using a library in the script that outputs status and 
> > >> > error
> > >> > messages of its own. So, if I manually opened a file and used fwrite()
> > >> > alongside echo for my messages, I would lose out on those messages.
> > >> >
> > >> > Anybody has any pointers on how you could send the output not only to a
> > >> > browser, but also to a file on the webserver? If not, at least to a 
> > >> > file?
> > >> >
> > >> > Thanks and regards,
> > >> > Ferdi
> > >>
> > >> Just curious, but if it takes that long to run, why are you running it
> > >> from a browser?  why not run it from the commandline, that way you dont
> > >> have to change your php.ini for the webserver (increasing the timeout,
> > >> memory limits, etc etc... you can change those for the CLI only?
> > >>
> > >> 2 hours is a long time to "hope" that the browser doesn't close, or
> > >> connectivity doesn't get interupted for even 1 microsecond...
> > >>
> > >> if the script has "breaks" in it, where it starts to do something else,
> > >> you can put in an email to yourself, to say "hey, we're HERE now"
> > >>
> > >> but i would look into running it from the CLI over the webserver, you
> > >> would be less likely to run into issues on something that takes that
> > >> amount of time to run.
> > >>
> > >> If you needed the output to be displayed on a webpage, you can write the
> > >> progress to a file, and then have a php webpage that reads the file, and
> > >> using ajax or whatever, refresh the content.
> > >>
> > >> good luck in your script, and if you still run it from the browser, and
> > >> need to output to a file, then i would continually be writing content to
> > >> that file, every time you do soemthing, or start another part of the
> > >> script so you know EXACTLY where you are, at all times...
> > >>
> > >> Steve
> > >>
> > >
> > > Hi Steve,
> > >
> > > Thanks for the tips. To answer your queries, I don't mind using CLI. How 
> > > do
> > > I then ensure the messages, e

Re[2]: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Andre Polykanine
Hello Steve,

Btw, the built-in mail() function is to slow to send such amount
of mail. Consider using SMTP (if you don't).
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

- Original message -
From: Steve Staples 
To: php-general@lists.php.net 
Date: Monday, December 6, 2010, 6:41:34 PM
Subject: [PHP] Redirect output to a file on the web server

On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> On 6 December 2010 15:46, Ferdi  wrote:
> > On 6 December 2010 20:47, Steve Staples  wrote:
> >
> >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> >> > Greetings List members,
> >> >
> >> > I have a script that takes quite a while to run, one or two hours, I wish
> >> to
> >> > redirect the normal php output to a file on the webserver itself. I don't
> >> > mind if in the process, the browser displays a blank page. The reason I
> >> want
> >> > to do this is that if the script crashes or the browser Is closed by
> >> > mistake, I have absolutely no record of where the script stopped running.
> >> >
> >> > I could use code like below
> >> > At the beginning of the script:
> >> > ob_start();
> >> >
> >> > At the end of the script:
> >> > $page = ob_get_contents();
> >> > ob_end_flush();
> >> > $fp = fopen("output.html","w");
> >> > fwrite($fp,$page);
> >> > fclose($fp);
> >> >
> >> > However, I see some problems with this:
> >> > I'm not too sure of the size of the output. It may balloon to over the
> >> > buffering limit (in PHP? Apache?) and then what happens?
> >> > Secondly, if the script crashes before the end, I won't get any output.
> >> > Finally, I am using a library in the script that outputs status and error
> >> > messages of its own. So, if I manually opened a file and used fwrite()
> >> > alongside echo for my messages, I would lose out on those messages.
> >> >
> >> > Anybody has any pointers on how you could send the output not only to a
> >> > browser, but also to a file on the webserver? If not, at least to a file?
> >> >
> >> > Thanks and regards,
> >> > Ferdi
> >>
> >> Just curious, but if it takes that long to run, why are you running it
> >> from a browser?  why not run it from the commandline, that way you dont
> >> have to change your php.ini for the webserver (increasing the timeout,
> >> memory limits, etc etc... you can change those for the CLI only?
> >>
> >> 2 hours is a long time to "hope" that the browser doesn't close, or
> >> connectivity doesn't get interupted for even 1 microsecond...
> >>
> >> if the script has "breaks" in it, where it starts to do something else,
> >> you can put in an email to yourself, to say "hey, we're HERE now"
> >>
> >> but i would look into running it from the CLI over the webserver, you
> >> would be less likely to run into issues on something that takes that
> >> amount of time to run.
> >>
> >> If you needed the output to be displayed on a webpage, you can write the
> >> progress to a file, and then have a php webpage that reads the file, and
> >> using ajax or whatever, refresh the content.
> >>
> >> good luck in your script, and if you still run it from the browser, and
> >> need to output to a file, then i would continually be writing content to
> >> that file, every time you do soemthing, or start another part of the
> >> script so you know EXACTLY where you are, at all times...
> >>
> >> Steve
> >>
> >
> > Hi Steve,
> >
> > Thanks for the tips. To answer your queries, I don't mind using CLI. How do
> > I then ensure the messages, error or otherwise, output by the library I use,
> > show up in the file I'm outputting to? Please note that I only make calls to
> > the functions and object methods from this library and error or success
> > messages are probably echo'd by the code from the library.
> >
> > I believe some context is in order. I am actually sending an email to a
> > large number of our customers (around 10,000), each with the customer's
> > name.
> >
> > My script does output a simple success or failure message. The library
> > outputs more technical info. All I would like t

Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> On 6 December 2010 15:46, Ferdi  wrote:
> > On 6 December 2010 20:47, Steve Staples  wrote:
> >
> >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> >> > Greetings List members,
> >> >
> >> > I have a script that takes quite a while to run, one or two hours, I wish
> >> to
> >> > redirect the normal php output to a file on the webserver itself. I don't
> >> > mind if in the process, the browser displays a blank page. The reason I
> >> want
> >> > to do this is that if the script crashes or the browser Is closed by
> >> > mistake, I have absolutely no record of where the script stopped running.
> >> >
> >> > I could use code like below
> >> > At the beginning of the script:
> >> > ob_start();
> >> >
> >> > At the end of the script:
> >> > $page = ob_get_contents();
> >> > ob_end_flush();
> >> > $fp = fopen("output.html","w");
> >> > fwrite($fp,$page);
> >> > fclose($fp);
> >> >
> >> > However, I see some problems with this:
> >> > I'm not too sure of the size of the output. It may balloon to over the
> >> > buffering limit (in PHP? Apache?) and then what happens?
> >> > Secondly, if the script crashes before the end, I won't get any output.
> >> > Finally, I am using a library in the script that outputs status and error
> >> > messages of its own. So, if I manually opened a file and used fwrite()
> >> > alongside echo for my messages, I would lose out on those messages.
> >> >
> >> > Anybody has any pointers on how you could send the output not only to a
> >> > browser, but also to a file on the webserver? If not, at least to a file?
> >> >
> >> > Thanks and regards,
> >> > Ferdi
> >>
> >> Just curious, but if it takes that long to run, why are you running it
> >> from a browser?  why not run it from the commandline, that way you dont
> >> have to change your php.ini for the webserver (increasing the timeout,
> >> memory limits, etc etc... you can change those for the CLI only?
> >>
> >> 2 hours is a long time to "hope" that the browser doesn't close, or
> >> connectivity doesn't get interupted for even 1 microsecond...
> >>
> >> if the script has "breaks" in it, where it starts to do something else,
> >> you can put in an email to yourself, to say "hey, we're HERE now"
> >>
> >> but i would look into running it from the CLI over the webserver, you
> >> would be less likely to run into issues on something that takes that
> >> amount of time to run.
> >>
> >> If you needed the output to be displayed on a webpage, you can write the
> >> progress to a file, and then have a php webpage that reads the file, and
> >> using ajax or whatever, refresh the content.
> >>
> >> good luck in your script, and if you still run it from the browser, and
> >> need to output to a file, then i would continually be writing content to
> >> that file, every time you do soemthing, or start another part of the
> >> script so you know EXACTLY where you are, at all times...
> >>
> >> Steve
> >>
> >
> > Hi Steve,
> >
> > Thanks for the tips. To answer your queries, I don't mind using CLI. How do
> > I then ensure the messages, error or otherwise, output by the library I use,
> > show up in the file I'm outputting to? Please note that I only make calls to
> > the functions and object methods from this library and error or success
> > messages are probably echo'd by the code from the library.
> >
> > I believe some context is in order. I am actually sending an email to a
> > large number of our customers (around 10,000), each with the customer's
> > name.
> >
> > My script does output a simple success or failure message. The library
> > outputs more technical info. All I would like to know is which email got
> > sent and which one failed. As you point out, I could write the success /
> > failure messages to a file, but, I would also like to capture the messages
> > output by the library.
> >
> > Thanks and regards,
> > Ferdi
> >
> 
> I would log the success/failure with the data (assuming it is coming from a 
> DB).
> 
> If not, you could use a simple file_put_contents($filename, date('r')
> . $text . PHP_EOL, FILE_APPEND);
> 
> That would append 1 line of text at a time to the file. Using tail on
> that file would show you the last work done (and when it was done).
> 
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 

if you're using a linux based server, you could log (like Richard said)
each success / failure to the file, or each to its own success / failure
file, and then if you want to watch the, you could just do a tail -f of
the file, to see what is it doing (sometimes having it scroll is pretty
handy i find)... 

it wouldn't be hard to write a web-based 'tail -f' page, so you can
track the progress from anywhere you wanted :)




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



Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Richard Quadling
On 6 December 2010 15:46, Ferdi  wrote:
> On 6 December 2010 20:47, Steve Staples  wrote:
>
>> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
>> > Greetings List members,
>> >
>> > I have a script that takes quite a while to run, one or two hours, I wish
>> to
>> > redirect the normal php output to a file on the webserver itself. I don't
>> > mind if in the process, the browser displays a blank page. The reason I
>> want
>> > to do this is that if the script crashes or the browser Is closed by
>> > mistake, I have absolutely no record of where the script stopped running.
>> >
>> > I could use code like below
>> > At the beginning of the script:
>> > ob_start();
>> >
>> > At the end of the script:
>> > $page = ob_get_contents();
>> > ob_end_flush();
>> > $fp = fopen("output.html","w");
>> > fwrite($fp,$page);
>> > fclose($fp);
>> >
>> > However, I see some problems with this:
>> > I'm not too sure of the size of the output. It may balloon to over the
>> > buffering limit (in PHP? Apache?) and then what happens?
>> > Secondly, if the script crashes before the end, I won't get any output.
>> > Finally, I am using a library in the script that outputs status and error
>> > messages of its own. So, if I manually opened a file and used fwrite()
>> > alongside echo for my messages, I would lose out on those messages.
>> >
>> > Anybody has any pointers on how you could send the output not only to a
>> > browser, but also to a file on the webserver? If not, at least to a file?
>> >
>> > Thanks and regards,
>> > Ferdi
>>
>> Just curious, but if it takes that long to run, why are you running it
>> from a browser?  why not run it from the commandline, that way you dont
>> have to change your php.ini for the webserver (increasing the timeout,
>> memory limits, etc etc... you can change those for the CLI only?
>>
>> 2 hours is a long time to "hope" that the browser doesn't close, or
>> connectivity doesn't get interupted for even 1 microsecond...
>>
>> if the script has "breaks" in it, where it starts to do something else,
>> you can put in an email to yourself, to say "hey, we're HERE now"
>>
>> but i would look into running it from the CLI over the webserver, you
>> would be less likely to run into issues on something that takes that
>> amount of time to run.
>>
>> If you needed the output to be displayed on a webpage, you can write the
>> progress to a file, and then have a php webpage that reads the file, and
>> using ajax or whatever, refresh the content.
>>
>> good luck in your script, and if you still run it from the browser, and
>> need to output to a file, then i would continually be writing content to
>> that file, every time you do soemthing, or start another part of the
>> script so you know EXACTLY where you are, at all times...
>>
>> Steve
>>
>
> Hi Steve,
>
> Thanks for the tips. To answer your queries, I don't mind using CLI. How do
> I then ensure the messages, error or otherwise, output by the library I use,
> show up in the file I'm outputting to? Please note that I only make calls to
> the functions and object methods from this library and error or success
> messages are probably echo'd by the code from the library.
>
> I believe some context is in order. I am actually sending an email to a
> large number of our customers (around 10,000), each with the customer's
> name.
>
> My script does output a simple success or failure message. The library
> outputs more technical info. All I would like to know is which email got
> sent and which one failed. As you point out, I could write the success /
> failure messages to a file, but, I would also like to capture the messages
> output by the library.
>
> Thanks and regards,
> Ferdi
>

I would log the success/failure with the data (assuming it is coming from a DB).

If not, you could use a simple file_put_contents($filename, date('r')
. $text . PHP_EOL, FILE_APPEND);

That would append 1 line of text at a time to the file. Using tail on
that file would show you the last work done (and when it was done).


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Ferdi
On 6 December 2010 20:47, Steve Staples  wrote:

> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> > Greetings List members,
> >
> > I have a script that takes quite a while to run, one or two hours, I wish
> to
> > redirect the normal php output to a file on the webserver itself. I don't
> > mind if in the process, the browser displays a blank page. The reason I
> want
> > to do this is that if the script crashes or the browser Is closed by
> > mistake, I have absolutely no record of where the script stopped running.
> >
> > I could use code like below
> > At the beginning of the script:
> > ob_start();
> >
> > At the end of the script:
> > $page = ob_get_contents();
> > ob_end_flush();
> > $fp = fopen("output.html","w");
> > fwrite($fp,$page);
> > fclose($fp);
> >
> > However, I see some problems with this:
> > I'm not too sure of the size of the output. It may balloon to over the
> > buffering limit (in PHP? Apache?) and then what happens?
> > Secondly, if the script crashes before the end, I won't get any output.
> > Finally, I am using a library in the script that outputs status and error
> > messages of its own. So, if I manually opened a file and used fwrite()
> > alongside echo for my messages, I would lose out on those messages.
> >
> > Anybody has any pointers on how you could send the output not only to a
> > browser, but also to a file on the webserver? If not, at least to a file?
> >
> > Thanks and regards,
> > Ferdi
>
> Just curious, but if it takes that long to run, why are you running it
> from a browser?  why not run it from the commandline, that way you dont
> have to change your php.ini for the webserver (increasing the timeout,
> memory limits, etc etc... you can change those for the CLI only?
>
> 2 hours is a long time to "hope" that the browser doesn't close, or
> connectivity doesn't get interupted for even 1 microsecond...
>
> if the script has "breaks" in it, where it starts to do something else,
> you can put in an email to yourself, to say "hey, we're HERE now"
>
> but i would look into running it from the CLI over the webserver, you
> would be less likely to run into issues on something that takes that
> amount of time to run.
>
> If you needed the output to be displayed on a webpage, you can write the
> progress to a file, and then have a php webpage that reads the file, and
> using ajax or whatever, refresh the content.
>
> good luck in your script, and if you still run it from the browser, and
> need to output to a file, then i would continually be writing content to
> that file, every time you do soemthing, or start another part of the
> script so you know EXACTLY where you are, at all times...
>
> Steve
>

Hi Steve,

Thanks for the tips. To answer your queries, I don't mind using CLI. How do
I then ensure the messages, error or otherwise, output by the library I use,
show up in the file I'm outputting to? Please note that I only make calls to
the functions and object methods from this library and error or success
messages are probably echo'd by the code from the library.

I believe some context is in order. I am actually sending an email to a
large number of our customers (around 10,000), each with the customer's
name.

My script does output a simple success or failure message. The library
outputs more technical info. All I would like to know is which email got
sent and which one failed. As you point out, I could write the success /
failure messages to a file, but, I would also like to capture the messages
output by the library.

Thanks and regards,
Ferdi


Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> Greetings List members,
> 
> I have a script that takes quite a while to run, one or two hours, I wish to
> redirect the normal php output to a file on the webserver itself. I don't
> mind if in the process, the browser displays a blank page. The reason I want
> to do this is that if the script crashes or the browser Is closed by
> mistake, I have absolutely no record of where the script stopped running.
> 
> I could use code like below
> At the beginning of the script:
> ob_start();
> 
> At the end of the script:
> $page = ob_get_contents();
> ob_end_flush();
> $fp = fopen("output.html","w");
> fwrite($fp,$page);
> fclose($fp);
> 
> However, I see some problems with this:
> I'm not too sure of the size of the output. It may balloon to over the
> buffering limit (in PHP? Apache?) and then what happens?
> Secondly, if the script crashes before the end, I won't get any output.
> Finally, I am using a library in the script that outputs status and error
> messages of its own. So, if I manually opened a file and used fwrite()
> alongside echo for my messages, I would lose out on those messages.
> 
> Anybody has any pointers on how you could send the output not only to a
> browser, but also to a file on the webserver? If not, at least to a file?
> 
> Thanks and regards,
> Ferdi

Just curious, but if it takes that long to run, why are you running it
from a browser?  why not run it from the commandline, that way you dont
have to change your php.ini for the webserver (increasing the timeout,
memory limits, etc etc... you can change those for the CLI only?

2 hours is a long time to "hope" that the browser doesn't close, or
connectivity doesn't get interupted for even 1 microsecond...

if the script has "breaks" in it, where it starts to do something else,
you can put in an email to yourself, to say "hey, we're HERE now"

but i would look into running it from the CLI over the webserver, you
would be less likely to run into issues on something that takes that
amount of time to run.   

If you needed the output to be displayed on a webpage, you can write the
progress to a file, and then have a php webpage that reads the file, and
using ajax or whatever, refresh the content.

good luck in your script, and if you still run it from the browser, and
need to output to a file, then i would continually be writing content to
that file, every time you do soemthing, or start another part of the
script so you know EXACTLY where you are, at all times... 

Steve



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



[PHP] Redirect output to a file on the web server

2010-12-06 Thread Ferdi
Greetings List members,

I have a script that takes quite a while to run, one or two hours, I wish to
redirect the normal php output to a file on the webserver itself. I don't
mind if in the process, the browser displays a blank page. The reason I want
to do this is that if the script crashes or the browser Is closed by
mistake, I have absolutely no record of where the script stopped running.

I could use code like below
At the beginning of the script:
ob_start();

At the end of the script:
$page = ob_get_contents();
ob_end_flush();
$fp = fopen("output.html","w");
fwrite($fp,$page);
fclose($fp);

However, I see some problems with this:
I'm not too sure of the size of the output. It may balloon to over the
buffering limit (in PHP? Apache?) and then what happens?
Secondly, if the script crashes before the end, I won't get any output.
Finally, I am using a library in the script that outputs status and error
messages of its own. So, if I manually opened a file and used fwrite()
alongside echo for my messages, I would lose out on those messages.

Anybody has any pointers on how you could send the output not only to a
browser, but also to a file on the webserver? If not, at least to a file?

Thanks and regards,
Ferdi


Re: [PHP] Redirect to

2010-06-10 Thread Ashley Sheridan
On Thu, 2010-06-10 at 21:06 +0300, Ahmed Mohsen wrote:

> Hi folks,
> I know that this is not a php question, but I'm sure it some kind 
> related to it.  I need to put my public files under "public" folder, and 
> other includes files and database config in other folder not shown to 
> the public, but i don't know how to do that. I hope if some one show me 
> how to achieve this.
> 
> For example, this is the directory structure:
> 
> /root
> --/includes
> db.php
> config.php
> 
> --/public
> /index.php
> /images
> /admin
> --/login.php
> 
> 
> 
> I don't want to enter (example.com/public) to view index.php file.  I 
> just want to enter (example.com) and it redirects to the public folder 
> and shows only (example.com/index.php) in the URL.  And for login.php 
> should display (example.com/admin/login.php) not 
> (example.com/public/admin/login.php)
> 
> Kind regards,
> Ahmed.
> 


If /public is your web root, then alter your virtual hosts file to
reflect this, so that it is the one that is used as the web root.

If /public is not your web root, then you could consider using
mod_rewrite() to internally redirect the content the visitors see,
without them actually knowing about it.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Redirect to

2010-06-10 Thread Daniel P. Brown
On Thu, Jun 10, 2010 at 14:06, Ahmed Mohsen  wrote:
[snip!]
>
> I don't want to enter (example.com/public) to view index.php file.  I just
> want to enter (example.com) and it redirects to the public folder and shows
> only (example.com/index.php) in the URL.  And for login.php should display
> (example.com/admin/login.php) not (example.com/public/admin/login.php)

That's an HTTP server configuration.  For example, with Apache,
you should look at the DocumentRoot setting.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



[PHP] Redirect to

2010-06-10 Thread Ahmed Mohsen

Hi folks,
I know that this is not a php question, but I'm sure it some kind 
related to it.  I need to put my public files under "public" folder, and 
other includes files and database config in other folder not shown to 
the public, but i don't know how to do that. I hope if some one show me 
how to achieve this.


For example, this is the directory structure:

/root
--/includes
db.php
config.php

--/public
/index.php
/images
/admin
--/login.php



I don't want to enter (example.com/public) to view index.php file.  I 
just want to enter (example.com) and it redirects to the public folder 
and shows only (example.com/index.php) in the URL.  And for login.php 
should display (example.com/admin/login.php) not 
(example.com/public/admin/login.php)


Kind regards,
Ahmed.

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



Re: [PHP] Redirect not working on server

2009-06-03 Thread Ashley Sheridan
On Tue, 2009-06-02 at 20:43 -0700, revDAVE wrote:
> Thank you Jay - Shawn & Paul for helping this newbie!
> 
> 
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
> 
> 
> 
> 
Also, according to the spec, the URL should be in absolute form, not
relative like you have there.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Redirect not working on server

2009-06-02 Thread revDAVE
Thank you Jay - Shawn & Paul for helping this newbie!


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] Redirect not working on server

2009-06-02 Thread Paul M Foster
On Tue, Jun 02, 2009 at 11:50:55AM -0700, revDAVE wrote:

> I have this line at the end of 1 big php block...
> 
> header('Location: mypage.php?id=' .
> $_SESSION['id'].'&cat='.$_SESSION['cat']);
> 
> It works fine on my dev. Testing server but does not forward on the actual
> website
> 
> Any way to fix this?
> 
> 
> 
> Home is php 5
> 
> Server (not sure) might not be 5 - maybe v4
> 
> Could that be the problem?
> 

If I ever have a redirect like this, I *always* put after it:

exit();

which ensures it will not do anything else.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Redirect not working on server

2009-06-02 Thread Shawn McKenzie
revDAVE wrote:
> I found the answer here - I had --- whitespace & ... if  
> Location: http://www.phpbuilder.com/board/showthread.php?t=10310794
> 
> Blank space above the php tag or below the final php tag
> It is not intuitive but ...
> 
> if  can cause problems such as the php header function not working.
> 
> 
> =
> 
> 
> *So I just need to get this working... error_reporting(E_ALL);
> 
> If I put this on a page isn't it supposed to override other server setting
> and display errors? It's not - This the page is blank - except for the echo
> test
> 
> 

Yes, but id display_errors = Off then you need to do:
ini_set('display_errors', '1');

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Redirect not working on server

2009-06-02 Thread revDAVE
I found the answer here - I had --- whitespace & ... if http://www.phpbuilder.com/board/showthread.php?t=10310794

Blank space above the php tag or below the final php tag
It is not intuitive but ...

if http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Redirect not working on server

2009-06-02 Thread revDAVE
On 6/2/2009 12:41 PM, "revDAVE"  wrote:

>> [snip]
>> I have this line at the end of 1 big php block...
>> 
>> header('Location: mypage.php?id=' .
>> $_SESSION['id'].'&cat='.$_SESSION['cat']);
>> 
>> It works fine on my dev. Testing server but does not forward on the
>> actual
>> website
>> 
>> Any way to fix this?

The error that a tech said he sees on server version is:

cannot send session cook - headers already sent
cannot modify header

- but no errors at my house...


BTW: I found out that Php on server is v5.1.2

--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] Redirect not working on server

2009-06-02 Thread revDAVE
On 6/2/2009 12:04 PM, "Jay Blanchard"  wrote:

> [snip]
> I have this line at the end of 1 big php block...
> 
> header('Location: mypage.php?id=' .
> $_SESSION['id'].'&cat='.$_SESSION['cat']);
> 
> It works fine on my dev. Testing server but does not forward on the
> actual
> website
> 
> Any way to fix this?
> [/snip]
> 
> The first thing that you will want to do is
> 
> echo $_SESSION['id'];
> echo $_SESSION['cat'];
> 
> To see if they contain anything

THANK YOU JAY,

BTW: I'm a newbie

They seem to be fine - and have proper content

I added this:

error_reporting(E_ALL);

If I put this on a page isn't it supposed to override other server setting
and display errors? It's not - This the page is blank - except for the echo
test


BTW: I found out that Php on server is v5.1.2






--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



RE: [PHP] Redirect not working on server

2009-06-02 Thread Jay Blanchard
[snip]
I have this line at the end of 1 big php block...

header('Location: mypage.php?id=' .
$_SESSION['id'].'&cat='.$_SESSION['cat']);

It works fine on my dev. Testing server but does not forward on the
actual
website

Any way to fix this?
[/snip]

The first thing that you will want to do is

echo $_SESSION['id'];
echo $_SESSION['cat'];

To see if they contain anything

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



[PHP] Redirect not working on server

2009-06-02 Thread revDAVE
I have this line at the end of 1 big php block...

header('Location: mypage.php?id=' .
$_SESSION['id'].'&cat='.$_SESSION['cat']);

It works fine on my dev. Testing server but does not forward on the actual
website

Any way to fix this?



Home is php 5

Server (not sure) might not be 5 - maybe v4

Could that be the problem?


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-16 Thread Clancy
On Thu, 16 Apr 2009 09:26:52 -0500, nos...@mckenzies.net (Shawn McKenzie) wrote:

>Stuart wrote:
>> 2009/4/15 Don :
>>> I have some code in my index.php file that check the user agent and
>>> redirects to a warning page if IE 6 or less is encountered.
>>>
>>> 1. I'm using a framework and so calls to all pages go through index.php
>>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>>
>>> I know how to redirect the users but what I want to do is redirect a user
>>> ONLY the first time the web site is accessed regardless of what page they
>>> first access.  I would like to minimize overhead (no database).  Can this be
>>> done?
>> 
>> Why redirect? That sucks as a user experience. Why not simply put an
>> alert somewhere prominent on the page with the message you want to
>> convey? That way you can have it on every page and not interrupt the
>> users use of your site.
>
>I agree, and you can still try the cookie method to not show the
>message, but it's not a big deal if they don't get the cookie/it expires
>etc., because the worst thing that can happen is that they see the message.

Alternatively add a link 'If you are new/Introduction/etc' that the new user 
can click to
get more information if they want it.


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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-16 Thread Shawn McKenzie
Stuart wrote:
> 2009/4/15 Don :
>> I have some code in my index.php file that check the user agent and
>> redirects to a warning page if IE 6 or less is encountered.
>>
>> 1. I'm using a framework and so calls to all pages go through index.php
>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>
>> I know how to redirect the users but what I want to do is redirect a user
>> ONLY the first time the web site is accessed regardless of what page they
>> first access.  I would like to minimize overhead (no database).  Can this be
>> done?
> 
> Why redirect? That sucks as a user experience. Why not simply put an
> alert somewhere prominent on the page with the message you want to
> convey? That way you can have it on every page and not interrupt the
> users use of your site.

I agree, and you can still try the cookie method to not show the
message, but it's not a big deal if they don't get the cookie/it expires
etc., because the worst thing that can happen is that they see the message.


> 
> -Stuart
> 


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-16 Thread Igor Escobar
I Agree with @stuart.


Regards,
Igor Escoar
Systems Analyst & Interface Designer

--

Personal Blog
~ blog.igorescobar.com
Online Portifolio
~ www.igorescobar.com
Twitter
~ @igorescobar





On Thu, Apr 16, 2009 at 6:05 AM, Stuart  wrote:

> 2009/4/15 Don :
> > I have some code in my index.php file that check the user agent and
> > redirects to a warning page if IE 6 or less is encountered.
> >
> > 1. I'm using a framework and so calls to all pages go through index.php
> > 2. The code that checks for IE 6 or less and redirects is in index.php
> >
> > I know how to redirect the users but what I want to do is redirect a user
> > ONLY the first time the web site is accessed regardless of what page they
> > first access.  I would like to minimize overhead (no database).  Can this
> be
> > done?
>
> Why redirect? That sucks as a user experience. Why not simply put an
> alert somewhere prominent on the page with the message you want to
> convey? That way you can have it on every page and not interrupt the
> users use of your site.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-16 Thread Stuart
2009/4/15 Don :
> I have some code in my index.php file that check the user agent and
> redirects to a warning page if IE 6 or less is encountered.
>
> 1. I'm using a framework and so calls to all pages go through index.php
> 2. The code that checks for IE 6 or less and redirects is in index.php
>
> I know how to redirect the users but what I want to do is redirect a user
> ONLY the first time the web site is accessed regardless of what page they
> first access.  I would like to minimize overhead (no database).  Can this be
> done?

Why redirect? That sucks as a user experience. Why not simply put an
alert somewhere prominent on the page with the message you want to
convey? That way you can have it on every page and not interrupt the
users use of your site.

-Stuart

-- 
http://stut.net/

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



RE: [PHP] redirect to a page the fist time a site is accessed

2009-04-16 Thread Jencisson Tsu

hey,boy, i think you should use datebase to store user status,use user's 
internet-ip and intranet-ip to idenification.
> To: php-general@lists.php.net
> From: d...@program-it.ca
> Date: Wed, 15 Apr 2009 16:20:05 -0400
> Subject: Re: [PHP] redirect to a page the fist time a site is accessed
> 
> 
> "Andrew Ballard"  wrote in message 
> news:b6023aa40904150926g3e6fb478s36b18b6a53ec3...@mail.gmail.com...
> On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim  wrote:
> >
> >
> > On Apr 14, 2009, at 10:11 PM, "Don"  wrote:
> >
> >> Hi,
> >>
> >> I have some code in my index.php file that check the user agent and
> >> redirects to a warning page if IE 6 or less is encountered.
> >>
> >> 1. I'm using a framework and so calls to all pages go through index.php
> >> 2. The code that checks for IE 6 or less and redirects is in index.php
> >>
> >> I know how to redirect the users but what I want to do is redirect a user
> >> ONLY the first time the web site is accessed regardless of what page they
> >> first access. I would like to minimize overhead (no database). Can this
> >> be
> >> done?
> >>
> >> Thanks,
> >> Don
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> > Probably the best way I could think of would be to set a cookie on their
> > computer that you check for when they come and redirect based on that
> > cookie.
> >
> > It's not completely fail proof because all they have to do is clear 
> > cookies
> > and they will see it again but it should work for most people.
> 
> > Well, there is that ... and if the browser does not accept your
> > cookie, it will be trapped in an infinte redirection cycle.
> 
> > Andrew
> 
> Yes and from php.net,
> 
> "Cookies will not become visible until the next loading of a page that the 
> cookie should be visible for."
> 
> So there's no PHP solution for my problem?  I think I need to use unreliable 
> JavaScript. 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Windows Live™: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1b_explore_042009

Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-15 Thread Don

"Andrew Ballard"  wrote in message 
news:b6023aa40904150926g3e6fb478s36b18b6a53ec3...@mail.gmail.com...
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim  wrote:
>
>
> On Apr 14, 2009, at 10:11 PM, "Don"  wrote:
>
>> Hi,
>>
>> I have some code in my index.php file that check the user agent and
>> redirects to a warning page if IE 6 or less is encountered.
>>
>> 1. I'm using a framework and so calls to all pages go through index.php
>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>
>> I know how to redirect the users but what I want to do is redirect a user
>> ONLY the first time the web site is accessed regardless of what page they
>> first access. I would like to minimize overhead (no database). Can this
>> be
>> done?
>>
>> Thanks,
>> Don
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Probably the best way I could think of would be to set a cookie on their
> computer that you check for when they come and redirect based on that
> cookie.
>
> It's not completely fail proof because all they have to do is clear 
> cookies
> and they will see it again but it should work for most people.

> Well, there is that ... and if the browser does not accept your
> cookie, it will be trapped in an infinte redirection cycle.

> Andrew

Yes and from php.net,

"Cookies will not become visible until the next loading of a page that the 
cookie should be visible for."

So there's no PHP solution for my problem?  I think I need to use unreliable 
JavaScript. 



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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-15 Thread Andrew Ballard
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim  wrote:
>
>
> On Apr 14, 2009, at 10:11 PM, "Don"  wrote:
>
>> Hi,
>>
>> I have some code in my index.php file that check the user agent and
>> redirects to a warning page if IE 6 or less is encountered.
>>
>> 1. I'm using a framework and so calls to all pages go through index.php
>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>
>> I know how to redirect the users but what I want to do is redirect a user
>> ONLY the first time the web site is accessed regardless of what page they
>> first access.  I would like to minimize overhead (no database).  Can this
>> be
>> done?
>>
>> Thanks,
>> Don
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Probably the best way I could think of would be to set a cookie on their
> computer that you check for when they come and redirect based on that
> cookie.
>
> It's not completely fail proof because all they have to do is clear cookies
> and they will see it again but it should work for most people.

Well, there is that ... and if the browser does not accept your
cookie, it will be trapped in an infinte redirection cycle.

Andrew

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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-14 Thread Jason Pruim



On Apr 14, 2009, at 10:11 PM, "Don"  wrote:


Hi,

I have some code in my index.php file that check the user agent and
redirects to a warning page if IE 6 or less is encountered.

1. I'm using a framework and so calls to all pages go through  
index.php

2. The code that checks for IE 6 or less and redirects is in index.php

I know how to redirect the users but what I want to do is redirect a  
user
ONLY the first time the web site is accessed regardless of what page  
they
first access.  I would like to minimize overhead (no database).  Can  
this be

done?

Thanks,
Don



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



Probably the best way I could think of would be to set a cookie on  
their computer that you check for when they come and redirect based on  
that cookie.


It's not completely fail proof because all they have to do is clear  
cookies and they will see it again but it should work for most people.




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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-14 Thread Chris

Don wrote:

Hi,

I have some code in my index.php file that check the user agent and 
redirects to a warning page if IE 6 or less is encountered.


1. I'm using a framework and so calls to all pages go through index.php
2. The code that checks for IE 6 or less and redirects is in index.php

I know how to redirect the users but what I want to do is redirect a user 
ONLY the first time the web site is accessed regardless of what page they 
first access.  I would like to minimize overhead (no database).  Can this be 
done?


# first time visitor?
if (!isset(cookie)) {
 set cookie
 redirect
 exit;
}

# they've been here before, continue as normal.

--
Postgresql & php tutorials
http://www.designmagick.com/


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



[PHP] redirect to a page the fist time a site is accessed

2009-04-14 Thread Don
Hi,

I have some code in my index.php file that check the user agent and 
redirects to a warning page if IE 6 or less is encountered.

1. I'm using a framework and so calls to all pages go through index.php
2. The code that checks for IE 6 or less and redirects is in index.php

I know how to redirect the users but what I want to do is redirect a user 
ONLY the first time the web site is accessed regardless of what page they 
first access.  I would like to minimize overhead (no database).  Can this be 
done?

Thanks,
Don 



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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Philip Thompson

On Jun 12, 2008, at 8:32 AM, Bastien Koert wrote:

On Thu, Jun 12, 2008 at 7:46 AM, Yashesh Bhatia <[EMAIL PROTECTED]>  
wrote:




What about doing it the other way ... submitting the page to a  
script

that calls on the pdf creation, yet doesnt leave this script - then
proceed to redirect when that script (pdf) has been completed?

S



steven:

   the steps u'r suggesting are
1 - submit form (1.html) to script (2.php)
2 - 2.php generates the pdf but does not give it for download
3 - after generating the pdf , 2.php then redirects to 3.html..

so where does the download happen ? in 3.html ?

thx.

yashesh



Force the download thru a new window or a frame inside the main  
window.

Then you can redirect the main window to where you need it


Frames = Bad! (and that's not an assignment ;)

As Richard provided the link (http://www.w3.org/TR/2008/WD-html5-diff-20080610/ 
) in a different thread, this comes straight from the article about  
HTML 5:


"The following elements are not in HTML 5 because their usage affected  
usability and accessibility for the end user in a negative way:


* frame
* frameset
* noframes"

I know we're not in HTML5 yet, but might as well prepare. Sorry to go  
a bit off topic, but I had to throw that out. =D


~Philip

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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Jim Lucas

Yashesh Bhatia wrote:

What about doing it the other way ... submitting the page to a script
that calls on the pdf creation, yet doesnt leave this script - then
proceed to redirect when that script (pdf) has been completed?

S



steven:

 the steps u'r suggesting are
1 - submit form (1.html) to script (2.php)
2 - 2.php generates the pdf but does not give it for download
3 - after generating the pdf , 2.php then redirects to 3.html..

so where does the download happen ? in 3.html ?

thx.

yashesh



1.  Collect Information from client & submit data
2.  Process data and generate PDF, write PDF, display error/success message
3.  If successful, have a javascript or  redirect to then download
PDF generated in step 2.

I would do it this way so in case their were any problems generating the PDF, 
you would have a way to indicate that to the client.  Rather then trying to 
force them to download a broken PDF document.


One suggestion to go along with this is that you will need to have a routine 
that will clean out all the generated PDF's every now and again.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Nitsan Bin-Nun
You are totally in the wrong way.
I would use an  tag and onclick property for opening the PDF in popup &
relocating the current page

HTH
Nitsan

On 12/06/2008, Yashesh Bhatia <[EMAIL PROTECTED]> wrote:
>
> Hello:
>
>I'm trying to emulate a problem i'm trying to solve as follows.
>
> 1 - user enters information into a html form and submits
> 2 - a php script is invoked on the submit and a pdf file is stamped
> and made available for download
> 3 - the script finally redirects the user to a thank you html page.
>
> i'm having a problem in the redirect to the thank you page.
> here's the 3 files
>    1.html 
> 
> 
> First Name: 
> Last Name:  
> 
> 
> 
>
> 
>  2.php 
>  // some stamping code ...
> // open the file in a binary mode
> $name = "2.pdf";
> fp = fopen($name, 'rb');
>
> // send headers, dump the pdf file and finally redirect
> header("Content-Type: application/pdf");
> header("Content-Disposition: attachment; filename=$name");
> header("Content-Length: " . filesize($name));
> fpassthru($fp);
>
> echo '';
> echo 'window.location.href="3.html";';
> echo '';
> ?>
>
> 
>  3.html 
> 
> Thank you for downloading 2.pdf
> 
>
> 
>
> The submit works fine and the pdf is availble for download however,
> the redirect does not happen.
> If i comment the lines
> //header("Content-Type: application/pdf");
> //header("Content-Disposition: attachment; filename=$name");
> //header("Content-Length: " . filesize($name));
> //fpassthru($fp);
>
> then the redirect happens after the submit.
>
> i'm testing / running it on fedora core 6, Apache 2.2.5, php 5.2.5 and
> firefox 1.5
> Any help / pointers is appreciated.
>
> Thanks.
>
> Yashesh Bhatia.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Bastien Koert
On Thu, Jun 12, 2008 at 7:46 AM, Yashesh Bhatia <[EMAIL PROTECTED]> wrote:

> >
> > What about doing it the other way ... submitting the page to a script
> > that calls on the pdf creation, yet doesnt leave this script - then
> > proceed to redirect when that script (pdf) has been completed?
> >
> > S
> >
>
> steven:
>
> the steps u'r suggesting are
> 1 - submit form (1.html) to script (2.php)
> 2 - 2.php generates the pdf but does not give it for download
> 3 - after generating the pdf , 2.php then redirects to 3.html..
>
> so where does the download happen ? in 3.html ?
>
> thx.
>
> yashesh
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Force the download thru a new window or a frame inside the main window.
Then you can redirect the main window to where you need it


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Yashesh Bhatia
>
> What about doing it the other way ... submitting the page to a script
> that calls on the pdf creation, yet doesnt leave this script - then
> proceed to redirect when that script (pdf) has been completed?
>
> S
>

steven:

 the steps u'r suggesting are
1 - submit form (1.html) to script (2.php)
2 - 2.php generates the pdf but does not give it for download
3 - after generating the pdf , 2.php then redirects to 3.html..

so where does the download happen ? in 3.html ?

thx.

yashesh

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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Steven Macintyre
On Thu, 2008-06-12 at 16:27 +0530, Yashesh Bhatia wrote:
> Aschwin:
> 
>  Hi i tried
> 
> --
> //echo '';
> //echo 'window.location.href="3.html";';
> //echo '';
> header("Location: 3.html");
> exit;
> --
> but that did not work :(.
> 
> thanks for the tip.
> 
> yashesh bhatia

What about doing it the other way ... submitting the page to a script
that calls on the pdf creation, yet doesnt leave this script - then
proceed to redirect when that script (pdf) has been completed?

S


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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Yashesh Bhatia
Aschwin:

 Hi i tried

--
//echo '';
//echo 'window.location.href="3.html";';
//echo '';
header("Location: 3.html");
exit;
--
but that did not work :(.

thanks for the tip.

yashesh bhatia

>
> Hi,
>
> What you are doing is:
>
> header("Content-Type: application/pdf");
>
> And after that you try to echo some script. But the browser already thinks
> that belongs to the PDF and not to a HTML page.
>
> What I think should work instead of the script part is just:
>
> header('Location: 3.html');
> exit;
>
> But I'm not sure it works.
>
> --
>
> Aschwin Wesselius
>
> 'What you would like to be done to you, do that to the other'
>

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



Re: [PHP] Redirect after pdf / file download

2008-06-12 Thread Aschwin Wesselius

Yashesh Bhatia wrote:

Hello:

I'm trying to emulate a problem i'm trying to solve as follows.

1 - user enters information into a html form and submits
2 - a php script is invoked on the submit and a pdf file is stamped
and made available for download
3 - the script finally redirects the user to a thank you html page.

i'm having a problem in the redirect to the thank you page.
here's the 3 files
   1.html 


  First Name: 
  Last Name:  
 



 2.php 
';
echo 'window.location.href="3.html";';
echo '';
?>

 3.html 

Thank you for downloading 2.pdf



The submit works fine and the pdf is availble for download however,
the redirect does not happen.
If i comment the lines
//header("Content-Type: application/pdf");
//header("Content-Disposition: attachment; filename=$name");
//header("Content-Length: " . filesize($name));
//fpassthru($fp);

then the redirect happens after the submit.

i'm testing / running it on fedora core 6, Apache 2.2.5, php 5.2.5 and
firefox 1.5
Any help / pointers is appreciated.

Thanks.

Yashesh Bhatia.
  


Hi,

What you are doing is:

header("Content-Type: application/pdf");


And after that you try to echo some script. But the browser already 
thinks that belongs to the PDF and not to a HTML page.


What I think should work instead of the script part is just:

header('Location: 3.html');
exit;

But I'm not sure it works.

--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


[PHP] Redirect after pdf / file download

2008-06-12 Thread Yashesh Bhatia
Hello:

I'm trying to emulate a problem i'm trying to solve as follows.

1 - user enters information into a html form and submits
2 - a php script is invoked on the submit and a pdf file is stamped
and made available for download
3 - the script finally redirects the user to a thank you html page.

i'm having a problem in the redirect to the thank you page.
here's the 3 files
   1.html 


  First Name: 
  Last Name:  
 



 2.php 
';
echo 'window.location.href="3.html";';
echo '';
?>

 3.html 

Thank you for downloading 2.pdf



The submit works fine and the pdf is availble for download however,
the redirect does not happen.
If i comment the lines
//header("Content-Type: application/pdf");
//header("Content-Disposition: attachment; filename=$name");
//header("Content-Length: " . filesize($name));
//fpassthru($fp);

then the redirect happens after the submit.

i'm testing / running it on fedora core 6, Apache 2.2.5, php 5.2.5 and
firefox 1.5
Any help / pointers is appreciated.

Thanks.

Yashesh Bhatia.

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



Re: [PHP] redirect stdout to stderr

2008-02-22 Thread Bojan Tesanovic

Hi Jack,
here is a link that can be of help
http://bugs.php.net/bug.php?id=22839

also you can use custom error handler function , catch errors and  
write to stderr



function myErrorHandler($errno, $errstr, $errfile, $errline)
{
$ERROR='';
switch ($errno) {
case E_USER_ERROR:
$ERROR = "My ERROR [$errno] $errstr\n";
$ERROR.= "  Fatal error on line $errline in file $errfile";
$ERROR.= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
$ERROR.= "Aborting...\n";

break;

case E_USER_WARNING:
$ERROR= "My WARNING [$errno] $errstr\n";
break;

case E_USER_NOTICE:
$ERROR= "My NOTICE [$errno] $errstr\n";
break;

default:
$ERROR  = echo "Unknown error type: [$errno] $errstr\n";
break;

}


if($ERROR){
$stderr = fopen('php://stderr', 'w');
fwrite($stderr, $ERROR );
fclose($stderr);
}

/* Don't execute PHP internal error handler */
return true;
}


set_error_handler("myErrorHandler");


//code .
==

I guess you can achieve what you need by one of those 2 concepts
Cheers.

On Feb 23, 2008, at 1:04 AM, Jack Bates wrote:


How can I implement in PHP, a script which redirects stdout to stderr,
such that echo, etc. print to stderr instead of stdout?

I can redirect stdout to stderr when invoking PHP like so:

php script-name >&2

However I want to perform this redirection within the script itself.

The solution I currently use is output buffering:

ob_start();

// Call library code

fwrite(STDERR, ob_get_contents());
ob_end_clean();

However I wonder if there's a more efficient way, so that output  
appears

on stderr immediately, rather than waiting for fwrite(STDERR,
ob_get_contents());

My reason for wanting this is to create a Subversion pre-commit hook
using PHP_CodeSniffer: http://pear.php.net/package/PHP_CodeSniffer

I want:

1) Commits to our Subversion repository to be checked against our  
coding

standard with PHP_CodeSniffer
2) Commits to fail when PHP_CodeSniffer returns an error
3) PHP_CodeSniffer's report to be displayed to the Subversion user, so
they can fix any problems

I achieved 1) and 2), but PHP_CodeSniffer prints its report to stdout
and Subversion only displays stderr to the user, not stdout. So to  
make
this pre-commit hook fool proof, I want it to redirect  
PHP_CodeSniffer's

report to stderr.

Anyone have better suggestions than output buffering?

Much thanks, Jack


Bojan Tesanovic
http://www.classicio.com/
http://www.carster.us/





[PHP] redirect stdout to stderr

2008-02-22 Thread Jack Bates
How can I implement in PHP, a script which redirects stdout to stderr,
such that echo, etc. print to stderr instead of stdout?

I can redirect stdout to stderr when invoking PHP like so:

php script-name >&2

However I want to perform this redirection within the script itself.

The solution I currently use is output buffering:

ob_start();

// Call library code

fwrite(STDERR, ob_get_contents());
ob_end_clean();

However I wonder if there's a more efficient way, so that output appears
on stderr immediately, rather than waiting for fwrite(STDERR,
ob_get_contents());

My reason for wanting this is to create a Subversion pre-commit hook
using PHP_CodeSniffer: http://pear.php.net/package/PHP_CodeSniffer

I want:

1) Commits to our Subversion repository to be checked against our coding
standard with PHP_CodeSniffer
2) Commits to fail when PHP_CodeSniffer returns an error
3) PHP_CodeSniffer's report to be displayed to the Subversion user, so
they can fix any problems

I achieved 1) and 2), but PHP_CodeSniffer prints its report to stdout
and Subversion only displays stderr to the user, not stdout. So to make
this pre-commit hook fool proof, I want it to redirect PHP_CodeSniffer's
report to stderr.

Anyone have better suggestions than output buffering?

Much thanks, Jack


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


Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Neo [GC]
Ah, i thought to remember that the limit is lower on IIS than on Apache, 
maybe i've just some memory faults. ;)


GET is meant to define what to GET, not to define content. This sounds a 
bit academic, but remember that the GET-args are a part of the URI and 
so will also go into the http-log for example. One don't want to have 
2kb per log-line. ;)
Additionally, please think of the great talent of users to fuck things 
up: GET-args will become bookmarks, links etc. and WILL do funny things 
when overused (session-ids...). ;)



Daniel Brown schrieb:


Beating a dead horse here, since it's been mentioned twice already, 
but yeah --- $_SESSION's are the way to go with this.




And wherever you have your error handling, do:


And for the record, it's not just the HTTP server that trims it, but 
the browser generally does, as well, to avoid things such as memory 
leaks, et cetera.  Internet Exploder, for example, has had a limit of 
2,083 total characters in a GET request, but the actual RFC for HTTP/1.1 
has no limit for the protocol (RFC 2616 Section 3.2.1).


And slightly off-topic, but think about how much the web has changed 
in the last 20 years (well, 17, since the HTTP protocol came about in 
1990) and then think about the fact that it's all still based on 
nothing higher than version 1.1.


On 5/3/07, *Neo [GC]* <[EMAIL PROTECTED] > 
wrote:


Merlin schrieb:
 > Hi there,
 >
 > I am checking plausability inside a php script that receives a POST
 > submit. If an error occures the user should be redirected back, along
 > with his original data filled into the forms.
 >
 > There is a problem with this. As the GET method, which the
redirect is
 > using, only allows a certain amount of characters, the text is always
 > cut down.
 >
 > I use this:
 > HEADER("Location:".$data[rurl]."?error=".$error.$parameter);
 >
 > Is there a way to redirect the user to the form and fill in large
text?
 >
 > Thank you for your help,
 >
 > Best regards, Merlin
 >

This is a normal behaviour. Webservers trim the GET-request at a
certain
length.

You have several options:
- don't do a redirect but return the form, with most clean frameworks it
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the
cookie afterwards (ugly)


Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Daniel Brown

   If it's on the same domain/user account, that's probably a better
idea but with $data['rurl'] being used, I'm (ignorantly) assuming that
RURL = Remote URL.

On 5/3/07, Richard Lynch <[EMAIL PROTECTED]> wrote:


On Thu, May 3, 2007 9:26 am, Merlin wrote:
> I am checking plausability inside a php script that receives a POST
> submit. If an error occures the user should be redirected back, along
> with his original data filled into the forms.
>
> There is a problem with this. As the GET method, which the redirect is
> using, only allows a certain amount of characters, the text is always
> cut down.
>
> I use this:
> HEADER("Location:".$data[rurl]."?error=".$error.$parameter);
>
> Is there a way to redirect the user to the form and fill in large
> text?

Not really, no, not with the re-direct...

But why do you feel the need to do a re-direct anyway?

With a simple re-structuring of your code, you can just do an
"include" to get the form back in with the data pre-filled, and have
them try again.

Why waste an HTTP connection, more hard drive hits to include all your
function libraries (or whatever), ...?

You've already GOT all the info you need in your hands right there to
display what you want to display.  Just display it.

:-)

--
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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Daniel Brown

   Beating a dead horse here, since it's been mentioned twice already, but
yeah --- $_SESSION's are the way to go with this.



   And wherever you have your error handling, do:


   And for the record, it's not just the HTTP server that trims it, but the
browser generally does, as well, to avoid things such as memory leaks, et
cetera.  Internet Exploder, for example, has had a limit of 2,083 total
characters in a GET request, but the actual RFC for HTTP/1.1 has no limit
for the protocol (RFC 2616 Section 3.2.1).

   And slightly off-topic, but think about how much the web has changed in
the last 20 years (well, 17, since the HTTP protocol came about in 1990)
and then think about the fact that it's all still based on nothing higher
than version 1.1.

On 5/3/07, Neo [GC] <[EMAIL PROTECTED]> wrote:


Merlin schrieb:
> Hi there,
>
> I am checking plausability inside a php script that receives a POST
> submit. If an error occures the user should be redirected back, along
> with his original data filled into the forms.
>
> There is a problem with this. As the GET method, which the redirect is
> using, only allows a certain amount of characters, the text is always
> cut down.
>
> I use this:
> HEADER("Location:".$data[rurl]."?error=".$error.$parameter);
>
> Is there a way to redirect the user to the form and fill in large text?
>
> Thank you for your help,
>
> Best regards, Merlin
>

This is a normal behaviour. Webservers trim the GET-request at a certain
length.

You have several options:
- don't do a redirect but return the form, with most clean frameworks it
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the
cookie afterwards (ugly)


Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Richard Lynch
On Thu, May 3, 2007 9:26 am, Merlin wrote:
> I am checking plausability inside a php script that receives a POST
> submit. If an error occures the user should be redirected back, along
> with his original data filled into the forms.
>
> There is a problem with this. As the GET method, which the redirect is
> using, only allows a certain amount of characters, the text is always
> cut down.
>
> I use this:
> HEADER("Location:".$data[rurl]."?error=".$error.$parameter);
>
> Is there a way to redirect the user to the form and fill in large
> text?

Not really, no, not with the re-direct...

But why do you feel the need to do a re-direct anyway?

With a simple re-structuring of your code, you can just do an
"include" to get the form back in with the data pre-filled, and have
them try again.

Why waste an HTTP connection, more hard drive hits to include all your
function libraries (or whatever), ...?

You've already GOT all the info you need in your hands right there to
display what you want to display.  Just display it.

:-)

-- 
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] Redirect via GET is loosing characters

2007-05-03 Thread Stut

Merlin wrote:
I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER("Location:".$data[rurl]."?error=".$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?


http://php.net/session

-Stut

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



[PHP] Redirect via GET is loosing characters

2007-05-03 Thread Merlin

Hi there,

I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER("Location:".$data[rurl]."?error=".$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?

Thank you for your help,

Best regards, Merlin

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



Re: [PHP] Redirect via GET is loosing characters

2007-05-03 Thread Neo [GC]

Merlin schrieb:

Hi there,

I am checking plausability inside a php script that receives a POST 
submit. If an error occures the user should be redirected back, along 
with his original data filled into the forms.


There is a problem with this. As the GET method, which the redirect is 
using, only allows a certain amount of characters, the text is always 
cut down.


I use this:
HEADER("Location:".$data[rurl]."?error=".$error.$parameter);

Is there a way to redirect the user to the form and fill in large text?

Thank you for your help,

Best regards, Merlin



This is a normal behaviour. Webservers trim the GET-request at a certain 
length.


You have several options:
- don't do a redirect but return the form, with most clean frameworks it 
should be no problem to include the action wich generates the form
- save the variables in a session, then send the redirect-header and 
clean the session after regenerating the form
- save the variables in a cookie stored at the client and clean the 
cookie afterwards (ugly)



Greetings,

--
Thomas 'Neo' Weber

Webmaster
GothNet.eu | Gothic-Chat.de

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Ross
Thanks all I manged to fix it.

The headers were already sent by a validation class I was using and needed a 
bit of output buffering to get it working.


R. 

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Richard Lynch
On Tue, April 17, 2007 10:02 am, Ross wrote:
> Right,
>
> Have tried the full url for the header and it still doesn't work. I
> may have
> to resort to...javacript redirects unless someone can suggest a way
> around
> it.
>
> Here is the phpinfo();
>
> http://s202801613.websitehome.co.uk/info.php
>
>
> Is is 1and1 hosting if anyone had had any experience of them.

This site is hosted on 1and1.com and DEFINTELY does a header redirect:
http://telephonebook.com/

In fact, that's pretty much *all* the site does :-)

It's like a tinyURL for your phone number to your blog thingie.

Ignore the ugliness, please. We've got new artwork going up shortly.

-- 
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] redirect with header still not working

2007-04-17 Thread Chris Shiflett
Ross wrote:
> Have tried the full url for the header and it still doesn't work.

I forget what your exact issue is, but a good first step to take when
debugging a problem with header() is to replace it with echo. For example:

echo "Location: $url";

Instead of:

header("Location: $url");

Almost every problem I can recall someone having with header() was a
result of either:

1. Headers already being sent, as others have guessed.
2. The argument passed to header() being malformed, and the browser
doesn't interpret the malformed header as desired.

Hope that helps.

Chris

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

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Jim Lucas

Ross wrote:

Right,

Have tried the full url for the header and it still doesn't work. I may have 
to resort to...javacript redirects unless someone can suggest a way around 
it.


Here is the phpinfo();

http://s202801613.websitehome.co.uk/info.php


Is is 1and1 hosting if anyone had had any experience of them.

thanks,


R.


actually, let me re-state that, it will then display the error that is being 
generated.

It won't fix it, but at least display it to you.

It will probably complain about output in a given file somewhere before you are 
calling header(...)

it will give you the line number that the output is being generated on.

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times 
for you and me when all such things agree.


- Rush

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Jim Lucas

Ross wrote:

Right,

Have tried the full url for the header and it still doesn't work. I may have 
to resort to...javacript redirects unless someone can suggest a way around 
it.


Here is the phpinfo();

http://s202801613.websitehome.co.uk/info.php


Is is 1and1 hosting if anyone had had any experience of them.

thanks,


R.


if you look at your error_report setting.  is it 2037

somebody correct me if I am wrong, but isn't this setting

I ran this on my older system and found that
(E_ALL & ~E_NOTICE & ~E_WARNING) all together = 2037

so, even though you have display_errors turned on, it isn't going to show them.
you need to set this to just E_ALL



This should solve your problem

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times 
for you and me when all such things agree.


- Rush

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



RE: [PHP] redirect with header still not working

2007-04-17 Thread Jim Moseby
> 
> Have tried the full url for the header and it still doesn't 
> work. I may have 
> to resort to...javacript redirects unless someone can suggest 
> a way around 
> it.
> 
> Here is the phpinfo();
> 
> http://s202801613.websitehome.co.uk/info.php
> 
> 
> Is is 1and1 hosting if anyone had had any experience of them.
> 
> thanks,
> 
> 
> R.

I have several sites with 1and1, and I use header() with no problems.  The
main issue I have run into with header() is that your script can produce NO
OUTPUT prior to the header() call.  Not even a whitespace, else header()
will not work.

JM

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Dave Goodchild

That is, unless you use output buffering. It may not be the most elegant
solution (using header() to redirect users increases server calls), but I
built a template-driven php site that calls:



...depending on certain conditions which means I can then use header() even
after I have started output.


[PHP] redirect with header still not working

2007-04-17 Thread Ross
Right,

Have tried the full url for the header and it still doesn't work. I may have 
to resort to...javacript redirects unless someone can suggest a way around 
it.

Here is the phpinfo();

http://s202801613.websitehome.co.uk/info.php


Is is 1and1 hosting if anyone had had any experience of them.

thanks,


R.

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



Re: [PHP] redirect with header still not working

2007-04-17 Thread Dave Goodchild

Can you re-iterate what is happening - I have a site with 1and1 and use
header() with no issues.


Re: [PHP] redirect http to https

2007-04-10 Thread Richard Lynch
On Mon, April 9, 2007 8:38 am, Martin Marques wrote:
> Ben Liu escribió:
>> What's the prescribed method for redirecting a user forcibly to from
>> the
>> non-SSL secured version of a page to the SSL-secured version? Is
>> this
>> handled at the web server level or at the script level. I found this
>> by
>> googling:
>
> This should be done with the rewrite instruction of apache, or what
> ever
> instructionyour web server has.

Assume, for the sake of argument, that you have no access to
mod_rewrite, httpd.conf, nor even .htaccess

>> > if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !==
>> "on")
>> {header("Location:
>> https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;}
>> ?>
>
> Very bad solution.

What specifically is so bad?

-- 
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] redirect http to https

2007-04-10 Thread Jason Karns

On 4/10/07, Zoltán Németh <[EMAIL PROTECTED]> wrote:

I have separate document roots for the http and the https stuff, say
"htdocs" and "htdocs-secure" - this can be done with apache
configuration
then I need only to put a single redirecting line into the
htdocs/index.php like

https://my.server.com/";);
?>

and that's all

greets
Zoltán Németh

2007. 04. 9, hétfő keltezéssel 08.40-kor Ben Liu ezt írta:
> What's the prescribed method for redirecting a user forcibly to from
> the non-SSL secured version of a page to the SSL-secured version? Is
> this handled at the web server level or at the script level. I found
> this by googling:
>
>  if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on")
> {header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER
> ['SCRIPT_NAME']);exit;}
> ?>
>
> What do people think about this solution?
>
> Thanks,
>
> - Ben
>

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




I believe you should also be sending a 301 status header so user
agents can be made aware of the redirect and make updates accordingly
(bookmarks, etc.)

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2


Re: [PHP] redirect http to https

2007-04-10 Thread Zoltán Németh
I have separate document roots for the http and the https stuff, say
"htdocs" and "htdocs-secure" - this can be done with apache
configuration
then I need only to put a single redirecting line into the
htdocs/index.php like

https://my.server.com/";);
?>

and that's all

greets
Zoltán Németh

2007. 04. 9, hétfő keltezéssel 08.40-kor Ben Liu ezt írta:
> What's the prescribed method for redirecting a user forcibly to from  
> the non-SSL secured version of a page to the SSL-secured version? Is  
> this handled at the web server level or at the script level. I found  
> this by googling:
> 
>  if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on")
> {header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER 
> ['SCRIPT_NAME']);exit;}
> ?>
> 
> What do people think about this solution?
> 
> Thanks,
> 
> - Ben
> 

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



Re: [PHP] redirect http to https

2007-04-10 Thread Chris



{header("Location: 
https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;}

?>


Very bad solution.


Don't just tell us it's bad, explain why (even with an RTFM or URL to 
look at)... nobody learns from an answer like this.


The only thing I can think of is that $_SERVER variables can be 
compromised (ie you can't rely on them, they can be changed via curl or 
some other method).


But that's just a guess.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] redirect http to https

2007-04-09 Thread Ben Liu

On 4/9/07, Peter Lauri <[EMAIL PROTECTED]> wrote:


You might be able to do this by putting an .htaccess file in your webroot of
non-ssl:

--
RewriteEngine On

RewriteRule ^/(.*)$ https://www.yourdomain.com/$1 [L]
--


This appears to work:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [L,R]

(sorry if off-topic)

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



RE: [PHP] redirect http to https

2007-04-09 Thread Peter Lauri
> -Original Message-
> From: Ben Liu [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 09, 2007 3:52 PM
> To: Martin Marques; PHP
> Subject: Re: [PHP] redirect http to https
> 
> On 4/9/07, Martin Marques  wrote:
> 
> >
> > This should be done with the rewrite instruction of apache, or what ever
> > instructionyour web server has.
> 
> Um...guess I will have to check with our hosting company about this.
> Thanks.
> 
> - Ben
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

[Peter Lauri - DWS Asia] 

You might be able to do this by putting an .htaccess file in your webroot of
non-ssl:

--
RewriteEngine On

RewriteRule ^/(.*)$ https://www.yourdomain.com/$1 [L]
--

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

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



Re: [PHP] redirect http to https

2007-04-09 Thread Tijnema !

On 4/9/07, Ben Liu <[EMAIL PROTECTED]> wrote:

What's the prescribed method for redirecting a user forcibly to from
the non-SSL secured version of a page to the SSL-secured version? Is
this handled at the web server level or at the script level. I found
this by googling:

https://".$_SERVER['SERVER_NAME'].$_SERVER
['SCRIPT_NAME']);exit;}
?>

What do people think about this solution?

Thanks,

- Ben


Apache mod_rewrite maybe?

Tijnema


--
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] redirect http to https

2007-04-09 Thread edwardspl
Ben Liu wrote:

> On 4/9/07, Martin Marques  wrote:
>
>>
>> This should be done with the rewrite instruction of apache, or what ever
>> instructionyour web server has.
>
>
> Um...guess I will have to check with our hosting company about this.
> Thanks.
>
> - Ben
>
Hello,

FYI :

https://www.yourdomain_name.com";);
exit();
?>

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



Re: [PHP] redirect http to https

2007-04-09 Thread Ben Liu

On 4/9/07, Martin Marques  wrote:



This should be done with the rewrite instruction of apache, or what ever
instructionyour web server has.


Um...guess I will have to check with our hosting company about this. Thanks.

- Ben

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



Re: [PHP] redirect http to https

2007-04-09 Thread Martin Marques

Ben Liu escribió:
What's the prescribed method for redirecting a user forcibly to from the 
non-SSL secured version of a page to the SSL-secured version? Is this 
handled at the web server level or at the script level. I found this by 
googling:


This should be done with the rewrite instruction of apache, or what ever 
instructionyour web server has.



{header("Location: 
https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;}

?>


Very bad solution.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP] redirect http to https

2007-04-09 Thread edwardspl
Ben Liu wrote:

> What's the prescribed method for redirecting a user forcibly to from
> the non-SSL secured version of a page to the SSL-secured version? Is
> this handled at the web server level or at the script level. I found
> this by googling:
>
>  if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on")
> {header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER
> ['SCRIPT_NAME']);exit;}
> ?>
>
> What do people think about this solution?
>
> Thanks,
>
> - Ben
>
Hello,

Why not config this knid of function by using you Web Server ?

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



[PHP] redirect http to https

2007-04-09 Thread Ben Liu
What's the prescribed method for redirecting a user forcibly to from  
the non-SSL secured version of a page to the SSL-secured version? Is  
this handled at the web server level or at the script level. I found  
this by googling:


{header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER 
['SCRIPT_NAME']);exit;}

?>

What do people think about this solution?

Thanks,

- Ben

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



Re: [Fwd: Re: [PHP] redirect using php]

2006-04-05 Thread Schalk
Thanks everyone for your help. In the end the simplest one that works 
for this specific project was:


echo "";

Andrei wrote:


Andrei wrote:


It works with document.location = '...'; too. I use only this method 
and it worked on all browsers...




Assuming the end user has JS turned on.  JS and Meta Refreshes are not
acceptable when you need to be sure the redirect works.

Depends on your user target...
I generally suppose the users using my code enabled JS on their 
browsers. If they didn't too bad. I can't code everything judging 
there are ppl that do restrictions on their browsers.


Andy



--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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



[Fwd: Re: [PHP] redirect using php]

2006-04-05 Thread Andrei


Andrei wrote:


It works with document.location = '...'; too. I use only this method and 
it worked on all browsers...




Assuming the end user has JS turned on.  JS and Meta Refreshes are not
acceptable when you need to be sure the redirect works.

Depends on your user target...
I generally suppose the users using my code enabled JS on their 
browsers. If they didn't too bad. I can't code everything judging there 
are ppl that do restrictions on their browsers.


Andy

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



Re: [PHP] redirect using php

2006-04-05 Thread John Nichel

Andrei wrote:


It works with document.location = '...'; too. I use only this method and 
it worked on all browsers...




Assuming the end user has JS turned on.  JS and Meta Refreshes are not 
acceptable when you need to be sure the redirect works.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
On Wednesday 05 April 2006 14:33, Chris Shiflett wrote:
> Mark Kelly wrote:
> > > > You can also use something like:
> > > >
> > > > echo "";
> > >
> > > There's no need to use a meta tag to mimic HTTP headers. PHP
> > > provides the header() function.
> >
> > I have been using that method when I got part-way through some
> > processing that produces output, and hit something that requires a
> > redirect. As I understand it headers are no use to me here.
>
> You're still using a Refresh header. The difference is that you're using
> a meta tag to mimic the header (e.g., http-equiv).

I understand that. I'm sorry, I am obviously not making myself clear...

The php manual page tells me that I can't use header() after any output has 
been sent, thus making it useless in my (obviously badly explained) case 
above.

What happens in my app is: the data processing is in several discrete 
sequential stages, each one echoing status to the user. When it hits 
something that requires additional pre-processing by a different page, I 
use the http-equiv redirect with a 3 second delay so the user can read the 
message telling them what is going on.

Am I correct that header() is no use for this, and is there a "correct" way 
to achieve what I describe? I'm a bit concerned that my ignorance may have 
led me to do this wrong - this is my first php app.

Also, thanks to all the folk suggesting javascript, but this is an internal 
app, and policy has javascript turned off on all browsers.

Thanks again,

Mark

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



Re: [PHP] redirect using php

2006-04-05 Thread Thomas Munz
Function that will work also, when JS is not activate and headers are allready 
send :) :


   
  
  
  
  ';
} else { // no headers sent... much nicer header redirect
header('location: ' . $url);
die();
}
}
?>


on Wednesday 05 April 2006 15:30, Dan Parry wrote:
> If it helps here's the code I use to redirect
>
>  function chrome_redirect($url)
> { // redirect the page
>   if (headers_sent())
>   { // perform JS redirect
>   echo ' language="javascript"><!-- document.location.href=\'' . $url . '\'; //
> -->';
>   } else { // no headers sent... much nicer header redirect
>   header('location: ' . $url);
>   die();
>   }
> }
> ?>
>
> HTH
>
> Dan
>
> -
> Dan Parry
> Senior Developer
> Virtua Webtech Ltd
> http://www.virtuawebtech.co.uk
>
> -Original Message-
> From: Mark Kelly [mailto:[EMAIL PROTECTED]
> Sent: 05 April 2006 14:19
> To: php-general@lists.php.net
> Subject: Re: [PHP] redirect using php
>
> On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
> > Mark Kelly wrote:
> > > You can also use something like:
> > >
> > > echo "";
> >
> > There's no need to use a meta tag to mimic HTTP headers. PHP provides
> > the header() function.
>
> I have been using that method when I got part-way through some processing
> that produces output, and hit something that requires a redirect. As I
> understand it headers are no use to me here.
>
> I'm very much a beginner, so if this is the wrong way to do this, I'd
> appreciate pointers. Thanks for the reply, either way.
>
> Mark
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> __ NOD32 1.1454 (20060321) Information __
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com

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



Re: [PHP] redirect using php

2006-04-05 Thread Chris Shiflett

Mark Kelly wrote:

> > You can also use something like:
> >
> > echo "";
>
> There's no need to use a meta tag to mimic HTTP headers. PHP
> provides the header() function.

I have been using that method when I got part-way through some
processing that produces output, and hit something that requires a
redirect. As I understand it headers are no use to me here.


You're still using a Refresh header. The difference is that you're using 
a meta tag to mimic the header (e.g., http-equiv).


Using meta:



Using header():



Hope that helps.

Chris

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



Re: [PHP] redirect using php

2006-04-05 Thread tedd

At 11:21 PM +0200 4/4/06, Schalk wrote:

Greetings All,

In JSP I have access to a function called sendRedirect() to send a 
user from one page to another, usually after some processing 
completed. Is there a similar function in PHP?


After processing a form and sending the data via email, I need to 
redirect them to another page. I currently use a method of merely 
replacing the form with some 'thank you' text after submitting the 
form, I prefer this but, the client wants me to redirect to another 
page. All help appreciated. Thanks!


--
Kind Regards
Schalk Neethling



Schalk:

Try: http://www.weberdev.com/header

tedd
--

http://sperling.com

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



RE: [PHP] redirect using php

2006-04-05 Thread Dan Parry
If it helps here's the code I use to redirect

';
} else { // no headers sent... much nicer header redirect
header('location: ' . $url);
die();
}
}
?>

HTH

Dan

-
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-Original Message-
From: Mark Kelly [mailto:[EMAIL PROTECTED] 
Sent: 05 April 2006 14:19
To: php-general@lists.php.net
Subject: Re: [PHP] redirect using php

On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
> Mark Kelly wrote:
> > You can also use something like:
> >
> > echo "";
>
> There's no need to use a meta tag to mimic HTTP headers. PHP provides
> the header() function.

I have been using that method when I got part-way through some processing 
that produces output, and hit something that requires a redirect. As I 
understand it headers are no use to me here.

I'm very much a beginner, so if this is the wrong way to do this, I'd 
appreciate pointers. Thanks for the reply, either way.

Mark

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


__ NOD32 1.1454 (20060321) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
On Wednesday 05 April 2006 13:55, Chris Shiflett wrote:
> Mark Kelly wrote:
> > You can also use something like:
> >
> > echo "";
>
> There's no need to use a meta tag to mimic HTTP headers. PHP provides
> the header() function.

I have been using that method when I got part-way through some processing 
that produces output, and hit something that requires a redirect. As I 
understand it headers are no use to me here.

I'm very much a beginner, so if this is the wrong way to do this, I'd 
appreciate pointers. Thanks for the reply, either way.

Mark

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



Re: [PHP] redirect using php

2006-04-05 Thread Chris Shiflett

Mark Kelly wrote:
You can also use something like: 


echo "";


There's no need to use a meta tag to mimic HTTP headers. PHP provides 
the header() function.


Chris

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



Re: [PHP] redirect using php

2006-04-05 Thread Andrei


It works with document.location = '...'; too. I use only this method and 
it worked on all browsers...


Andy

Barry wrote:

Andrei wrote:

   document.location =
'http://where.to.go.com/example.php?param1=';


Wasn't it -> document.location.href ='www.example.com';
o_O ?

Barry


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



Re: [PHP] redirect using php

2006-04-05 Thread Barry

Andrei wrote:

   document.location =
'http://where.to.go.com/example.php?param1=';


Wasn't it -> document.location.href ='www.example.com';
o_O ?

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] redirect using php

2006-04-05 Thread Andrei



Or with javascript:






PS: Sorry Mark...

   Andy

Mark Kelly wrote:

On Tuesday 04 April 2006 22:27, Brady Mitchell wrote:

-Original Message-
In JSP I have access to a function called sendRedirect() to
send a user
from one page to another, usually after some processing completed. Is
there a similar function in PHP?

Take a look at the header() function.
http://php.net/header

To redirect you can use:  header("Location: http://www.example.com/";);


You can also use something like: 


echo "";

depending on your needs.

Mark



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



Re: [PHP] redirect using php

2006-04-05 Thread Mark Kelly
On Tuesday 04 April 2006 22:27, Brady Mitchell wrote:
> > -Original Message-
> > In JSP I have access to a function called sendRedirect() to
> > send a user
> > from one page to another, usually after some processing completed. Is
> > there a similar function in PHP?
>
> Take a look at the header() function.
> http://php.net/header
>
> To redirect you can use:  header("Location: http://www.example.com/";);

You can also use something like: 

echo "";

depending on your needs.

Mark

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



Re: [PHP] redirect using php

2006-04-04 Thread Schalk



Brady Mitchell wrote:

-Original Message-
In JSP I have access to a function called sendRedirect() to 
send a user 
from one page to another, usually after some processing completed. Is 
there a similar function in PHP?



Take a look at the header() function.
http://php.net/header

To redirect you can use:  header("Location: http://www.example.com/";); 


Brady

Thanks everyone, I will give this a go.

--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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



RE: [PHP] redirect using php

2006-04-04 Thread Brady Mitchell
> -Original Message-
> In JSP I have access to a function called sendRedirect() to 
> send a user 
> from one page to another, usually after some processing completed. Is 
> there a similar function in PHP?

Take a look at the header() function.
http://php.net/header

To redirect you can use:  header("Location: http://www.example.com/";); 

Brady

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



RE: [PHP] redirect using php

2006-04-04 Thread Chrome
http://uk.php.net/manual/en/function.header.php

 
---
http://chrome.me.uk
 

-Original Message-
From: Schalk [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 22:21
To: php-general@lists.php.net
Subject: [PHP] redirect using php

Greetings All,

In JSP I have access to a function called sendRedirect() to send a user 
from one page to another, usually after some processing completed. Is 
there a similar function in PHP?

After processing a form and sending the data via email, I need to 
redirect them to another page. I currently use a method of merely 
replacing the form with some 'thank you' text after submitting the form, 
I prefer this but, the client wants me to redirect to another page. All 
help appreciated. Thanks!

-- 
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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


__ NOD32 1.1471 (20060404) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



[PHP] redirect using php

2006-04-04 Thread Schalk

Greetings All,

In JSP I have access to a function called sendRedirect() to send a user 
from one page to another, usually after some processing completed. Is 
there a similar function in PHP?


After processing a form and sending the data via email, I need to 
redirect them to another page. I currently use a method of merely 
replacing the form with some 'thank you' text after submitting the form, 
I prefer this but, the client wants me to redirect to another page. All 
help appreciated. Thanks!


--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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



[PHP] Redirect from /rss.xml to /rss/rss.xml

2006-02-09 Thread Murray @ PlanetThoughtful

Hi All,

This may turn out to be more of an apache question (but I'm hoping there 
are some apache experts on the list as well), but I'm wondering how I 
would go about automatically redirecting requests for /rss.xml to read 
the contents of /rss/rss.xml instead?


Any help appreciated!

Much warmth,

Murray
---
"Lost in thought"
http://www.planetthoughtful.org

"Urban legends, superstitions, ghost
stories and folklore"
http://www.ulblog.org

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



Re: [PHP] redirect based off server string

2005-08-10 Thread Leon Vismer
If you are using apache you can use the redirect module


 Servername www.ces.ncsu.edu
 ServerAlias *
 Redirect permanent / http://www.nc4h.org/
 

--
Leon

On Wednesday 10 August 2005 16:52, Robert Sossomon wrote:
> Anyone have a script or know of a way to check and see what the url is of a
> system and then sending it to another url if it is not right?
>
> I have this problem where if someone is using:
> http://www.ces.ncsu.edu/depts/fourh
> instead of:
> http://www.nc4h.org
>
> to get to my site it is breaking other pieces within it (though there is
> code in place which supposedly stops this from happening, I have found that
> this is not the case)
>
> what I plan on doing is invoking the script on the main page of each man
> sub-directory and the main page so that it should catch the majority of
> folks.
>
> Any suggestions/help would be greatly appreciated!
>
> Robert
>
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 512 BrickHaven Drive Suite 220L, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax:   919/515-7812
> [EMAIL PROTECTED]

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



Re: [PHP] redirect based off server string

2005-08-10 Thread Greg Schnippel
Try doing a pattern match on the server string and then using Header
to redirect them if its coming from the old server:

if (preg_match("/ces.ncsu/i", $_SERVER["HTTP_HOST"])) {
 
 header("Location: http://www.nc4h.org";);

} 

- schnippy


On 8/10/05, Robert Sossomon <[EMAIL PROTECTED]> wrote:
> Anyone have a script or know of a way to check and see what the url is of a
> system and then sending it to another url if it is not right?
> 
> I have this problem where if someone is using:
> http://www.ces.ncsu.edu/depts/fourh
> instead of:
> http://www.nc4h.org
> 
> to get to my site it is breaking other pieces within it (though there is code 
> in
> place which supposedly stops this from happening, I have found that this is 
> not
> the case)
> 
> what I plan on doing is invoking the script on the main page of each man
> sub-directory and the main page so that it should catch the majority of folks.
> 
> Any suggestions/help would be greatly appreciated!
> 
> Robert
> 
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 512 BrickHaven Drive Suite 220L, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax:   919/515-7812
> [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



[PHP] redirect based off server string

2005-08-10 Thread Robert Sossomon
Anyone have a script or know of a way to check and see what the url is of a
system and then sending it to another url if it is not right?

I have this problem where if someone is using:
http://www.ces.ncsu.edu/depts/fourh
instead of:
http://www.nc4h.org

to get to my site it is breaking other pieces within it (though there is code in
place which supposedly stops this from happening, I have found that this is not
the case)

what I plan on doing is invoking the script on the main page of each man
sub-directory and the main page so that it should catch the majority of folks.

Any suggestions/help would be greatly appreciated!

Robert

-- 
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

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



Re: [PHP] Redirect with referer info

2005-07-30 Thread Dotan Cohen
On 7/30/05, Joe Wollard <[EMAIL PROTECTED]> wrote:
> To obtain a certain portion of the referring url you might look at
> parse_url();
> See http://us3.php.net/manual/en/function.parse-url.php
> 
> - or -
> 
> If you want to bounce the user right back to the previous page including get
> variables you could just use this snippet.
> 
>  header("Location: " . $referrer);
> exit;
> ?>


I must have not phased the question well. I have a page on
http://lyricslist.com that links to http://song-lirics.com and it is
very important that the request to http://song-lirics.com has the
referer part of the request intact. There is no id=xxx or whatever,
the server at http://song-lirics.com looks at the $HTTP_REFERER to
grant points. That works great when on http://lyricslist.com I do a
simple lyrics to http://song-lirics.com, but I don't
want to do that. Instead, I link to another page on
http://lyricslist.com so that I can record how many people clicked on
the link, and then I want to redirect to http://song-lirics.com

It's just that with the two redirect methods that I know of (header
and meta), the request to http://song-lirics.com gets there with no
referer information, as if the user typed in the address.

If you want to see it, click:
http://song-lirics.com/sl/goto.php/4
You will be redirected to http://dotancohen.com
Look at the source code, in the first few lines you will see:


No referer! Try clicking around http://dotancohen.com and look at the
source code: they all have referers!

Dotan Cohen
http://ie-only.com

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



Re: [PHP] Redirect with referer info

2005-07-30 Thread Joe Wollard
To obtain a certain portion of the referring url you might look at  
parse_url();

See http://us3.php.net/manual/en/function.parse-url.php

- or -

If you want to bounce the user right back to the previous page  
including get variables you could just use this snippet.





On Jul 30, 2005, at 9:36 AM, Dotan Cohen wrote:


Hi list,
I need to redirerect a page, and send the referer information along
with the redirect. I have tried:
header("Location: $url");
and
print"";

Both of them redirect as expected, but the browser (Firefox and Opera)
do not send referer information along with the request. As this is for
link affiliates, I need that referer info sent with the request. How
to do that? Thanks.

Dotan Cohen
Song Lirics http://song-lirics.com/sl/artists.php/b Song Lirics

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






Re: [PHP] Redirect with referer info

2005-07-30 Thread Matt Darby

Dotan Cohen wrote:


Hi list,
I need to redirerect a page, and send the referer information along
with the redirect. I have tried:
header("Location: $url");
and
print"";

Both of them redirect as expected, but the browser (Firefox and Opera)
do not send referer information along with the request. As this is for
link affiliates, I need that referer info sent with the request. How
to do that? Thanks.

Dotan Cohen
Song Lirics http://song-lirics.com/sl/artists.php/b Song Lirics

 



URL parameters.

$url="www.somesite.org?id=asdf&referrer=2345";
header("Location: $url");

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



  1   2   3   4   >