password protection for parts of a php script / page...

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

    password protection for parts of a php script / page...

    Hi Gurus

    Is there a way you can password protect a particular function/action on a page?

    What I basically want to do is to have a page and if people click on a button that they are able to edit parts of it.

    Obviously I do not want everyone to be able to edit parts of the page, so I would like to prompt for a password so that only
    qualifying users can continue...

    So, what I have is a PHP script that outputs nice html with a link "edit this page"

    then if ($edit = true) .... the user is prompted for a password and if the password is correct, the rest of the PHP script is
    executed, where it allows the user to change things (using a form).

    Or - would you suggest to place it in a password protected folder and what sort of issues does this pose if I post data (using a
    form) to this page in the password protected area?

    TIA

    - Nicolaas


  • Erwin Moller

    #2
    Re: password protection for parts of a php script / page...

    WindAndWaves wrote:
    [color=blue]
    > Hi Gurus
    >
    > Is there a way you can password protect a particular function/action on a
    > page?
    >
    > What I basically want to do is to have a page and if people click on a
    > button that they are able to edit parts of it.
    >
    > Obviously I do not want everyone to be able to edit parts of the page, so
    > I would like to prompt for a password so that only qualifying users can
    > continue...
    >
    > So, what I have is a PHP script that outputs nice html with a link "edit
    > this page"
    >
    > then if ($edit = true) .... the user is prompted for a password and if the
    > password is correct, the rest of the PHP script is executed, where it
    > allows the user to change things (using a form).
    >
    > Or - would you suggest to place it in a password protected folder and what
    > sort of issues does this pose if I post data (using a form) to this page
    > in the password protected area?
    >
    > TIA
    >
    > - Nicolaas[/color]

    Hi Nic,

    Take some time to study SESSION at www.php.net
    With Sessions you can easily do such things.

    Regards,
    Erwin Moller

    Comment

    • Chung Leong

      #3
      Re: password protection for parts of a php script / page...

      "WindAndWav es" <access@ngaru.c om> wrote in message
      news:ATXHd.9958 $mo2.753462@new s.xtra.co.nz...[color=blue]
      > Hi Gurus
      >
      > Is there a way you can password protect a particular function/action on a[/color]
      page?[color=blue]
      >
      > What I basically want to do is to have a page and if people click on a[/color]
      button that they are able to edit parts of it.[color=blue]
      >
      > Obviously I do not want everyone to be able to edit parts of the page, so[/color]
      I would like to prompt for a password so that only[color=blue]
      > qualifying users can continue...
      >
      > So, what I have is a PHP script that outputs nice html with a link "edit[/color]
      this page"[color=blue]
      >
      > then if ($edit = true) .... the user is prompted for a password and if the[/color]
      password is correct, the rest of the PHP script is[color=blue]
      > executed, where it allows the user to change things (using a form).
      >
      > Or - would you suggest to place it in a password protected folder and what[/color]
      sort of issues does this pose if I post data (using a[color=blue]
      > form) to this page in the password protected area?[/color]

      HTTP authentication would require the least amount of work. Read the Apache
      manual for more information. The directive you need is probably <Location>.


      Comment

      Working...