Exemplo n.º 1
0
 protected function pretreatment()
 {
     switch ($this->_method) {
         case "post":
             $_POST["password"] = getPwd($_POST["password"]);
             //                $_POST["status"] = 1;
             break;
         case "put":
             if ($_POST["password"]) {
                 $_POST["password"] = getPwd($_POST["password"]);
             } else {
                 unset($_POST["password"]);
             }
             break;
     }
 }
Exemplo n.º 2
0
 private function doLogin()
 {
     if (IS_POST) {
         $user = D("UserRelation");
         $theUser = $user->getFullUserInfo($_REQUEST["username"], "username");
         if (!$theUser or $theUser["status"] < 1) {
             $this->response(array("error" => 1, "msg" => L("user_not_exists")));
             return;
             //@todo 禁用用户
         }
         if ($theUser["password"] !== getPwd($_REQUEST["password"])) {
             $this->response(array("error" => 1, "msg" => L("password_not_verified")));
             return;
         }
         unset($theUser["password"]);
         $_SESSION["user"] = $theUser;
         $this->response(array("error" => 0, "sessionHash" => session_id()));
     } else {
         $this->response(array("error" => 1, "msg" => L("invlid")));
     }
 }
Exemplo n.º 3
0
function getUrlFull($file)
{
    global $CFG;
    $path = getPwd($file);
    return $CFG->wwwroot . "/" . $path;
}
Exemplo n.º 4
0
    $checkEmail = $db->prepare($sql);
    $checkEmail->execute(array(':email' => $email));
    if (strlen($user) < 3 || strlen($pwd) < 6) {
        $regMsg = '用户名或密码格式不正确';
    } elseif (!preg_match('/^[a-zA-Z0-9\\-\\_]+@[a-zA-Z0-9\\-]+\\.[a-zA-Z]+$/', $email)) {
        $regMsg = '邮箱格式不正确';
    } elseif (strlen($code) != 4 || !isset($_COOKIE['verification']) || md5(strtolower($code)) !== $_COOKIE['verification']) {
        $regMsg = '验证码错误';
    } elseif ($checkUser->fetch()) {
        $regMsg = '此用户名已存在';
    } elseif ($checkEmail->fetch()) {
        $regMsg = '该邮箱已经注册过';
    } else {
        setCookie('verification', null, -1, '/');
        //销毁验证码,以防利用这个验证码重复注册
        $pwd = getPwd($pwd);
        $sid = getSid();
        $sql = "INSERT INTO `kldns_users` (`user`, `email`, `pwd`, `sid`, `regtime`, `lasttime`, `lastip`, `logintime`, `loginip`) VALUES (:user,:email, :pwd, :sid, NOW(), NOW(), :ip, NOW(), :ip)";
        $stmt = $db->prepare($sql);
        if ($stmt->execute(array(':user' => $user, ':email' => $email, ':pwd' => $pwd, ':sid' => $sid, ':ip' => getIp()))) {
            setCookie('kldns_sid', $sid, time() + 3600 * 24 * 7, '/');
            exit("<script language='javascript'>alert('注册成功!马上进入控制面板!');window.location.href='/control.php';</script>");
        } else {
            $dberror = $db->errorInfo();
            $regMsg = '注册失败:保存数据库出错' . $dberror[2];
        }
    }
}
$title = '域名控制台';
//本页标题
require_once 'head.php';
Exemplo n.º 5
0
    $allowNum = getRequest('allowNum', 'post');
    if (!is_numeric($allowNum)) {
        $allowNum = 0;
    }
    if (strlen($webName) < 2) {
        $errorMsg = '网站名称长度不能小于2';
    } elseif ($webAdmin && strlen($webAdmin) < 5) {
        $errorMsg = '新密码太简单';
    } else {
        $webFoot = base64_encode($webFoot);
        $stmt = $db->prepare("insert into kldns_configs set `vkey`=:vkey,`value`=:value on duplicate key update `value`=:value");
        $stmt->execute(array(':vkey' => 'webName', ':value' => $webName));
        $stmt->execute(array(':vkey' => 'webFoot', ':value' => $webFoot));
        $stmt->execute(array(':vkey' => 'allowNum', ':value' => $allowNum));
        if ($webAdmin) {
            $stmt->execute(array(':vkey' => 'webAdmin', ':value' => getPwd($webAdmin)));
        }
        config('webName', $webName);
        config('webFoot', $webFoot);
        config('allowNum', $allowNum);
    }
}
$title = '网站设置-管理后台';
//本页标题
require_once '../head.php';
?>
			<div class="row">
				<div class="col-xs-12">
					<pre><h4>网站基本信息设置<a href="index.php" class="dns-btn btn-info" style="float: right;">返回</a></h4></pre>
				</div>
				<div class="col-xs-12">
 private function initApp($config)
 {
     $model = D("User");
     $data = $config["admin"];
     $data["status"] = 1;
     $data["password"] = getPwd($data["password"]);
     $data["department_id"] = 0;
     $uid = $model->add($data);
     $m = M();
     $sql = "INSERT INTO `%sauth_group_access`(uid, group_id)VALUES(%d, 1)";
     $sql = sprintf($sql, $config["db"]["dbpre"], $uid);
     $m->execute($sql);
     $authNodesModel = D("AuthRule");
     $nodeIds = $authNodesModel->field("id")->select();
     $nodeIds = getArrayField($nodeIds, "id");
     $authedRule = D("AuthGroupRule");
     foreach ($nodeIds as $node) {
         $authedRule->add(array("group_id" => 1, "rule_id" => $node, "flag" => 0));
     }
 }