Buy Now
Sign in

Simple password protection for a Joomla page or section.

ozzie , October 14 2010
O
ozzie
Just a really simple application of Chrono Forms for those persons like me who have a beginner level of programming skills.
I needed a low security gateway to a page. Mainly to avoid accidental visits by the public to avoid confusion. However I needed to keep the nav menu visable/public for a sales team.

seclock.jpg

Making this is very easy using the wizard.

  1. Use a password field and submit button,

  2. Call the form field "password"

  3. In the validations tab enter the following code, [Provided by Bob in another thread], to create a stand alone password and error message in the server side valdation text area.

  4. In this case password = "gatepw"

  5. Ensure you enable server side validation by ticking the check box above the text area.

  6. Set up your redirection URL to a page of choice.

'Tis Simple! [ when you know how ]

<?php
$password = JRequest::getString('password', '', 'post');
if ( !$password || $password != 'gatepw' ) {
return 'Please enter a valid password';
}
?>

The end result is a page with a password gateway to what ever page you wish to re-direct to upon successfull submission with out using a database for validation [similar to htaccess]
Attachments
seclock.jpg
seclock.jpg
(88.47 KiB)
6504 Downloads/Views
K
kus_kus
If you came here through Google Search pay attention to new code in CF v.4
(taken from this thread)
<?php
$password =& $form->data['password'];
if ( !isset($password) || !$password || $password != '12345' ) {
$form->validation_errors['password'] = 'Please enter a valid password';
return false;
}
?>