本文整理汇总了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');
}
}
}
示例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);
}
}