rewrite the url

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    rewrite the url

    I'm using a get variable to enable a guest login via a hyperlink. Once
    I've used it, is there a simple way of rewriting the url to remove ther
    get details?

    tia,

    Steve
  • John Victor

    #2
    Re: rewrite the url

    I'm assuming your using a form to load the page from which you extract the
    get variable. Instead of using get, try post. Using post in your form will
    prevent the variable information from appearing in the URL.
    example:
    <form action="loginpa ge.php" method="post"> rather than <form
    action="loginpa ge.php" method="get">

    You'll also need to extract the information from the URL as a post variable
    rather than as a get variable.
    example:
    If your using $_GET[variable], you'll need to change it to $_POST[variable]
    or
    if your using $HTTP_GET_VARS, you'll need to change it to $HTTP_POST_VARS .


    "Steve" <ThisOne@Aint.v alid> wrote in message
    news:cgespl$ndd $1@lust.ihug.co .nz...[color=blue]
    > I'm using a get variable to enable a guest login via a hyperlink. Once
    > I've used it, is there a simple way of rewriting the url to remove ther
    > get details?
    >
    > tia,
    >
    > Steve[/color]


    Comment

    • Steve

      #3
      Re: rewrite the url

      John Victor wrote:[color=blue]
      > I'm assuming your using a form to load the page from which you extract the
      > get variable. Instead of using get, try post. Using post in your form will
      > prevent the variable information from appearing in the URL.
      > example:
      > <form action="loginpa ge.php" method="post"> rather than <form
      > action="loginpa ge.php" method="get">
      >
      > You'll also need to extract the information from the URL as a post variable
      > rather than as a get variable.
      > example:
      > If your using $_GET[variable], you'll need to change it to $_POST[variable]
      > or
      > if your using $HTTP_GET_VARS, you'll need to change it to $HTTP_POST_VARS .
      >
      >
      > "Steve" <ThisOne@Aint.v alid> wrote in message
      > news:cgespl$ndd $1@lust.ihug.co .nz...
      >[color=green]
      >>I'm using a get variable to enable a guest login via a hyperlink. Once
      >>I've used it, is there a simple way of rewriting the url to remove ther
      >>get details?
      >>
      >>tia,
      >>
      >>Steve[/color]
      >
      >
      >[/color]
      No, I'm using a hyperlink... <a href="index.php ?Guest=1">Trial </a> and
      testing them at the other end.

      Steve

      Comment

      • CJ Llewellyn

        #4
        Re: rewrite the url

        "Steve" <ThisOne@Aint.v alid> wrote in message
        news:cgf4el$uk5 $1@lust.ihug.co .nz...[color=blue]
        > John Victor wrote:[color=green]
        > > I'm assuming your using a form to load the page from which you extract[/color][/color]
        the[color=blue][color=green]
        > > get variable. Instead of using get, try post. Using post in your form[/color][/color]
        will[color=blue][color=green]
        > > prevent the variable information from appearing in the URL.
        > > example:
        > > <form action="loginpa ge.php" method="post"> rather than <form
        > > action="loginpa ge.php" method="get">
        > >
        > > You'll also need to extract the information from the URL as a post[/color][/color]
        variable[color=blue][color=green]
        > > rather than as a get variable.
        > > example:
        > > If your using $_GET[variable], you'll need to change it to[/color][/color]
        $_POST[variable][color=blue][color=green]
        > > or
        > > if your using $HTTP_GET_VARS, you'll need to change it to[/color][/color]
        $HTTP_POST_VARS .[color=blue][color=green]
        > >
        > >
        > > "Steve" <ThisOne@Aint.v alid> wrote in message
        > > news:cgespl$ndd $1@lust.ihug.co .nz...
        > >[color=darkred]
        > >>I'm using a get variable to enable a guest login via a hyperlink. Once
        > >>I've used it, is there a simple way of rewriting the url to remove ther
        > >>get details?
        > >>
        > >>tia,
        > >>
        > >>Steve[/color]
        > >
        > >
        > >[/color]
        > No, I'm using a hyperlink... <a href="index.php ?Guest=1">Trial </a> and
        > testing them at the other end.[/color]

        use

        <a href="setguest. php?guest=1">Tr ial</a>

        in setguest.php store the value of guess into a cookie or a session
        variable, and then use header('locatio n: index.php');



        Comment

        • Steve

          #5
          Re: rewrite the url

          CJ Llewellyn wrote:[color=blue]
          > "Steve" <ThisOne@Aint.v alid> wrote in message
          > news:cgf4el$uk5 $1@lust.ihug.co .nz...
          >[color=green]
          >>John Victor wrote:
          >>[color=darkred]
          >>>I'm assuming your using a form to load the page from which you extract[/color][/color]
          >
          > the
          >[color=green][color=darkred]
          >>>get variable. Instead of using get, try post. Using post in your form[/color][/color]
          >
          > will
          >[color=green][color=darkred]
          >>>prevent the variable information from appearing in the URL.
          >>>example:
          >>><form action="loginpa ge.php" method="post"> rather than <form
          >>>action="logi npage.php" method="get">
          >>>
          >>>You'll also need to extract the information from the URL as a post[/color][/color]
          >
          > variable
          >[color=green][color=darkred]
          >>>rather than as a get variable.
          >>>example:
          >>>If your using $_GET[variable], you'll need to change it to[/color][/color]
          >
          > $_POST[variable]
          >[color=green][color=darkred]
          >>>or
          >>>if your using $HTTP_GET_VARS, you'll need to change it to[/color][/color]
          >
          > $HTTP_POST_VARS .
          >[color=green][color=darkred]
          >>>
          >>>"Steve" <ThisOne@Aint.v alid> wrote in message
          >>>news:cgespl$ ndd$1@lust.ihug .co.nz...
          >>>
          >>>
          >>>>I'm using a get variable to enable a guest login via a hyperlink. Once
          >>>>I've used it, is there a simple way of rewriting the url to remove ther
          >>>>get details?
          >>>>
          >>>>tia,
          >>>>
          >>>>Steve
          >>>
          >>>
          >>>[/color]
          >>No, I'm using a hyperlink... <a href="index.php ?Guest=1">Trial </a> and
          >>testing them at the other end.[/color]
          >
          >
          > use
          >
          > <a href="setguest. php?guest=1">Tr ial</a>
          >
          > in setguest.php store the value of guess into a cookie or a session
          > variable, and then use header('locatio n: index.php');
          >
          >
          >[/color]
          Like it! I may rewrite everything so that all config is loaded into
          session vars and then index.pgp is called.

          Nice, simple and elegant.

          Cheers,

          Steve

          Comment

          • Brad Kent

            #6
            Re: rewrite the url

            Well, after "logging them in as guest" (saving a session, or whatever
            you're doing), if you want the address bar to change you could have
            the login-script redirect to a new location.
            header('Locatio n: http://...somewhere.../');

            Steve <ThisOne@Aint.v alid> wrote in message news:<cgf4el$uk 5$1@lust.ihug.c o.nz>...[color=blue]
            > John Victor wrote:[color=green]
            > > I'm assuming your using a form to load the page from which you extract the
            > > get variable. Instead of using get, try post. Using post in your form will
            > > prevent the variable information from appearing in the URL.
            > > example:
            > > <form action="loginpa ge.php" method="post"> rather than <form
            > > action="loginpa ge.php" method="get">
            > >
            > > You'll also need to extract the information from the URL as a post variable
            > > rather than as a get variable.
            > > example:
            > > If your using $_GET[variable], you'll need to change it to $_POST[variable]
            > > or
            > > if your using $HTTP_GET_VARS, you'll need to change it to $HTTP_POST_VARS .
            > >
            > >
            > > "Steve" <ThisOne@Aint.v alid> wrote in message
            > > news:cgespl$ndd $1@lust.ihug.co .nz...
            > >[color=darkred]
            > >>I'm using a get variable to enable a guest login via a hyperlink. Once
            > >>I've used it, is there a simple way of rewriting the url to remove ther
            > >>get details?
            > >>
            > >>tia,
            > >>
            > >>Steve[/color]
            > >
            > >
            > >[/color]
            > No, I'm using a hyperlink... <a href="index.php ?Guest=1">Trial </a> and
            > testing them at the other end.
            >
            > Steve[/color]

            Comment

            • Michael Fesser

              #7
              Re: rewrite the url

              .oO(CJ Llewellyn)
              [color=blue]
              >in setguest.php store the value of guess into a cookie or a session
              >variable, and then use header('locatio n: index.php');[/color]

              The Location-header requires an absolute URL. See manual for details.

              Micha

              Comment

              Working...