On Thu, 5 Aug 2004 10:35:47 -0500 (CDT), Bing Du <[EMAIL PROTECTED]> wrote:
> I really appreciate everyone who responded taking your valuable time
> looking into my problem.
> 
> Now back to my problem.  Changing the condition to "if($_SERVER['HTTPS']
> != 'on')" did not make any difference unfortunately. So the result was
> still the URL in the Address box of the browser changed to
> https://computing.eng.iastate.edu/mambo/index.php?option=content&task=view&id=159&Itemid=162
> fine.  But instead of showing the page that https address should point to,
> 'You are in HTTPS mode' was displayed as the else clause specified.
> 

So what's the answer? REMOVE THE ELSE. If you want it to run the code
following the redirect code in the same script if it's not using those
request params or in https mode, do:

if ($option == 'content' and $task == 'view' and $id == 159 and
$Itemid == 162) {
 if(isset($_SERVER['HTTPS'])) {
   header('Location: https://computing.eng.iastate.edu/mambo/index.php'.
     '?option=content&task=view&id=159&Itemid=162');
 }
}

As simple as that. If that's not the answer, you're asking the wrong question.

> Bing
> 
> 
> 
> > On Wed, 4 Aug 2004 17:02:30 -0500 (CDT), Bing Du <[EMAIL PROTECTED]> wrote:
> >> Ok, now I'm confused and cannot understand the result of the following
> >> code snippet.  After click the link that I want to redirect, the URL in
> >> the Address box of the browser changed from http to https fine (that's
> >> what I expected).  But 'hello my friend' was also displayed.  How come?
> >>
> >> ============> if ($option == 'content' and $task == 'view' and $id ==
> >> 159 and $Itemid => 162)
> >> {
> >>    session_write_close();
> >>
> >>    if (!isset($_SERVER['HTTPS']))
> >>    {
> >>     header("Location:
> >> https://computing.eng.iastate.edu/mambo/index.php?option=content&task=view&id=159&Itemid=162";);
> >>    } else {
> >>              echo 'hello my friend';
> >>           }
> >> =============if ($option == 'content' and $task == 'view' and $id == 159
> >> and
> > $Itemid == 162) {
> >   if($_SERVER['HTTPS'] != 'on') {
> >     header('Location: https://computing.eng.iastate.edu/mambo/index.php'.
> >       '?option=content&task=view&id=159&Itemid=162');
> >   } else {
> >     echo 'You are in HTTPS mode.';
> >     //do stuff
> >   }
> > }
> >
> >>
> >> Bing
> >>
> >>
> >> > On Tue, 3 Aug 2004 15:34:27 -0500 (CDT), Bing Du <[EMAIL PROTECTED]>
> >> wrote:
> >> >> The latest message I got was 'Redirection limit for this URL
> >> exceeded.
> >> >> Unable to load the requested page.This may be caused by cookies that
> >> are
> >> >> blocked.'.
> >> >>
> >> >
> >> > Your page is redirecting you over and over again. Your problem is that
> >> > you're not checking for https before you redirect! If the user comes
> >> > in with the https URL, you're still redirecting them. Try checking the
> >> > value of $_SERVER['HTTPS'].
> >> >
> >> >> Bing
> >> >>
> >> >>
> >> >>
> >> >> > On Tuesday 03 August 2004 15:41, Bing Du offered up the following
> >> >> tid-bit
> >> >> > of
> >> >> > information :
> >> >> >> I've been struggling with this redirect thing for a while but
> >> still
> >> >> >> cannot get it work.  I'm desperately needing help, please.
> >> >> >>
> >> >> >> What I want to do is redirect
> >> >> >> http://computing.eng.iastate.edu/mambo/index.php?option=content&task=view
> >> >> >>&id=159&Itemid=162 to
> >> >> >> https://computing.eng.iastate.edu/mambo/index.php?option=content&task=vie
> >> >> >>w&id=159&Itemid=162. The only difference between the above two URLs
> >> is
> >> >> >> one
> >> >> >> is http and the other is https.
> >> >> >>
> >> >> >> =========> if ($option == 'content' and $task == 'view' and $id =>
> >> >> 159
> >> >> >> and $Itemid
> >> >> >> == 162)
> >> >> >> {
> >> >> >>   session_write_close();
> >> >> >>   header("Location:
> >> >> >> https://computing.eng.iastate.edu/mambo/index.php?option=content&task=vie
> >> >> >>w&id=159&Itemid=162"); exit;
> >> >> >> }
> >> >> >> =========>
> >> >> >> Am I doing anything wrong with the Location header?
> >> >> >
> >> >> > What's the error?  Is it just not forwarding?  Headers already
> >> sent?
> >> >> >
> >> >> > --
> >> >> > John C. Nichel
> >> >> > ÜberGeek
> >> >> > KegWorks.com
> >> >> > 716.856.9675
> >> >> > [EMAIL PROTECTED]
> >> >> >
> >> >> >
> >> >>
> >> >
> >> > --
> >> > DB_DataObject_FormBuilder - The database at your fingertips
> >> > http://pear.php.net/package/DB_DataObject_FormBuilder
> >> >
> >> > paperCrane --Justin Patrin--
> >> >
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >
> >
> > --
> > DB_DataObject_FormBuilder - The database at your fingertips
> > http://pear.php.net/package/DB_DataObject_FormBuilder
> >
> > paperCrane --Justin Patrin--
> >
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to