Esempio n. 1
0
     $validation_errors[] = 'email';
     $message[] = 'Please enter your email address.';
 }
 if ($secret == '') {
     $validation_errors[] = 'secret';
     $message[] = 'Please enter your password.';
 }
 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
     $validation_errors[] = "email";
     $message[] = "Please enter a valid email address.";
 }
 if (empty($validation_errors)) {
     $success = $encrypt->verify($secret);
     if ($success == true) {
         $repo = new Repo();
         $row = $repo->getArraySingle($repo->buildSql(array('table' => 'individual', 'index' => 'email', 'value' => $email, 'columns' => array('id'))));
         $action = 'redirect';
         $rurl = 'profile.php';
         $post_data = array('individual_id' => $row['id']);
     } else {
         $validation_errors[] = 'email';
         $validation_errors[] = 'secret';
         $message[] = 'Incorrect email and password';
     }
 }
 if (!empty($validation_errors)) {
     http_response_code(400);
     header("Content-Type: application/json");
     echo json_encode(array('success' => false, 'validation_errors' => $validation_errors, 'message' => "<div class='notice bad'><p>" . implode("<br/>", $message) . "</p></div>"));
     exit;
 }