You are here

function photos_access_pass_form_validate in Album Photos 7.3

Validate password.

1 string reference to 'photos_access_pass_form_validate'
photos_access_pass_form in photos_access/photos_access.module
Password form.

File

photos_access/photos_access.module, line 609

Code

function photos_access_pass_form_validate($form, &$form_state) {
  global $user;
  $node = db_query("SELECT pass, nid FROM {photos_access_album} WHERE nid = :nid AND pass = :pass", array(
    ':nid' => $form_state['values']['nid'],
    ':pass' => md5($form_state['values']['pass']),
  ))
    ->fetchObject();
  if (isset($node->pass)) {
    $_SESSION[$node->nid . '_' . session_id()] = $node->pass;
    drupal_goto('node/' . $node->nid);

    // $_GET['description']
  }
  else {
    form_set_error('pass', t('Password required'));
  }
}