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'); } } }
$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); } }