Example #1
0
 public function login()
 {
     $user = $this->checkPassword($_REQUEST['username'], $_REQUEST['passwd']);
     if (!$user) {
         return $this->_tpl->display('login_error.html');
         //die('登录错误![<a href="javascript:history.go(-1);">返回</a>]');
     }
     registerRole('admin', $user['username']);
     $_SESSION['admin_last_login'] = $user['last_login'];
     $_SESSION['admin_last_ip'] = $user['last_ip'];
     $log = array('operate_object' => 'username='******'username'], 'mem' => 'ip=' . $_SERVER["REMOTE_ADDR"], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']);
     apicall('operatelog', 'operatelogAdd', array($log));
     header("Location: index.php");
 }
Example #2
0
 public function login()
 {
     $user = trim($_REQUEST['username']);
     if (UC_START == 'on') {
         @(include dirname(__FILE__) . '/../../config.inc.php');
         if (UC_KEY == "" || UC_API == "") {
             exit("登陆失败,请检查uc配置文件config.inc.php");
         }
         include dirname(__FILE__) . '/../../include/db_mysql.class.php';
         include dirname(__FILE__) . '/../../uc_client/client.php';
         list($uid, $username, $password, $email) = uc_user_login($user, $_REQUEST['passwd']);
         if ($uid > 0) {
             registerRole('user', $user);
             $_SESSION["uc_uid"] = $uid;
             header("Location: ?c=user&a=index&uc=1");
             die;
             //$ucsynlogin = uc_user_synlogin($uid);
             //$this->assign('ucsynclogin',$ucsynlogin);
             //return dispatch('user','index');
             //return $this->_tpl->fetch('user/index.html');
         } else {
             header('Location: ?c=session&a=error');
             die;
         }
     } else {
         if (!$this->checkRight($user)) {
             exit("用户名不符合标准");
         }
         $userinfo = $this->checkPassword($user, $_REQUEST['passwd']);
         if (!$userinfo) {
             return $this->error();
         }
         registerRole('user', $userinfo['username']);
         if ($GLOBALS['frame'] == 1) {
             header("Location: ?c=frame&a=index");
             die;
         } else {
             header("Location: ?c=user&a=index");
             die;
         }
     }
 }
Example #3
0
 public function impLogin()
 {
     registerRole('user', $_REQUEST['username']);
     header("Location: /?c=user&a=index");
     die;
 }
Example #4
0
File: uc.php Project: srdc2014/vhms
 function synlogin($get, $post)
 {
     session_start();
     $uid = $get['uid'];
     $username = $get['username'];
     if (!API_SYNLOGIN) {
         return API_RETURN_FORBIDDEN;
     }
     registerRole('user', $username);
     $money = daocall('setting', 'get', array('reg_user_price'));
     if (!daocall('user', 'getUser', array($username))) {
         daocall('user', 'newUser', array($username, $get['password'], null, $username, 0, $uid, $money));
     }
     //		else{
     //			daocall('user','updateUserUid',array($username,$uid));
     //		}
     header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
     _setcookie('Example_auth', _authcode($uid . "\t" . $username, 'ENCODE'));
 }
Example #5
0
 public function register()
 {
     $username = trim($_POST['username']);
     if (!$this->checkRight($username)) {
         exit("用户名不符合标准");
     }
     if (UC_START && UC_START == 'on') {
         @(include_once dirname(__FILE__) . '/../../config.inc.php');
         $uctable = explode('.', UC_DBTABLEPRE);
         $tablepre = substr($uctable[1], 0, -8);
         if (UC_KEY == "" || UC_API == "") {
             return "注册失败,请检查ucenter配置文件.";
         }
         include_once dirname(__FILE__) . '/../../uc_client/client.php';
         $passwd = trim($_REQUEST['passwd']);
         $email = $_REQUEST['email'];
         $uid = uc_user_register($username, $passwd, $email);
         if ($uid <= 0) {
             if ($uid == -6) {
                 $this->_tpl->assign('msg', '注册失败,email已注册');
             } elseif ($uid == -5) {
                 $this->_tpl->assign('msg', '注册失败,Email 不允许注册');
             } elseif ($uid == -4) {
                 $this->_tpl->assign('msg', '注册失败,Email 格式有误');
             } elseif ($uid == -3) {
                 $this->_tpl->assign('msg', '注册失败,用户名已经存在');
             } elseif ($uid == -2) {
                 $this->_tpl->assign('msg', '注册失败,包含不允许注册的词语');
             } elseif ($uid == -1) {
                 $this->_tpl->assign('msg', '注册失败,用户名不合法');
             }
             return $this->fetch('msg.html');
         } else {
             include_once dirname(__FILE__) . '/../../include/db_mysql.class.php';
             $db = new dbstuff();
             $conn = $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW);
             $password = md5($_REQUEST['passwd']);
             $sql = "INSERT INTO " . UC_DBNAME . "." . $tablepre . "common_member (`uid`,`email`,`username`,`password`)";
             $sql .= " VALUES ('{$uid}','{$email}','{$username}','{$password}')";
             @$db->query($sql);
             //at 管理员还是user
             if ($_REQUEST['at'] == 1) {
                 needRole('admin');
                 return header("Location:  /admin/index.php?c=user&a=pageUsers");
             }
             $this->_tpl->assign('msg', '注册成功');
             return $this->_tpl->fetch('msg.html');
         }
     }
     $money = daocall('setting', 'get', array('reg_user_price'));
     $result = daocall('user', 'newUser', array($username, trim($_REQUEST['passwd']), $_REQUEST['email'], $_REQUEST['name'], $_REQUEST['ids'], 0, $money));
     if ($result) {
         registerRole('user', $username);
         $external = $_REQUEST['external'];
         if ($external == '1') {
             $url = "?fc=user&fa=index";
         } else {
             $url = "?c=user&a=index";
         }
         header("Location: " . $url);
         die;
     } else {
         exit('注册失败');
     }
 }