Using header()?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce A. Julseth

    Using header()?

    I have a Main.php file the gets data from the user. Main.php then loads
    Verify.php. Based on the input, Verify.php will load a page. An extract of
    Verify.php looks like:

    if($IN = "A") {
    header("Locatio n: A.php");
    exit;
    } else {
    header("Locatio n: B.php");
    exit;
    }

    Now, my problem. I want to pass "$IN" to the routines I load with header().

    How do I do this? Using $_GET is not an acceptable way as this data is
    sensative.
    Is there some other way to load a page other then header()?

    Thanks...

    Bruce A. Julseth




  • Paulus Magnus

    #2
    Re: Using header()?

    "Bruce A. Julseth" <bruceaj@attglo bal.net> wrote in message
    news:3f8544a4_4 @news1.prserv.n et...[color=blue]
    > I have a Main.php file the gets data from the user. Main.php then loads
    > Verify.php. Based on the input, Verify.php will load a page. An extract of
    > Verify.php looks like:
    >
    > if($IN = "A") {
    > header("Locatio n: A.php");
    > exit;
    > } else {
    > header("Locatio n: B.php");
    > exit;
    > }
    >
    > Now, my problem. I want to pass "$IN" to the routines I load with[/color]
    header().[color=blue]
    >
    > How do I do this? Using $_GET is not an acceptable way as this data is
    > sensative.
    > Is there some other way to load a page other then header()?[/color]

    Do you have to process this information in a different page? Most people use
    different pages when there is no need to, I just keep cycling around the
    same page but offering different information within a switch statement, i.e.

    switch ($IN) {
    case "A" :
    //show Page A
    break;
    case "B" :
    //show Page B
    break;
    }

    This means you don't have to send information to other pages. Using
    templates in your design can greatly help in these situations when you don't
    have to worry about the HTML getting in the way of your algorithm.

    Paulus


    Comment

    • David Gillen

      #3
      Re: Using header()?

      An noise sounding like Bruce A. Julseth said:[color=blue]
      > I have a Main.php file the gets data from the user. Main.php then loads
      > Verify.php. Based on the input, Verify.php will load a page. An extract of
      > Verify.php looks like:
      >
      > if($IN = "A") {
      > header("Locatio n: A.php");
      > exit;
      > } else {
      > header("Locatio n: B.php");
      > exit;
      > }
      >
      > Now, my problem. I want to pass "$IN" to the routines I load with header().
      >
      > How do I do this? Using $_GET is not an acceptable way as this data is
      > sensative.
      > Is there some other way to load a page other then header()?
      >[/color]
      Session vars??

      db
      --

      I'm a dead man, and buggered to boot!

      Comment

      • David Mackenzie

        #4
        Re: Using header()?

        On Thu, 9 Oct 2003 07:16:12 -0400, "Bruce A. Julseth"
        <bruceaj@attglo bal.net> wrote:
        [color=blue]
        >I have a Main.php file the gets data from the user. Main.php then loads
        >Verify.php. Based on the input, Verify.php will load a page. An extract of
        >Verify.php looks like:
        >
        > if($IN = "A") {
        > header("Locatio n: A.php");
        > exit;
        > } else {
        > header("Locatio n: B.php");
        > exit;
        > }
        >
        >Now, my problem. I want to pass "$IN" to the routines I load with header().
        >
        >How do I do this? Using $_GET is not an acceptable way as this data is
        >sensative.
        >Is there some other way to load a page other then header()?[/color]

        How about:

        if($IN == "A") {
        include("A.php" );
        exit;
        } else {
        include("B.php" );
        exit;
        }

        I've corrected your = to ==

        Be careful if verify.php makes modifications to a database as the user
        will be able to refresh the page to make the modifications again.

        I normally have my page with the form POST to itself. The POST vars
        are checked and processed at the head of the page and then redirect to
        a success page. If anything fails validation, I simply carry on and
        re-display the form with erroneous fields suitably indicated.

        --
        David ( @priz.co.uk )
        The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
        The Tarbrax Chronicle: http://www.tarbraxchronicle.com/

        Comment

        • Bruce A. Julseth

          #5
          Re: Using header()?

          Session Vars?? Don't know what they are (I'm a "newbie")? Can you give an
          example, i.e.. what is the functions I would use to set and retrieve so I
          can read about them.

          Thanks...

          "David Gillen" <Belial@RedBric k.DCU.IE> wrote in message
          news:slrnboaice .2aj.Belial@car bon.redbrick.dc u.ie...[color=blue]
          > An noise sounding like Bruce A. Julseth said:[color=green]
          > > I have a Main.php file the gets data from the user. Main.php then loads
          > > Verify.php. Based on the input, Verify.php will load a page. An extract[/color][/color]
          of[color=blue][color=green]
          > > Verify.php looks like:
          > >
          > > if($IN = "A") {
          > > header("Locatio n: A.php");
          > > exit;
          > > } else {
          > > header("Locatio n: B.php");
          > > exit;
          > > }
          > >
          > > Now, my problem. I want to pass "$IN" to the routines I load with[/color][/color]
          header().[color=blue][color=green]
          > >
          > > How do I do this? Using $_GET is not an acceptable way as this data is
          > > sensative.
          > > Is there some other way to load a page other then header()?
          > >[/color]
          > Session vars??
          >
          > db
          > --
          >
          > I'm a dead man, and buggered to boot!
          >[/color]


          Comment

          • Bruce A. Julseth

            #6
            Re: Using header()?

            I was a little too simple in my example because (1) I have more then two
            values that I want to pass, and (2) B.php uses the values.

            Bruce

            "Paulus Magnus" <paulus.magnus@ loves-spam.com> wrote in message
            news:bm3h94$4hr $1@sparta.btint ernet.com...[color=blue]
            > "Bruce A. Julseth" <bruceaj@attglo bal.net> wrote in message
            > news:3f8544a4_4 @news1.prserv.n et...[color=green]
            > > I have a Main.php file the gets data from the user. Main.php then loads
            > > Verify.php. Based on the input, Verify.php will load a page. An extract[/color][/color]
            of[color=blue][color=green]
            > > Verify.php looks like:
            > >
            > > if($IN = "A") {
            > > header("Locatio n: A.php");
            > > exit;
            > > } else {
            > > header("Locatio n: B.php");
            > > exit;
            > > }
            > >
            > > Now, my problem. I want to pass "$IN" to the routines I load with[/color]
            > header().[color=green]
            > >
            > > How do I do this? Using $_GET is not an acceptable way as this data is
            > > sensative.
            > > Is there some other way to load a page other then header()?[/color]
            >
            > Do you have to process this information in a different page? Most people[/color]
            use[color=blue]
            > different pages when there is no need to, I just keep cycling around the
            > same page but offering different information within a switch statement,[/color]
            i.e.[color=blue]
            >
            > switch ($IN) {
            > case "A" :
            > //show Page A
            > break;
            > case "B" :
            > //show Page B
            > break;
            > }
            >
            > This means you don't have to send information to other pages. Using
            > templates in your design can greatly help in these situations when you[/color]
            don't[color=blue]
            > have to worry about the HTML getting in the way of your algorithm.
            >
            > Paulus
            >
            >[/color]


            Comment

            • Bruce A. Julseth

              #7
              Re: Using header()?

              Thanks for the == change. That was a typo in the post..

              I retrieve from a database but don't update.

              You're suggested method of checking in the front of the routine was my
              preferred way, but I had some problem with that so went to standalone
              verify.php module approach. Don't recall the problem.

              Is there anyother way to load a new page from with code other then
              "header()"?

              Thanks....

              Bruce


              "David Mackenzie" <me@privacy.net > wrote in message
              news:lqkaovs2r4 va1dss8ta5ev4qi 4qc90n8vb@4ax.c om...[color=blue]
              > On Thu, 9 Oct 2003 07:16:12 -0400, "Bruce A. Julseth"
              > <bruceaj@attglo bal.net> wrote:
              >[color=green]
              > >I have a Main.php file the gets data from the user. Main.php then loads
              > >Verify.php. Based on the input, Verify.php will load a page. An extract[/color][/color]
              of[color=blue][color=green]
              > >Verify.php looks like:
              > >
              > > if($IN = "A") {
              > > header("Locatio n: A.php");
              > > exit;
              > > } else {
              > > header("Locatio n: B.php");
              > > exit;
              > > }
              > >
              > >Now, my problem. I want to pass "$IN" to the routines I load with[/color][/color]
              header().[color=blue][color=green]
              > >
              > >How do I do this? Using $_GET is not an acceptable way as this data is
              > >sensative.
              > >Is there some other way to load a page other then header()?[/color]
              >
              > How about:
              >
              > if($IN == "A") {
              > include("A.php" );
              > exit;
              > } else {
              > include("B.php" );
              > exit;
              > }
              >
              > I've corrected your = to ==
              >
              > Be careful if verify.php makes modifications to a database as the user
              > will be able to refresh the page to make the modifications again.
              >
              > I normally have my page with the form POST to itself. The POST vars
              > are checked and processed at the head of the page and then redirect to
              > a success page. If anything fails validation, I simply carry on and
              > re-display the form with erroneous fields suitably indicated.
              >
              > --
              > David ( @priz.co.uk )
              > The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
              > The Tarbrax Chronicle: http://www.tarbraxchronicle.com/[/color]


              Comment

              • David Gillen

                #8
                Re: Using header()?

                An noise sounding like Bruce A. Julseth said:[color=blue]
                > Session Vars?? Don't know what they are (I'm a "newbie")? Can you give an
                > example, i.e.. what is the functions I would use to set and retrieve so I
                > can read about them.
                >[/color]
                They are php's interface to what are essentially cookies
                Start with http://ie.php.net/session_start
                and work from there. Very useful and fairly widely used.

                db
                --

                I'm a dead man, and buggered to boot!

                Comment

                Working...