Re: Problem using META tag refresh for page re-directs
| From: | Chris Lee | Date: | Thu, 22 Feb 2001 22:43:25 +0000 |
| Subject: | Re: Problem using META tag refresh for page re-directs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41246@lists.php.net to get a copy of this message | ||
yes I know what your saying.
trans-sid will not work when the url is absolute ie.
<form method=post action='http://$SERVER_NAME/index.php'>
or
<a href='http://$SERVER_NAME/index.php'>index</a>
or
header("Location: http://$SERVER_NAME/index.php");
header redirects *require* absolute url's so your going to have to add the
phpsessid yourself, ie.
<?php
$SID = "PHPSESSID=$PHPSESSID";
header("Location: http://$SERVER_NAME/index.php?$SID");
?>
rember "" not '' seems people get them mixed up alot. '' doesnt parse
the
string.
I use this method to transer valid sessions accros multiple domain names on
the same box. sessions will not follow absolte urls and cookies are only
vaild on a per-domain name basis. use sessions and your can force a session
across multiple domain names. ie. our secure server is on a differnet domain
name then the regular sites. we do this to get a cheaper deal on our
certificate, all our sites use one domain name for secure info.
I would recomment agains php.net's sujestion os using SID ie.
echo "<a href='http://$SERVER_NAME/index.php?'".
SID ."'>index</a>";
SID is only set if the a cookie is NOT set. oi. thank god $PHPSESSID is
allways set :)
another note too though is try and limit the amount of header re-redirects
you use, search engines will not index pages that follow header redirects.
spam thing or something.
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
lee@mediawaveonline.com
""Johnson, Kirk"" <kjohnson@zootweb.com> wrote in message
news:01A4B59FD1EBD311838100A0C98BE0D9AD576B@chef.zootweb.com...
> Thanks, Chris. This touches on another problem. Have you tried this with
> session cookies disabled in your browser? Can you pass the session ID
using
> the header function? I can't seem to, but I *can* pass it using SID
appended
> to the URL in the META tag. This is one reason I wanted to stay with the
> META refresh method, if possible, so the site still works for people with
> cookies disabled.
>
> Thanks, again, I will play with this.
>
> Kirk
>
> -----------------
> Chris Lee replied:
>
> if you have output buffering on in php.ini
>
> output_bufffering = on
>
> cobine this with
>
> <?php
> header("Location:
> http://$SERVER_NAME/index.php");
> exit();
> ?>
>
> and youve got a great cobination, zero html will be sent to the browser,
> just the header, the browser will refresh for you. try it, works better
then
> meta tags.
>
>
> ""Johnson, Kirk"" <kjohnson@zootweb.com> wrote in message
> news:01A4B59FD1EBD311838100A0C98BE0D9AD5769@chef.zootweb.com...
> > I have been using the code below to do my page redirects for a year and
a
> > half with good results. Recently, some users have reported to me that
the
> > actual code is being partially displayed to the screen, and the
re-direct
> is
> > not occurring. It is as if the server stops serving the page before it
is
> > complete. Sometimes the problem can be corrected by the user just doing
a
> > manual refresh in their browser. Is anyone else that uses META tag
> > re-directs having this problem? Anyone know what the solution might be?
> >
> >
> > echo("<HTML><HEAD><META HTTP-EQUIV=\"refresh\"
> CONTENT=\"$delay;url=$url\"><
> > /HEAD><BODY BGCOLOR=#ffffff>$message</BODY></HTML>");
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>