GetPassWordByGuid() public static method

获取加盐及二次加密的密码
public static GetPassWordByGuid ( string $ps, string $guid ) : string
$ps string 明文密码
$guid string 用户唯一码
return string
Ejemplo n.º 1
0
function PostMember()
{
    global $zbp;
    if (!isset($_POST['ID'])) {
        return;
    }
    if (!$zbp->CheckRights('MemberAll')) {
        unset($_POST['Level']);
        unset($_POST['Name']);
    }
    if (isset($_POST['Password'])) {
        if ($_POST['Password'] == '') {
            unset($_POST['Password']);
        } else {
            if (strlen($_POST['Password']) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($_POST['Password']) > $zbp->option['ZC_PASSWORD_MAX']) {
                $zbp->ShowError(54);
            }
            if (!CheckRegExp($_POST['Password'], '[password]')) {
                $zbp->ShowError(54);
            }
            $_POST['Password'] = Member::GetPassWordByGuid($_POST['Password'], $_POST['Guid']);
        }
    }
    if (isset($_POST['Name'])) {
        if (isset($zbp->membersbyname[$_POST['Name']])) {
            if ($zbp->membersbyname[$_POST['Name']]->ID != $_POST['ID']) {
                $zbp->ShowError(62);
            }
        }
    }
    if (isset($_POST['Alias'])) {
        $_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
    }
    $mem = new Member();
    if (GetVars('ID', 'POST') == 0) {
        if (isset($_POST['Password']) == false || $_POST['Password'] == '') {
            $zbp->ShowError(73);
        }
        $_POST['IP'] = GetGuestIP();
    } else {
        $mem->LoadInfoByID(GetVars('ID', 'POST'));
    }
    foreach ($zbp->datainfo['Member'] as $key => $value) {
        if ($key == 'ID') {
            continue;
        }
        if ($key == 'Meta') {
            continue;
        }
        if (isset($_POST[$key])) {
            $mem->{$key} = GetVars($key, 'POST');
        }
    }
    foreach ($GLOBALS['Filter_Plugin_PostMember_Core'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    FilterMember($mem);
    FilterMeta($mem);
    CountMember($mem);
    $mem->Save();
    foreach ($GLOBALS['Filter_Plugin_PostMember_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    if (isset($_POST['Password'])) {
        if ($mem->ID == $zbp->user->ID) {
            Redirect($zbp->host . 'zb_system/cmd.php?act=login');
        }
    }
    return true;
}
Ejemplo n.º 2
0
function InsertInfo()
{
    global $zbp;
    $zbp->guid = GetGuid();
    $mem = new Member();
    $guid = GetGuid();
    $mem->Guid = $guid;
    $mem->Level = 1;
    $mem->Name = GetVars('username', 'POST');
    $mem->Password = Member::GetPassWordByGuid(GetVars('password', 'POST'), $guid);
    $mem->IP = GetGuestIP();
    $mem->PostTime = time();
    $mem->Save();
    $cate = new Category();
    $cate->Name = $zbp->lang['msg']['uncategory'];
    $cate->Alias = 'uncategorized';
    $cate->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_navbar'];
    $t->FileName = "navbar";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = '<li id="nvabar-item-index"><a href="{#ZC_BLOG_HOST#}">' . $zbp->lang['zb_install']['index'] . '</a></li><li id="navbar-page-2"><a href="{#ZC_BLOG_HOST#}?id=2">' . $zbp->lang['zb_install']['guestbook'] . '</a></li>';
    $t->HtmlID = "divNavBar";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['calendar'];
    $t->FileName = "calendar";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divCalendar";
    $t->Type = "div";
    $t->IsHideTitle = true;
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['control_panel'];
    $t->FileName = "controlpanel";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<span class="cp-hello">' . $zbp->lang['zb_install']['wellcome'] . '</span><br/><span class="cp-login"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=login">' . $zbp->lang['msg']['admin_login'] . '</a></span>&nbsp;&nbsp;<span class="cp-vrs"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=misc&amp;type=vrs">' . $zbp->lang['msg']['view_rights'] . '</a></span>';
    $t->HtmlID = "divContorPanel";
    $t->Type = "div";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_catalog'];
    $t->FileName = "catalog";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divCatalog";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['search'];
    $t->FileName = "searchpanel";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<form name="search" method="post" action="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=search"><input type="text" name="q" size="11" /> <input type="submit" value="' . $zbp->lang['msg']['search'] . '" /></form>';
    $t->HtmlID = "divSearchPanel";
    $t->Type = "div";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_comments'];
    $t->FileName = "comments";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divComments";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_archives'];
    $t->FileName = "archives";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divArchives";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_statistics'];
    $t->FileName = "statistics";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divStatistics";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_favorite'];
    $t->FileName = "favorite";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://bbs.zblogcn.com/" target="_blank">ZBlogger社区</a></li><li><a href="http://app.zblogcn.com/" target="_blank">Z-Blog应用中心</a></li><li><a href="http://weibo.com/zblogcn" target="_blank">Z-Blog新浪官微</a></li><li><a href="http://t.qq.com/zblogcn" target="_blank">Z-Blog腾讯官微</a></li>';
    $t->HtmlID = "divFavorites";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_link'];
    $t->FileName = "link";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://www.dbshost.cn/" target="_blank" title="独立博客服务 Z-Blog官方主机">DBS主机</a></li>';
    $t->HtmlID = "divLinkage";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_misc'];
    $t->FileName = "misc";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://www.zblogcn.com/" target="_blank"><img src="{#ZC_BLOG_HOST#}zb_system/image/logo/zblog.gif" height="31" width="88" alt="RainbowSoft Studio Z-Blog" /></a></li><li><a href="{#ZC_BLOG_HOST#}feed.php" target="_blank"><img src="{#ZC_BLOG_HOST#}zb_system/image/logo/rss.png" height="31" width="88" alt="订阅本站的 RSS 2.0 新闻聚合" /></a></li>';
    $t->HtmlID = "divMisc";
    $t->Type = "ul";
    $t->IsHideTitle = true;
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_authors'];
    $t->FileName = "authors";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divAuthors";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_previous'];
    $t->FileName = "previous";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divPrevious";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_tags'];
    $t->FileName = "tags";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divTags";
    $t->Type = "ul";
    $t->Save();
    $a = new Post();
    $a->CateID = 1;
    $a->AuthorID = 1;
    $a->Tag = '';
    $a->Status = ZC_POST_STATUS_PUBLIC;
    $a->Type = ZC_POST_TYPE_ARTICLE;
    $a->Alias = '';
    $a->IsTop = false;
    $a->IsLock = false;
    $a->Title = $zbp->lang['zb_install']['hello_zblog'];
    $a->Intro = $zbp->lang['zb_install']['hello_zblog_content'];
    $a->Content = $zbp->lang['zb_install']['hello_zblog_content'];
    $a->IP = GetGuestIP();
    $a->PostTime = time();
    $a->CommNums = 0;
    $a->ViewNums = 0;
    $a->Template = '';
    $a->Meta = '';
    $a->Save();
    $a = new Post();
    $a->CateID = 0;
    $a->AuthorID = 1;
    $a->Tag = '';
    $a->Status = ZC_POST_STATUS_PUBLIC;
    $a->Type = ZC_POST_TYPE_PAGE;
    $a->Alias = '';
    $a->IsTop = false;
    $a->IsLock = false;
    $a->Title = $zbp->lang['zb_install']['guestbook'];
    $a->Intro = '';
    $a->Content = $zbp->lang['zb_install']['guestbook_content'];
    $a->IP = GetGuestIP();
    $a->PostTime = time();
    $a->CommNums = 0;
    $a->ViewNums = 0;
    $a->Template = '';
    $a->Meta = '';
    $a->Save();
    echo $zbp->lang['zb_install']['create_datainfo'] . "<br/>";
}
Ejemplo n.º 3
0
/**
 * 提交用户数据
 * @return bool
 */
function PostMember()
{
    global $zbp;
    $mem = new Member();
    $data = array();
    if (!isset($_POST['ID'])) {
        return false;
    }
    //检测密码
    if (trim($_POST["Password"]) == '' || trim($_POST["PasswordRe"]) == '' || $_POST["Password"] != $_POST["PasswordRe"]) {
        unset($_POST["Password"]);
        unset($_POST["PasswordRe"]);
    }
    $data['ID'] = $_POST['ID'];
    $editableField = array('Password', 'Email', 'HomePage', 'Alias', 'Intro', 'Template');
    // 如果是管理员,则再允许改动别的字段
    if ($zbp->CheckRights('MemberAll')) {
        array_push($editableField, 'Level', 'Status', 'Name', 'IP');
    } else {
        $data['ID'] = $zbp->user->ID;
    }
    // 复制一个新数组
    foreach ($editableField as $value) {
        if (isset($_POST[$value])) {
            $data[$value] = GetVars($value, 'POST');
        }
    }
    if (isset($data['Name'])) {
        // 检测同名
        if (isset($zbp->membersbyname[$data['Name']])) {
            if ($zbp->membersbyname[$data['Name']]->ID != $data['ID']) {
                $zbp->ShowError(62, __FILE__, __LINE__);
            }
        }
    }
    if (isset($data['Alias'])) {
        $data['Alias'] = TransferHTML($data['Alias'], '[noscript]');
    }
    if ($data['ID'] == 0) {
        if (!isset($data['Password']) || $data['Password'] == '') {
            $zbp->ShowError(73, __FILE__, __LINE__);
        }
        $data['IP'] = GetGuestIP();
    } else {
        $mem->LoadInfoByID($data['ID']);
    }
    foreach ($zbp->datainfo['Member'] as $key => $value) {
        if ($key == 'ID' || $key == 'Meta') {
            continue;
        }
        if (isset($data[$key])) {
            $mem->{$key} = $data[$key];
        }
    }
    // 然后,读入密码
    // 密码需要单独处理,因为拿不到用户Guid
    if (isset($data['Password'])) {
        if ($data['Password'] != '') {
            if (strlen($data['Password']) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($data['Password']) > $zbp->option['ZC_PASSWORD_MAX']) {
                $zbp->ShowError(54, __FILE__, __LINE__);
            }
            if (!CheckRegExp($data['Password'], '[password]')) {
                $zbp->ShowError(54, __FILE__, __LINE__);
            }
            $mem->Password = Member::GetPassWordByGuid($data['Password'], $mem->Guid);
        }
    }
    FilterMeta($mem);
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostMember_Core'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    FilterMember($mem);
    CountMember($mem);
    // 查询同名
    if (isset($data['Name'])) {
        if ($data['ID'] == 0) {
            if ($zbp->CheckMemberNameExist($data['Name'])) {
                $zbp->ShowError(62, __FILE__, __LINE__);
            }
        }
    }
    $mem->Save();
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostMember_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    $zbp->AddBuildModule('authors');
    if (isset($data['Password'])) {
        if ($mem->ID == $zbp->user->ID) {
            Redirect($zbp->host . 'zb_system/cmd.php?act=login');
        }
    }
    return true;
}
Ejemplo n.º 4
0
function convert_user_table($_prefix)
{
    global $zbp;
    $sql = $zbp->db->sql->Select($_prefix . 'users' . ',' . $_prefix . 'usermeta', array('*'), array(array('CUSTOM', $_prefix . 'users.ID=' . $_prefix . 'usermeta.user_id'), array('CUSTOM', $_prefix . 'usermeta.meta_key="wp_user_level"')), '', '', '');
    $array = $zbp->db->Query($sql);
    $zbp->db->Query('TRUNCATE `' . $zbp->table['Member'] . '`;');
    $isadmin = false;
    foreach ($array as $key => $value) {
        $amem = array();
        $guid = GetGuid();
        $amem['mem_ID'] = $value['ID'];
        $amem['mem_Guid'] = $guid;
        $amem['mem_Name'] = $value['user_login'];
        $amem['mem_Alias'] = $value['user_nicename'];
        $amem['mem_Email'] = $value['user_email'];
        $amem['mem_HomePage'] = $value['user_url'];
        $amem['mem_Password'] = Member::GetPassWordByGuid(GetGuid(), $guid);
        $amem['mem_PostTime'] = strtotime($value['user_registered']);
        $amem['mem_Level'] = 5;
        if ($value['meta_value'] == 10) {
            $amem['mem_Level'] = 1;
        }
        if ($value['meta_value'] == 7) {
            $amem['mem_Level'] = 2;
        }
        if ($value['meta_value'] == 2) {
            $amem['mem_Level'] = 3;
        }
        if ($value['meta_value'] == 1) {
            $amem['mem_Level'] = 4;
        }
        if ($value['meta_value'] == 0) {
            $amem['mem_Level'] = 5;
        }
        if ($isadmin == false && $amem['mem_Level'] == 1) {
            $amem['mem_Name'] = $zbp->user->Name;
            $amem['mem_Guid'] = $zbp->user->Guid;
            $amem['mem_Password'] = $zbp->user->Password;
            $isadmin = true;
        }
        $zbp->db->Query($zbp->db->sql->Insert($zbp->table['Member'], $amem));
    }
    return;
}
Ejemplo n.º 5
0
    die;
}
if (isset($zbp->membersbyname[$name])) {
    $zbp->ShowError('用户名已存在');
    die;
}
$member->Name = $name;
if (strlen($password) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($password) > $zbp->option['ZC_PASSWORD_MAX']) {
    $zbp->ShowError('密码必须在' . $zbp->option['ZC_PASSWORD_MIN'] . '位-' . $zbp->option['ZC_PASSWORD_MAX'] . '位间.');
    die;
}
if ($password != $repassword) {
    $zbp->ShowError('请核对密码.');
    die;
}
$member->Password = Member::GetPassWordByGuid($password, $invitecode);
$member->PostTime = time();
$member->IP = GetGuestIP();
if (strlen($email) < 5 || strlen($email) > $zbp->option['ZC_EMAIL_MAX']) {
    $zbp->ShowError('邮箱不能过长或过短.');
    die;
}
if (CheckRegExp($email, '[email]')) {
    $member->Email = $email;
} else {
    $zbp->ShowError('邮箱格式不正确.');
    die;
}
if (strlen($homepage) > $zbp->option['ZC_HOMEPAGE_MAX']) {
    $zbp->ShowError('网址不能过长.');
    die;