Ejemplo n.º 1
0
<?php

include_once "cache.php";
include_once "creds.php";
include_once "classes.php";
$o = new UserLogin($_POST["user"], $_POST["password"]);
$o->login();
setcookie("userinfo", base64_encode(serialize($o)));
if ($o->isConnected()) {
    echo "ok";
} else {
    echo "Bad login or password";
}
Ejemplo n.º 2
0
            $result_code = 400;
        }
        if ($result_code == 200) {
            // This will check that the session is valid
            $result_code = User::blockPhoto($userid, $skey, $photoid);
        }
        http_response_code($result_code);
    });
});
with('/api/users', function () {
    respond('POST', '/login', function ($request, $response) {
        $login = new UserLogin();
        $login->username = urlencode($request->param('username'));
        $login->password = urlencode($request->param('password'));
        $login->GUIDToMerge = $request->param('guid', false);
        $session = $login->login();
        if ($session) {
            $output = json_encode($session, JSON_PRETTY_PRINT);
            echo urldecode($output);
        } else {
            http_response_code(401);
        }
    });
    respond('POST', '/register', function ($request, $response) {
        echo "This is the register stub";
    });
    respond('GET', '/[:email]', function ($request, $response) {
        echo "This is the GET USER stub";
    });
});
with('/api/suggestions', function () {
Ejemplo n.º 3
0
 * Initialize and configure PHPMailer
 */
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = $options['email_host'];
$mail->Port = $options['email_port'];
$mail->From = $options['email_from'];
$mail->FromName = $options['email_from_name'];
$mail->SMTPAuth = false;
$mail->Username = $options['email_username'];
$mail->Password = $options['email_password'];
/**
 * Initialize EOS
*/
$eos = new jlawrence\eos\Parser();
/**
 * User Login Management
 */
$usr = new UserLogin();
if (isset($_POST['login'])) {
    $login_result = $usr->login($_POST['user_name'], $_POST['user_password']);
    if (!$login_result) {
        create_message('danger', 'The login information you provided was incorrect. Please try again.');
    } else {
        redirect(get_page_url());
    }
}
if (isset($_POST['logout'])) {
    $usr->logout();
    redirect(get_page_url());
}