示例#1
0
 * 登录页面
 * @author 潘洪学 panliu888@gmail.com
 * @create_date	2011-10
 */
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
if ($_GET['action'] == 'logoff') {
    Passport::LogOff();
    redirect('login.php');
}
if (Passport::IsLogin()) {
    redirect('index.php');
}
if (Request::IsPost()) {
    $fields = $_POST['f'];
    if (validate($fields)) {
        $ret = Passport::Login($fields['username'], $fields['password']);
        if (is_array($ret)) {
            $return_url = get_returnurl('index.php');
            $wt_open = new WTOpen();
            $cbs = $wt_open->getCallbackList();
            $scripts = '';
            if (count($cbs) > 0) {
                $token = http_build_query($ret);
                foreach ($cbs as $value) {
                    $url = get_absolute_url("login_api.php?{$token}", $value);
                    $scripts .= "<script src=\"{$url}\"></script>\n";
                }
            }
            echo <<<HTML
{$scripts}
<script>