This is a discussion on password protection for parts of a php script / page... within the PHP Language forums, part of the PHP Programming Forums category; Hi Gurus Is there a way you can password protect a particular function/action on a page? What I basically ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
WindAndWaves wrote:
> 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 Hi Nic, Take some time to study SESSION at www.php.net With Sessions you can easily do such things. Regards, Erwin Moller |
|
|||
|
"WindAndWaves" <access@ngaru.com> wrote in message
news:ATXHd.9958$mo2.753462@news.xtra.co.nz... > 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? HTTP authentication would require the least amount of work. Read the Apache manual for more information. The directive you need is probably <Location>. |