Connecting Tech Pros Worldwide Forums | Help | Site Map

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

WindAndWaves
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

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
Chung Leong
Guest
 
Posts: n/a
#3: Jul 17 '05

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


"WindAndWaves" <access@ngaru.com> wrote in message
news:ATXHd.9958$mo2.753462@news.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>.


Closed Thread


Similar PHP bytes