Пример #1
0
<?php

include_once 'classes/EDAPI.php';
$api = new EDAPI();
$email = isset($_POST['email']) ? $_POST['email'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
$errors = array();
if ($email && $password) {
    $info = $api->login($email, $password);
    if ($info['http_code'] == 302) {
        header('Location: confirm.php');
    } else {
        $errors[] = "Email or password are incorrect";
    }
} else {
    $errors[] = "Email and Password are both required fields";
}
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>ED Companion</title>
  </head>
  <body>
    <?php 
if (sizeof($errors)) {
    echo '<h3>Errors</h3><ul>';
    foreach ($errors as $error) {
        echo '<li>' . $error . '</li>';