示例#1
0
 /**
 	输出预设的格式化路径
 	@param array $info
 	@return string
 */
 public function depathMode($info)
 {
     global $king;
     $path = str_replace('TIME', time(), $info['kpathmode']);
     if (false !== strpos($path, 'ID')) {
         //如果有ID
         $model = $this->infoModel($info['modelid']);
         $res = $king->db->getRows_one("select max(kid) from %s__{$model['modeltable']}");
         $res[0] ? $path = str_replace('ID', $res[0] + 1, $path) : ($path = str_replace('ID', 1, $path));
     }
     $date = explode(',', kc_formatdate(time(), 'Y,m,d,G,i,s,M'));
     $path = str_replace('yyyy', $date[0], $path);
     $path = str_replace('yy', substr($date[0], 2), $path);
     $path = str_replace('dd', $date[2], $path);
     $path = str_replace('hh', $date[3], $path);
     $path = str_replace('mm', $date[4], $path);
     $path = str_replace('ss', $date[5], $path);
     $path = str_replace('MMM', $date[6], $path);
     $path = str_replace('MM', $date[1], $path);
     while (False !== strpos($path, 'RND')) {
         $path = preg_replace('/RND/', kc_random(3), $path, 1);
     }
     while ($king->db->getRows_one("select kpath from %s__{$model['modeltable']} where kpath='" . $king->db->escape($path) . "';")) {
         $ext = kc_f_ext($path);
         //扩展名
         $path = substr($path, 0, strlen($path) - strlen($ext) - 1) . $king->config('rewriteline') . kc_random(6) . '.' . $ext;
     }
     return $path;
 }
示例#2
0
function king_ajax_salt()
{
    global $king;
    $id_fly = kc_post('ID');
    $id = substr($id_fly, 0, strlen($id_fly) - 4);
    $salt = kc_random(12);
    $js = "\$('#{$id}_salt').val('{$salt}');";
    $s = "<img alt=\"" . $king->lang->get('system/check/verifynew') . "\" src=\"" . $king->config('inst') . "system/verify.php?salt={$salt}\"/>";
    $s .= "<a href=\"javascript:;\" class=\"k_ajax\" rel=\"{URL:'../system/verify.php',ID:'{$id_fly}',CMD:'salt'}\">" . $king->lang->get('system/check/verifynew') . "</a>";
    kc_ajax('', $s, 0, $js);
}
示例#3
0
function kc_grab_get($imgpath)
{
    global $king;
    if ($img = file_get_contents($imgpath)) {
        $fext = kc_f_ext($imgpath);
        //扩展名
        $date = kc_formatdate(time(), 'Y-m-d h:i');
        list($msec, $sec) = explode(' ', microtime());
        $path = $king->config('uppath') . '/image/' . kc_formatdate(time(), 'Y/m/d/h/i') . '/' . kc_random(3) . round($msec * 1000000.0) . '.' . $fext;
        if (kc_f_put_contents($path, $img)) {
            //写文件成功
            return $path;
        } else {
            return $imgpath;
        }
    } else {
        return False;
    }
}
示例#4
0
 function updatepw($get, $post)
 {
     if (!API_UPDATEPW) {
         return API_RETURN_FORBIDDEN;
     }
     $username = $get['username'];
     $password = $get['password'];
     global $king;
     $salt = kc_random(6);
     $md5pass = md5($salt . $password);
     $king->db->update('%s_user', array('salt' => $salt, 'userpass' => $md5pass), "username='******'");
     return API_RETURN_SUCCEED;
 }
示例#5
0
function king_ajax_lostpwd1()
{
    global $king;
    $username = kc_post('username');
    //ask
    if ($user = $king->db->getRows_one("select userid,uid,userask,useranswer,usermail from %s_user where isdelete=0 and  username='******'username')) . "'")) {
        if (!$user['userask']) {
            kc_error($king->lang->get('user/error/ask'));
        }
    } else {
        kc_error($king->lang->get('system/error/param'));
    }
    $s = $king->htmForm($king->lang->get('user/label/ask'), htmlspecialchars($user['userask']));
    //answer
    $array = array(array('useranswer', 0, 1, 16), array('useranswer', 12, $king->lang->get('portal/check/lost/answer'), $user['useranswer'] != kc_post('useranswer')));
    $s .= $king->htmForm($king->lang->get('user/label/answer'), '<input class="k_in w150" type="text" name="useranswer" id="useranswer" maxlength="16" value="' . htmlspecialchars(kc_post('useranswer')) . '" />', $array);
    //mail
    $_array = array(array('usermail', 0, 6, 32), array('usermail', 5, $king->lang->get('portal/check/reg/u-4')), array('usermail', 12, $king->lang->get('portal/check/lost/mail'), strtolower($user['usermail']) != strtolower(kc_post('usermail'))));
    $s .= $king->htmForm($king->lang->get('portal/user/mail'), '<input class="k_in w250" type="text" name="usermail" value="' . htmlspecialchars(kc_post('usermail')) . '" maxlength="32" />', $_array);
    //pass
    $_array = array(array('userpass', 0, 6, 30), array('userpass', 17, null, 'userpass1'));
    $s .= $king->htmForm($king->lang->get('portal/user/pass') . ' (6-30)', '<input class="k_in w150" type="password" name="userpass" id="userpass" maxlength="30" value="' . htmlspecialchars(kc_post('userpass')) . '" />', $_array);
    //repass
    $s .= $king->htmForm($king->lang->get('portal/user/pass1'), '<input class="k_in w150" type="password" name="userpass1" id="userpass1" maxlength="30" value="' . htmlspecialchars(kc_post('userpass1')) . '" />');
    $verify = new KC_Verify_class();
    $s .= $verify->Show();
    if ($GLOBALS['ischeck']) {
        $array = array();
        $salt = kc_random(6);
        $md5pass = md5($salt . kc_post('userpass'));
        $array['userpass'] = $md5pass;
        $array['ksalt'] = $salt;
        $userid = $king->db->update('%s_user', $array, "userid={$user['userid']}");
        //写Cookie
        $s = $king->user->userLogin($user['userid'], 2592000);
        $king->user->delUserInfo($user['userid']);
        kc_ajax($king->lang->get('system/common/welcome'), $s . "<p class=\"k_ok\">" . $king->lang->get('portal/user/lostok') . "</p>", 0);
    }
    $but = kc_htm_a($king->lang->get('system/common/submit'), "{URL:'" . $king->config('inst') . "user/index.php',CMD:'lostpwd1',username:'******',IS:1}");
    $height = $king->config('verifyopen') ? 250 + $king->config('verifyheight') : 230;
    kc_ajax($king->lang->get('portal/user/name'), $s, $but, '', 420, $height + $GLOBALS['check_num'] * 15);
}
示例#6
0
function king_def()
{
    global $king;
    $sel_array = array('mysql' => 'MySQL', 'sqlite' => 'SQLite');
    $phpself = $_SERVER['PHP_SELF'];
    $inst = substr($phpself, 0, strlen($phpself) - 11);
    //安装目录
    $select_type = kc_htm_radio('dbtype', $sel_array, 'sqlite');
    //数据库类型
    $array_dirs = array('config.php', 'system/js');
    $array_func = array('mysql_connect', 'file_get_contents', 'file_put_contents', 'simplexml_load_file');
    //,'fsockopen'
    $s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n<title>" . $king->lang->get('system/install/title') . "</title>\r\n<link href=\"system/skins/default/style.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<style type=\"text/css\">\r\n.k_table_form{font-size:12px;}\r\n.k_table_form th{width:200px;color:#000;font-weight:normal;text-indent:5px;padding:5px;}\r\n.k_table_form td{text-indent:5px;}\r\n</style>\r\n<meta name=\"generator\" content=\"KingCMS\"/>\r\n<script type=\"text/javascript\" src=\"system/js/jquery.js\"></script>\r\n<script type=\"text/javascript\" src=\"system/js/jquery.kc.js\"></script>\r\n<script type=\"text/javascript\" src=\"system/skins/default/fun.js\"></script>\r\n<script type=\"text/javascript\">\r\njQuery(function(\$){\r\n\r\n\t\$(\"#k_dbtype_mysql , #k_dbtype_sqlite\").click(function(){\$.ck_radio(this)});\r\n\r\n\t\$.ck_radio=function(obj){\r\n\t\tif(\$(obj).attr('id')=='k_dbtype_mysql'){\r\n\t\t\t\$('.mysql').show();\r\n\t\t\t\$('.sqlite').hide();\r\n\r\n\t\t}else{\r\n\t\t\t\$('.sqlite').show();\r\n\t\t\t\$('.mysql').hide();\r\n\t\t\r\n\t\t}\r\n\t}\r\n\r\n});\r\n\r\n</script>\r\n</head>\r\n<body>\r\n<div id=\"k_ajax\"></div>\r\n<div id=\"top\">\r\n\t<a id=\"logo\" href=\"http://www.kingcms.com\" target=\"_blank\"><img alt=\"KingCMS\" src=\"system/skins/default/logo.gif\"/></a>\r\n\t<ul class=\"k_menu\">\r\n\t\t<li><a href=\"INSTALL.php\">" . $king->lang->get('system/common/install') . "</a></li>\r\n\t\t<li><a href=\"javascript:;\">" . $king->lang->get('system/common/language') . "</a>\r\n\r\n\t\t\t\t<ul>";
    //language
    $array = kc_f_getdir('system/language', 'xml');
    $array = array_map('kc_f_name', $array);
    $_language = kc_cookie('language');
    foreach ($array as $val) {
        $s .= '<li><a href="javascript:;" class="k_ajax" rel="{CMD:\'language\',lang:\'' . $val . '\'}">';
        if ($_language == $val) {
            $s .= '&bull;&nbsp;';
        }
        $s .= kc_getlang($val) . '</a></li>';
    }
    $s .= "</ul>\r\n\t\t</li>\r\n\t</ul>\r\n</div>\r\n<div id=\"main\">\r\n\r\n\r\n<table class=\"w0\"><tr><td style=\"vertical-align:top;\" class=\"w10\">\r\n\t<form name=\"form_install\" id=\"form_install\">\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/install/db') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/dbtype') . "</th><td>{$select_type}</td></tr></tbody>\r\n\t\t<tr><th>" . $king->lang->get('system/install/pre') . "</th><td><input id=\"pre\" name=\"pre\" class=\"k_in w200\" value=\"king\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/preadmin') . "</th><td><input id=\"preadmin\" name=\"preadmin\" class=\"k_in w200\" value=\"kc\"/></td></tr>\r\n\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbhost') . "</th><td><input id=\"host\" name=\"host\" class=\"k_in w200\" value=\"localhost\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbdata') . "</th><td><input id=\"data\" name=\"data\" class=\"k_in w200\" value=\"test\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbuser') . "</th><td><input id=\"user\" name=\"user\" class=\"k_in w200\" value=\"root\"/></td></tr>\r\n\t\t<tr class=\"mysql none\"><th>" . $king->lang->get('system/install/dbpass') . "</th><td><input id=\"pass\" name=\"pass\" class=\"k_in w200\" value=\"\"/></td></tr>\r\n\r\n\t\t<tr class=\"sqlite\"><th>" . $king->lang->get('system/install/dbfile') . "</th><td><input id=\"sqlitedata\" name=\"sqlitedata\" class=\"k_in w200\" value=\"" . kc_random(12) . ".db3\"/></td></tr>\r\n\t</table>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/install/admin') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/adminname') . "</th><td><input id=\"adminname\" name=\"adminname\" class=\"k_in w200\" value=\"admin\"/></td></tr></tbody>\r\n\t\t<tr><th>" . $king->lang->get('system/install/adminpass') . "</th><td><input id=\"adminpass\" name=\"adminpass\" class=\"k_in w200\" value=\"admin888\"/></td></tr>\r\n\t</table>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/level/config') . "</h3>\r\n\t<table class=\"k_table_form\" cellspacing=\"0\">\r\n\t\t<tbody><tr><th>" . $king->lang->get('system/install/cache') . "</th><td><input id=\"cache\" name=\"cache\" class=\"k_in w200\" value=\"_cache\"/></td></tr></tbody>\r\n\r\n\t\t<tr><th>" . $king->lang->get('system/const/inst') . "</th><td><input id=\"inst\" name=\"inst\" class=\"k_in w100\" value=\"{$inst}\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/timediff') . "</th><td><input id=\"timediff\" name=\"timediff\" class=\"k_in w100\"/></td></tr>\r\n\t\t<tr><th>" . $king->lang->get('system/install/debug') . "</th><td><input id=\"debug\" value=\"1\" name=\"debug\" type=\"checkbox\" checked=\"checked\"/><label for=\"debug\">" . $king->lang->get('system/install/opendebug') . "</label></td></tr>\r\n\t</table>\r\n\r\n\t<script type=\"text/javascript\">\r\n\tvar dateObj = new Date();\r\n\tvar timediff=" . date('G', 0) . ";\r\n\t\$('#timediff').val(timediff);\r\n\t</script>\r\n\r\n\t<p>\r\n\t\t<input value=\"1\" id=\"license\" name=\"license\" type=\"checkbox\"/><label for=\"license\">" . $king->lang->get('system/install/readlicense') . "</label>\r\n\t\t[<a href=\"http://www.kingcms.com/license/\" target=\"_blank\">" . $king->lang->get('system/install/license') . "</a>]\r\n\t</p>\r\n\t\t<input value=\"1\" id=\"isdelete\" name=\"isdelete\" type=\"checkbox\" checked=\"checked\"/><label for=\"isdelete\">" . $king->lang->get('system/install/isdelete') . "</label>\r\n\t<p>\r\n\r\n\t</p>\r\n\r\n\t<p class=\"k_submit\">\r\n\r\n\t\t<input value=\"" . $king->lang->get('system/common/install') . "[S]\" class=\"k_ajax big\" rel=\"{CMD:'config',FORM:'form_install'}\" type=\"button\" accesskey=\"s\"/>\r\n\r\n\t</p>\r\n\t</form>\r\n</td><td class=\"w1\" style=\"vertical-align:top;\"></td><td>\r\n\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/sys') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/obj') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/this') . "</th></tr>";
    $s .= '<tr><td>' . $king->lang->get('system/skin/os') . '</td><td>ALL</td><td>' . PHP_OS . '</td></tr>';
    $s .= '<tr><td>' . $king->lang->get('system/skin/phpver') . '</td><td>5.1.0+</td><td>' . PHP_VERSION . '</td></tr>';
    if (function_exists('disk_free_space')) {
        $s .= '<tr><td>' . $king->lang->get('system/skin/diskspace') . '</td><td>>2 Mb</td><td>' . kc_f_size(disk_free_space('./')) . '</td></tr>';
    }
    $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/writeinfo') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/filedir') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5wgfv -k07-87;[yu'pbv9io/h9;'99999\">" . $king->lang->get('system/skin/this') . "</td></tr>";
    foreach ($array_dirs as $val) {
        $s .= '<tr><td>' . $val . '</td><td>' . $king->lang->get('system/skin/write/w1') . '</td><td>' . $king->lang->get('system/skin/write/w' . (is_writable(ROOT . $val) ? 1 : 0)) . '</td></tr>';
    }
    $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/func') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t<tr><th class=\"w10\">" . $king->lang->get('system/skin/funs') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/required') . "</th><th class=\"w5\">" . $king->lang->get('system/skin/this') . "</th></tr>";
    foreach ($array_func as $val) {
        $s .= '<tr><td>' . $val . '()</td><td>' . $king->lang->get('system/skin/fun/f1') . '</td><td>' . $king->lang->get('system/skin/fun/f' . (function_exists($val) ? 1 : 0)) . '</td></tr>';
    }
    $s .= "</table>\r\n\t<h3 class=\"caption\">" . $king->lang->get('system/skin/other') . "</h3>\r\n\t<table class=\"k_table_list\" cellspacing=\"0\">\r\n\t";
    $s .= "<tr><th class=\"w10 red\">" . $king->lang->get('system/skin/obj') . "</th><th class=\"w5 red\">" . $king->lang->get('system/skin/advice') . "</th><th class=\"w5 red\">" . $king->lang->get('system/skin/this') . "</th></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/browser') . "</td><td>IE 7.0</td><td>" . kc_browser() . "</td></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/safemode') . "</td><td>--</td><td>" . $king->lang->get('system/skin/open/o' . (ini_get('safe_mode') ? 1 : 0)) . "</td></tr>\r\n\t<tr><td>" . $king->lang->get('system/skin/maxetime') . "</td><td>--</td><td>" . ini_get('max_execution_time') . "s</td></tr>\r\n\t</table>\r\n\r\n\t<p><img class=\"f6 os\" src=\"system/images/white.gif\"/><a href=\"http://www.kingcms.com/\" class=\"k_ajax\" rel=\"{CMD:'repass',METHOD:'GET'}\">" . $king->lang->get('system/install/resetpass') . "</a></p>\r\n\t<p><img class=\"j2 os\" src=\"system/images/white.gif\"/><a href=\"http://www.kingcms.com/\" class=\"k_ajax\" rel=\"{CMD:'delete'}\">" . $king->lang->get('system/install/delfile') . "</a></p>\r\n\t<p><img class=\"n1 os\" src=\"system/images/white.gif\"/><a href=\"system/login.php\">" . $king->lang->get('system/install/login') . "</a></p>\r\n\r\n</td></tr></table>\r\n\r\n</div>\r\n</body>\r\n</html>";
    exit($s);
}
示例#7
0
function king_def()
{
    global $king;
    //die(uc_user_synlogin(2));
    if ($GLOBALS['ismethod']) {
        //POST过程
        $data = $_POST;
    } else {
        $data = array('re' => kc_val($_SERVER, 'HTTP_REFERER'));
    }
    $data = kc_data(array('re', 'username', 'userpass', 'expire'));
    if ($king->config('blackuser', 'user')) {
        $array_black = explode('|', $king->config('blackuser', 'user'));
        $array_black = array_diff($array_black, array(null));
    } else {
        $array_black = array();
    }
    $s = $king->openForm('login.php');
    //username
    $_array = array(array('username', 0, 3, 15), array('username', 14, $king->lang->get('portal/check/reg/u-1'), array('*', '\\', ':', '?', '<', '>', '|', ';', ',', '\'', '!', '~', '$', '#', '@', '^', '(', ')', '{', '}', '=', '+', '%', '/')), array('username', 14, $king->lang->get('portal/check/reg/u-2'), $array_black));
    $s .= $king->htmForm($king->lang->get('portal/user/name'), '<input class="k_in w150" type="text" name="username" value="' . htmlspecialchars($data['username']) . '" maxlength="15" />', $_array, null, "<tt><a href=\"javascript:; \" class=\"k_user_register\">" . $king->lang->get('portal/user/reg') . "</a></tt>");
    //pass
    $_array = array(array('userpass', 0, 6, 30));
    if ($data['userpass'] && $GLOBALS['ischeck']) {
        //有密码 并 账号验证成功的时候进行验证
        $username = $data['username'];
        $is = False;
        if ($king->user->isuc) {
            //如果有UC
            if ($array_uc = uc_user_login($data['username'], $data['userpass'])) {
                //链接成功
                if ((int) $array_uc[0] < 0) {
                    //用户名不存在或密码错误
                    if ($res = $king->db->getRows_one("select usermail,userpass,ksalt,userid from %s_user where username='******' and uid=0")) {
                        //判断本地是否存在这个用户并且未同步到uc
                        $userid = $res['userid'];
                        if (md5($res['ksalt'] . $data['userpass']) == $res['userpass']) {
                            //检测密码
                            $uid = uc_user_register($username, $data['userpass'], $res['usermail']);
                            //注册用户到uc
                            $king->db->update('%s_user', array('lastlogindate' => time(), 'uid' => $uid > 0 ? $uid : 0), 'username=\'' . $king->db->escape($username . '\''));
                            uc_user_login($data['username'], $data['userpass']);
                        } else {
                            $is = True;
                            $errId = -2;
                        }
                    } else {
                        $is = True;
                        $errId = $array_uc[0];
                    }
                } else {
                    //登录成功的时候,检查一下本地是否有这个账号
                    $uid = $array_uc[0];
                    //UC中的UID
                    if ($res = $king->db->getRows_one("select userpass,ksalt,userid from %s_user where username='******'")) {
                        //如果有这么个账号
                        $userid = $res['userid'];
                        if (md5($res['ksalt'] . $data['userpass']) != $res['userpass']) {
                            //若不一致,则进行更新
                            $userpass = md5($res['ksalt'] . $data['userpass']);
                            $king->db->update('%s_user', array('userpass' => $userpass, 'lastlogindate' => time()), 'username=\'' . $king->db->escape($username . '\''));
                        } else {
                            $king->db->update('%s_user', array('lastlogindate' => time()), 'username=\'' . $king->db->escape($username . '\''));
                        }
                    } else {
                        //如果本地没有这个账号,则添加
                        $usermail = $array_uc[3];
                        $ksalt = kc_random(6);
                        $array = array('username' => $username, 'userpass' => md5($ksalt . $data['userpass']), 'usermail' => $usermail, 'ksalt' => $ksalt, 'uid' => $uid, 'regdate' => time(), 'lastlogindate' => time());
                        $king->db->insert('%s_user', $array);
                        $res = $king->db->getRows_one("select userid from %s_user where uid='" . $uid . "' and isdelete=0");
                        $userid = $res['userid'];
                    }
                }
            } else {
                kc_error($king->lang->get('portal/error/connect'));
                //连接错误
            }
        } else {
            //如果没有UC
            if ($res = $king->db->getRows_one("select userpass,ksalt,userid from %s_user where username='******' and isdelete=0")) {
                //如果有这么个账号
                $md5pass = md5($res['ksalt'] . $data['userpass']);
                //				kc_error($md5pass."\t".$res['userpass']);
                if ($md5pass != $res['userpass']) {
                    //若不一致,提示错误
                    $is = True;
                    $errId = -2;
                } else {
                    //验证通过
                    $userid = $res['userid'];
                    $king->db->update('%s_user', array('lastlogindate' => time()), 'userid=' . $userid);
                    //					$userpass=md5($res['ksalt'].$data['userpass']);
                }
            } else {
                $is = True;
                $errId = -1;
            }
        }
        if (!empty($errId)) {
            $_array[] = array('userpass', 12, $king->lang->get('portal/check/pwd/p' . $errId), $is);
        }
    }
    $s .= $king->htmForm($king->lang->get('portal/user/pass') . '', '<input class="k_in w150" type="password" name="userpass" maxlength="30" />', $_array, null, "<tt><a href=\"javascript:;\" class=\"k_user_lostpwd\">" . $king->lang->get('portal/user/lostpwd') . "</a></tt>");
    //expire
    $array_select = array(0 => $king->lang->get('system/time/cookie'), 86400 => $king->lang->get('system/time/oneday'), 2592000 => $king->lang->get('system/time/jan'), 15768000 => $king->lang->get('system/time/halfyear'), 31536000 => $king->lang->get('system/time/ayear'), 315360000 => $king->lang->get('system/time/forever'));
    $s .= $king->htmForm($king->lang->get('portal/user/expire'), kc_htm_radio('expire', $array_select, 2592000));
    //verify
    $verify = new KC_Verify_class();
    $s .= $verify->Show();
    $s .= kc_htm_hidden(array('re' => $data['re']));
    $s .= $king->closeForm($king->lang->get('system/common/login'));
    if ($GLOBALS['ischeck']) {
        //写Cookie
        $s = $king->user->userLogin($userid, $data['expire']);
        $array = array('<a href="/">' . $king->lang->get('portal/user/return/home') . '</a>', '<a href="index.php">' . $king->lang->get('portal/user/return/uc') . '</a>');
        if ($data['re']) {
            $array[] = '<a href="' . $data['re'] . '">' . $king->lang->get('portal/user/return/re') . ' : ' . $data['re'] . '</a>';
            $goto = $data['re'];
        } else {
            $goto = $king->config('inst') . 'user/index.php';
        }
        $s .= kc_htm_ol($king->lang->get('portal/user/loginok'), $array, $goto);
    }
    $tmp = new KC_Template_class($king->config('templateuser', 'user'), $king->config('templatepath') . '/inside/user/login.htm');
    $tmp->assign('main', $s);
    $tmp->assign('title', $king->lang->get('portal/title/login'));
    echo $tmp->output();
}