how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    I have a web page where certain pages have to be opened in a certain order
    and should only be available when the user openes them in HTTPS.

    They are all forms and the form action sends you to the next https:// page
    but you can also take the S out of https:// and it opens also. That's what
    I need to avoid as well as making certain they got to a certain page FROM a
    certain page.

    When I try:
    if (isset($_SERVER['HTTPS']!='on'))
    it crashes and is not even listed on php.net as a valid variable.

    Many thanks


    NotGiven Guest

  2. Similar Questions and Discussions

    1. MDB Opened Excludively
      I get the error: Error Executing Database Query: Cannot start your application. The workgoup information file is missing or opened exclusively by...
    2. Services not getting opened
      hi, i am facing a strange problem in my server on which windows2k3 is running along with exchange 2003 server and SQL Server 2000 with Service...
    3. to ensure that you are viewing the latest webpage
      Hi, I have just made my own company website www.intelligentfinance.com.au using publisher and I update (fiddle around) with the contect each...
    4. site can't be opened by others
      XP, Pub 200 I upload with ft_ws. Have "exported as web page" and saved as HTM. Setup to be compatible with lowest version of windows. I have no...
    5. [DIR]Opened movie
      Hi!! I´m a new user of Director 8.5. I´m making an aplication which shows several photos and texts following several options. I´m programming the...
  3. #2

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?


    On 19-Nov-2003, "NotGiven" <noname@nonegiven.net> wrote:
    > I have a web page where certain pages have to be opened in a certain order
    > and should only be available when the user openes them in HTTPS.
    >
    > They are all forms and the form action sends you to the next https:// page
    > but you can also take the S out of https:// and it opens also. That's
    > what
    > I need to avoid as well as making certain they got to a certain page FROM
    > a
    > certain page.
    >
    > When I try:
    > if (isset($_SERVER['HTTPS']!='on'))
    > it crashes and is not even listed on php.net as a valid variable.
    Either hide something in a field on the page that you check in the next page
    (if your hidden field isn't in the $_POST array you know the user didn't
    come from that page) or use sessions.

    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    tom (at) creative (dash) light (dot) com
    do NOT send email to [email]jamesbutler@willglen.net[/email] (it's reserved for spammers)
    Tom Thackrey Guest

  4. #3

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    Tom Thackrey wrote:
    >
    > On 19-Nov-2003, "NotGiven" <noname@nonegiven.net> wrote:
    >
    >> I have a web page where certain pages have to be opened in a certain
    >> order and should only be available when the user openes them in HTTPS.
    >>
    >> They are all forms and the form action sends you to the next https://
    >> page
    >> but you can also take the S out of https:// and it opens also. That's
    >> what
    >> I need to avoid as well as making certain they got to a certain page FROM
    >> a
    >> certain page.
    >>
    >> When I try:
    >> if (isset($_SERVER['HTTPS']!='on'))
    >> it crashes and is not even listed on php.net as a valid variable.
    >
    > Either hide something in a field on the page that you check in the next
    > page (if your hidden field isn't in the $_POST array you know the user
    > didn't come from that page) or use sessions.
    >
    You could do it with sessions.

    on the first page: (start the sessions and all that good stuff)
    $_SESSION['pageone'] = true

    on page two:
    if($_SESSION['pageone'] == true){
    $_SESSION['pagetwo'] = true;
    pagetwostuff();
    }
    else{
    echo "Please visit page one first!";
    echo "<a href="pageone">page one</a>";
    }

    continue if you have page 3, etc...
    if($_SESSION['pageone'] == true && $_SESSION['pagetwo'] == true)

    if you have lots of pages in sequence, you may want to figure out a way to
    do this with an array instead of individual arrays. ie:
    pages[0] == true; // visited page one
    pages[1] == true; // visited page two
    pages[2] == false; // didnt visit page three/on page 3 perhaps?
    pages[3] == false; // didnt visit page four

    Good Luck!


    -Eric Kincl
    Eric Kincl Guest

  5. #4

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    You could also look into the referer and see whether it came from
    [url]https://yourdomain.com/page1.php[/url] or not, etc etc



    "Tom Thackrey" <use.signature@nospam.com> wrote in message
    news:vuOub.32665$Hl4.15862@newssvr25.news.prodigy. com...
    >
    > On 19-Nov-2003, "NotGiven" <noname@nonegiven.net> wrote:
    >
    > > I have a web page where certain pages have to be opened in a certain
    order
    > > and should only be available when the user openes them in HTTPS.
    > >
    > > They are all forms and the form action sends you to the next https://
    page
    > > but you can also take the S out of https:// and it opens also. That's
    > > what
    > > I need to avoid as well as making certain they got to a certain page
    FROM
    > > a
    > > certain page.
    > >
    > > When I try:
    > > if (isset($_SERVER['HTTPS']!='on'))
    > > it crashes and is not even listed on php.net as a valid variable.
    >
    > Either hide something in a field on the page that you check in the next
    page
    > (if your hidden field isn't in the $_POST array you know the user didn't
    > come from that page) or use sessions.
    >
    > --
    > Tom Thackrey
    > [url]www.creative-light.com[/url]
    > tom (at) creative (dash) light (dot) com
    > do NOT send email to [email]jamesbutler@willglen.net[/email] (it's reserved for spammers)

    Thi Nguyen Guest

  6. #5

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    On Wed, 19 Nov 2003 18:01:41 -0800, Thi Nguyen wrote:
    > You could also look into the referer and see whether it came from
    > [url]https://yourdomain.com/page1.php[/url] or not, etc etc
    >
    >
    >
    > "Tom Thackrey" <use.signature@nospam.com> wrote in message
    > news:vuOub.32665$Hl4.15862@newssvr25.news.prodigy. com...
    >>
    >> On 19-Nov-2003, "NotGiven" <noname@nonegiven.net> wrote:
    >>
    >>> I have a web page where certain pages have to be opened in a certain
    > order
    >>> and should only be available when the user openes them in HTTPS.
    >>> (snip)
    Watch that, though... referers are sent by the browser, and can be easily
    faked or omitted.
    --
    -- Rudy Fleminger
    -- [email]sp@mmers.and.evil.ones.will.bow-down-to.us[/email]
    (put "Hey!" in the Subject line for priority processing!)
    -- [url]http://www.pixelsaredead.com[/url]
    FLEB Guest

  7. #6

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    > They are all forms and the form action sends you to the next https:// page
    > but you can also take the S out of https:// and it opens also. That's
    what
    > I need to avoid as well as making certain they got to a certain page FROM
    a
    > certain page.
    >
    > When I try:
    > if (isset($_SERVER['HTTPS']!='on'))
    > it crashes and is not even listed on php.net as a valid variable.
    Try this instead:

    if (isset($_SERVER['HTTPS'])!='on')

    Bye,
    Jonathan


    Jonathan Guest

  8. #7

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    That caused page failure. I can't find anything anywhere that talks about
    HTTPS being a parameter in $_SERVER

    Thanks.

    "Jonathan" <jonathan@tricolon.com> wrote in message
    news:3fbfc77e$0$1494$e4fe514c@news.xs4all.nl...
    > > They are all forms and the form action sends you to the next https://
    page
    > > but you can also take the S out of https:// and it opens also. That's
    > what
    > > I need to avoid as well as making certain they got to a certain page
    FROM
    > a
    > > certain page.
    > >
    > > When I try:
    > > if (isset($_SERVER['HTTPS']!='on'))
    > > it crashes and is not even listed on php.net as a valid variable.
    >
    > Try this instead:
    >
    > if (isset($_SERVER['HTTPS'])!='on')
    >
    > Bye,
    > Jonathan
    >
    >

    NotGiven Guest

  9. #8

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    > That caused page failure. I can't find anything anywhere that talks about
    > HTTPS being a parameter in $_SERVER
    >
    > Thanks.
    >
    > > if (isset($_SERVER['HTTPS'])!='on')
    Sorry, my mistake ;) If a var is not set then it will definately not contain
    the value 'on'. So you can just use this:

    if ($_SERVER['HTTPS']!='on')

    Bye,
    Jonathan


    Jonathan Guest

  10. #9

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?


    "Jonathan" <jonathan@tricolon.com> schreef in bericht
    news:3fc09484$0$1505$e4fe514c@news.xs4all.nl...
    >
    > Sorry, my mistake ;) If a var is not set then it will definately not
    contain
    > the value 'on'. So you can just use this:
    >
    > if ($_SERVER['HTTPS']!='on')
    >
    This line will throw a warning when the key doesn't exist with the proper
    error reporting level. Therefore, it's saver, and also good practice, to use
    isset to check if the variable has been set:

    if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='on' )


    JW



    Janwillem Borleffs Guest

  11. #10

    Default Re: how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

    "Janwillem Borleffs" <jw@jwscripts.com> wrote in message news:<3fc0a241$0$202$1b62eedf@news.euronet.nl>...
    > "Jonathan" <jonathan@tricolon.com> schreef in bericht
    > news:3fc09484$0$1505$e4fe514c@news.xs4all.nl...
    > >
    > > Sorry, my mistake ;) If a var is not set then it will definately not
    > contain
    > > the value 'on'. So you can just use this:
    > >
    > > if ($_SERVER['HTTPS']!='on')
    > >
    >
    > This line will throw a warning when the key doesn't exist with the proper
    > error reporting level. Therefore, it's saver, and also good practice, to use
    > isset to check if the variable has been set:
    >
    > if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='on' )
    AFAIK, 'on' is not guaranteed. So,
    $is_https = (!empty($_SERVER['HTTPS'])); is the correct check (IMHO)

    ---
    "Dying is an art, like everything else"---Sylvia Plath
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139