Skip to content

Instantly share code, notes, and snippets.

@thgiang
Created August 31, 2017 02:29
Show Gist options
  • Save thgiang/a506009385c5164d77e3ace99b21f115 to your computer and use it in GitHub Desktop.
Save thgiang/a506009385c5164d77e3ace99b21f115 to your computer and use it in GitHub Desktop.
A field to input password and validate it before submit the contact form.
// Please see my video: https://drive.google.com/file/d/0B0q3Kha3KEfUZFhsdFA2MlpuU2s/view?usp=sharing
//Code:
//ID of password field
$field_id = 28;
//List of password
$accepted = array('bravebits','joomlashine','woorocket','sellersmith','golden','river');
if (!in_array($post['password'][$field_id][0], $accepted))
{
// Wrong password
echo '<input type="hidden" name="error" value=\'{"'.$field_id.'":"Wrong password"}\'/>';
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment