當前位置: 首頁>>代碼示例>>PHP>>正文


PHP javascript::json方法代碼示例

本文整理匯總了PHP中javascript::json方法的典型用法代碼示例。如果您正苦於以下問題:PHP javascript::json方法的具體用法?PHP javascript::json怎麽用?PHP javascript::json使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javascript的用法示例。


在下文中一共展示了javascript::json方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ckseccode

    case 'logout':
        member::cleancookie();
        break;
    default:
        require_once iPATH . 'include/UI.class.php';
        $action = $_POST['action'];
        //$forward= $_POST['forward'];
        if ($action == 'register') {
            ckseccode($_POST['seccode'], 'U') && javascript::json('seccode', 'error:seccode');
            $username = dhtmlspecialchars($_POST['username']);
            !preg_match("/^([\\w\\.-]+)@([a-zA-Z0-9-]+)(\\.[a-zA-Z\\.]+)\$/i", $username) && javascript::json('username', 'register:emailerror');
            iCMS_DB::getValue("SELECT uid FROM `#iCMS@__members` where `username`='{$username}'") && javascript::json('username', 'register:emailusr');
            $password = md5(trim($_POST['password']));
            $pwdrepeat = md5(trim($_POST['pwdrepeat']));
            $password != $pwdrepeat && javascript::json('pwdrepeat', 'register:different');
            $nickname = dhtmlspecialchars($_POST['nickname']);
            cstrlen($nickname) > 12 && javascript::json(0, 'register:nicknamelong');
            iCMS_DB::query("INSERT INTO `#iCMS@__members` (`groupid`,`username`,`password`,`nickname`,`gender`,`info`,`power`,`cpower`,`regtime`,`lastip`,`lastlogintime`,`logintimes`,`post`,`type`,`status`) VALUES ('4','{$username}','{$password}', '{$nickname}','2','','','','" . time() . "','" . getip() . "', '" . time() . "','0','0','0','1') ");
            $uid = iCMS_DB::$insert_id;
            //設置為登陸狀態
            member::set_user_cookie($username, $password, $nickname);
            javascript::json(1, 'register:finish');
        } elseif ($action == "login") {
            ckseccode($_POST['seccode'], 'U') && javascript::json(0, 'error:seccode');
            if (member::checklogin(true)) {
                javascript::json(1, 'login:success');
            } else {
                javascript::json(0, 'login:failed');
            }
        }
}
開發者ID:idreamsoft,項目名稱:iCMS5.1,代碼行數:31,代碼來源:passport.php

示例2: get_cookie

    $auth = get_cookie('user');
    require_once iPATH . "usercp/user.class.php";
    //    require_once iPATH.'usercp/usercp.lang.php';
    if ($auth) {
        list($a, $p) = explode('#=iCMS!=#', authcode($auth, 'DECODE'));
        User::checkuser($a, $p);
        $uid = User::$uId;
        $username = $anonymous && $iCMS->config['anonymous'] ? $iCMS->config['anonymousname'] : User::$nickname;
    } else {
        $iCMS->config['anonymous'] ? $username = $iCMS->config['anonymousname'] : javascript::json(0, 'login:no', $frame);
    }
    $status = $iCMS->config['isexamine'] ? '0' : '1';
    $query = iCMS_DB::query("INSERT INTO `#iCMS@__comment` (`mid`, `sortId`, `indexId`, `userId`, `username`, `title`, `contents`, `quote`, `floor`, `reply`, `up`, `down`, `ip`, `addtime`, `status`) VALUES ('{$mId}', '{$sortId}', '{$indexId}', '{$uid}', '{$username}', '{$title}', '{$contents}', '{$quote}', '{$floor}', '{$reply}', '0', '0', '" . getip() . "', '" . time() . "', '{$status}')");
    if ($query) {
        if ($status) {
            if (empty($mId)) {
                $__TABLE__ = 'article';
            } else {
                $__MODEL__ = $iCMS->cache('model.id', 'include/syscache', 0, true);
                $model = $__MODEL__[$mId];
                $__TABLE__ = $model['table'] . '_content';
            }
            iCMS_DB::query("UPDATE `#iCMS@__{$__TABLE__}` SET `comments` = comments+1  WHERE `id` ='{$indexId}'");
            javascript::json(1, 'comment:post', $frame);
        } else {
            javascript::json(1, 'comment:examine', $frame);
        }
    } else {
        javascript::json(1, 'comment:Unknown', $frame);
    }
}
開發者ID:idreamsoft,項目名稱:iCMS5.0,代碼行數:31,代碼來源:comment.php


注:本文中的javascript::json方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。