コード例 #1
0
<?php

require_once 'loginModel.class.php';
@($actionType = $_POST['actionType']);
$email = addslashes(trim($_POST['email']));
if ($actionType == 'email_ajax' && !empty($email)) {
    $loginModel = new loginModel();
    $res = $loginModel->email_exists($email);
    if ($res) {
        $valid = true;
    } else {
        $valid = false;
    }
    echo json_encode(array('valid' => $valid));
} else {
    $password = md5(addslashes(trim($_POST['password'])));
    $loginModel = new loginModel();
    if (!empty($email) && !empty($password) && $loginModel->loginAction($email, $password)) {
        ob_start();
        @Header("Location: index.php");
        ob_end_flush();
    } else {
        ob_start();
        @Header("Location: /sign.html");
        ob_end_flush();
    }
}