Ejemplo n.º 1
0
    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');
            }
        }
}
Ejemplo n.º 2
0
 */
/*************设置public目录路径**************/
/**  ../ 表示global.php文件位于上层目录	 */
define('iCMSPATH', '../');
/*********************************************/
/*********************************************/
require_once dirname(__FILE__) . '/' . iCMSPATH . 'global.php';
define('uPATH', dirname(strtr(__FILE__, '\\', '/')) . "/");
define('__USERCP__', __SELF__ . '?mo');
require_once iPATH . 'include/member.class.php';
require_once iPATH . 'admin/function.php';
require_once iPATH . 'include/UI.class.php';
if ($_POST['action'] == "login") {
    ckseccode($_POST['seccode'], 'U') && javascript::alert('验证码错误!');
}
member::checklogin();
class UserCP
{
    function __construct()
    {
        global $iCMS, $firstcount, $pagenav;
        $this->iCMS =& $iCMS;
        $this->pagenav =& $pagenav;
        $this->firstcount =& $firstcount;
        $this->uiBasePath = $iCMS->config['publicURL'] . '/ui';
        $this->module = $_GET['mo'] ? $_GET['mo'] : '';
        $this->action = isset($_GET['do']) ? $_GET['do'] : $_POST['do'];
        $this->param = isset($_GET['param']) ? $_GET['param'] : $_POST['param'];
        empty($this->action) && ($this->action = 'manage');
        !isset($this->param) && ($this->param = NULL);
        if (empty($this->module)) {