コード例 #1
0
ファイル: login.php プロジェクト: nukeplus/nuke
/**
 * opidr()
 *
 * @param mixed $openid_info
 * @return void
 */
function opidr($openid_info)
{
    global $lang_module, $nv_Request, $nv_redirect;
    $nv_Request->unset_request('openid_attribs', 'session');
    $openid_info['redirect'] = nv_redirect_decrypt($nv_redirect);
    $contents = openid_callback($openid_info);
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents, false);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
コード例 #2
0
ファイル: theme.php プロジェクト: nukeplus/shops
/**
 * redict_link()
 *
 * @param mixed $lang_view
 * @param mixed $lang_back
 * @param mixed $nv_redirect
 * @return
 */
function redict_link($lang_view, $lang_back, $nv_redirect)
{
    $contents = "<div class=\"frame\">";
    $contents .= $lang_view . "<br /><br />\n";
    $contents .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . NV_ASSETS_DIR . "/images/load_bar.gif\"><br /><br />\n";
    $contents .= "<a href=\"" . $nv_redirect . "\">" . $lang_back . "</a>";
    $contents .= "</div>";
    $contents .= "<meta http-equiv=\"refresh\" content=\"2;url=" . $nv_redirect . "\" />";
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
コード例 #3
0
ファイル: main.php プロジェクト: nukeplus/nuke
                $item['imghome'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $item['homeimgfile'];
            } elseif ($item['homeimgthumb'] == 2) {
                //image file
                $item['imghome'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $item['homeimgfile'];
            } elseif ($item['homeimgthumb'] == 3) {
                //image url
                $item['imghome'] = $item['homeimgfile'];
            } elseif (!empty($show_no_image)) {
                //no image
                $item['imghome'] = NV_BASE_SITEURL . $show_no_image;
            } else {
                $item['imghome'] = '';
            }
            $item['newday'] = $global_array_cat[$item['catid']]['newday'];
            $item['link'] = $global_array_cat[$item['catid']]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl'];
            $array_catpage[] = $item;
        }
        $viewcat = 'viewcat_list_new';
        $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
        $contents = call_user_func($viewcat, $array_catpage, 0, ($page - 1) * $per_page, $generate_page);
    }
    if (!defined('NV_IS_MODADMIN') and $contents != '' and $cache_file != '') {
        $nv_Cache->setItem($module_name, $cache_file, $contents);
    }
}
if ($page > 1) {
    $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
}
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
コード例 #4
0
ファイル: login.php プロジェクト: lzhao18/nukeviet
/**
 * openidLogin_Res1()
 * Function thuc hien khi OpenID duoc nhan dien
 *
 * @param mixed $attribs
 * @return
 */
function openidLogin_Res1($attribs)
{
    global $page_title, $key_words, $mod_title, $db, $crypt, $nv_Request, $lang_module, $lang_global, $module_name, $module_info, $global_config, $gfx_chk, $nv_redirect, $op, $db_config;
    $email = (isset($attribs['contact/email']) and nv_check_valid_email($attribs['contact/email']) == '') ? $attribs['contact/email'] : '';
    if (empty($email)) {
        $nv_Request->unset_request('openid_attribs', 'session');
        openidLogin_Res0($lang_module['logged_in_failed']);
        die;
    }
    $opid = $crypt->hash($attribs['id']);
    $current_mode = isset($attribs['current_mode']) ? $attribs['current_mode'] : 1;
    $stmt = $db->prepare('SELECT a.userid AS uid, a.email AS uemail, b.active AS uactive FROM ' . NV_USERS_GLOBALTABLE . '_openid a, ' . NV_USERS_GLOBALTABLE . ' b
		WHERE a.opid= :opid
		AND a.email= :email
		AND a.userid=b.userid');
    $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
    $stmt->bindParam(':email', $email, PDO::PARAM_STR);
    $stmt->execute();
    list($user_id, $op_email, $user_active) = $stmt->fetch(3);
    if ($user_id) {
        $nv_Request->unset_request('openid_attribs', 'session');
        if ($op_email != $email) {
            openidLogin_Res0($lang_module['not_logged_in']);
            die;
        }
        if (!$user_active) {
            openidLogin_Res0($lang_module['login_no_active']);
            die;
        }
        if (defined('NV_IS_USER_FORUM') and file_exists(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/set_user_login.php')) {
            require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/set_user_login.php';
            if (defined('NV_IS_USER_LOGIN_FORUM_OK')) {
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            } else {
                $nv_redirect = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            }
        } else {
            $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $user_id;
            $row = $db->query($query)->fetch();
            if (!empty($row)) {
                validUserLog($row, 1, $opid, $current_mode);
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            } else {
                $nv_redirect = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            }
        }
        Header('Location: ' . nv_url_rewrite($nv_redirect, true));
        die;
    }
    $stmt = $db->prepare('SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE email= :email');
    $stmt->bindParam(':email', $email, PDO::PARAM_STR);
    $stmt->execute();
    $nv_row = $stmt->fetch();
    if (!empty($nv_row)) {
        $login_allowed = false;
        if (empty($nv_row['password'])) {
            $nv_Request->unset_request('openid_attribs', 'session');
            $login_allowed = true;
        }
        if ($nv_Request->isset_request('openid_account_confirm', 'post')) {
            $password = $nv_Request->get_string('password', 'post', '');
            $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
            $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
            $nv_Request->unset_request('openid_attribs', 'session');
            if (defined('NV_IS_USER_FORUM') and file_exists(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php')) {
                $nv_username = $nv_row['username'];
                $nv_password = $password;
                require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
                if (empty($error)) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            } else {
                if ($crypt->validate_password($password, $nv_row['password']) and $nv_seccode) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            }
        }
        if ($login_allowed) {
            $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($nv_row['userid']) . ', :server, :opid, :email )');
            $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
            $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
            $stmt->bindParam(':email', $email, PDO::PARAM_STR);
            $stmt->execute();
            if (intval($nv_row['active']) != 1) {
                openidLogin_Res0($lang_module['login_no_active']);
            } else {
                validUserLog($nv_row, 1, $opid, $current_mode);
                Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
            }
            die;
        }
        $page_title = $lang_module['openid_login'];
        $key_words = $module_info['keywords'];
        $mod_title = $lang_module['openid_login'];
        $lang_module['login_info'] = sprintf($lang_module['openid_confirm_info'], $email);
        $contents = openid_account_confirm($gfx_chk, $attribs);
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents);
        include NV_ROOTDIR . '/includes/footer.php';
        exit;
    }
    if ($global_config['allowuserreg'] == 2 or $global_config['allowuserreg'] == 3) {
        $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE email= :email';
        if ($global_config['allowuserreg'] == 2) {
            $query .= ' AND regdate>' . (NV_CURRENTTIME - 86400);
        }
        $stmt = $db->prepare($query);
        $stmt->bindParam(':email', $email, PDO::PARAM_STR);
        $stmt->execute();
        $row = $stmt->fetch();
        if (!empty($row)) {
            if ($global_config['allowuserreg'] == 2) {
                if ($nv_Request->isset_request('openid_active_confirm', 'post')) {
                    $nv_Request->unset_request('openid_attribs', 'session');
                    $password = $nv_Request->get_string('password', 'post', '');
                    $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
                    $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
                    if ($crypt->validate_password($password, $row['password']) and $nv_seccode) {
                        $reg_attribs = set_reg_attribs($attribs);
                        $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . " (\n\t\t\t\t\t\t\tusername, md5username, password, email, first_name, last_name, gender, photo, birthday, regdate,\n\t\t\t\t\t\t\tquestion, answer, passlostkey, view_mail, remember, in_groups,\n\t\t\t\t\t\t\tactive, checknum, last_login, last_ip, last_agent, last_openid, idsite) VALUES (\n\t\t\t\t\t\t\t:username,\n\t\t\t\t\t\t\t:md5username,\n\t\t\t\t\t\t\t:password,\n\t\t\t\t\t\t\t:email,\n\t\t\t\t\t\t\t:first_name,\n\t\t\t\t\t\t\t:last_name,\n\t\t\t\t\t\t\t:gender,\n\t\t\t\t\t\t\t'', 0,\n\t\t\t\t\t\t\t:regdate,\n\t\t\t\t\t\t\t:question,\n\t\t\t\t\t\t\t:answer,\n\t\t\t\t\t\t\t'', 1, 1, '', 1, '', 0, '', '', '', " . $global_config['idsite'] . ")";
                        $data_insert = array();
                        $data_insert['username'] = $row['username'];
                        $data_insert['md5username'] = nv_md5safe($row['username']);
                        $data_insert['password'] = $row['password'];
                        $data_insert['email'] = $row['email'];
                        $data_insert['first_name'] = $row['first_name'];
                        $data_insert['last_name'] = $row['last_name'];
                        $data_insert['gender'] = $reg_attribs['gender'];
                        $data_insert['regdate'] = $row['regdate'];
                        $data_insert['question'] = $row['question'];
                        $data_insert['answer'] = $row['answer'];
                        $userid = $db->insert_id($sql, 'userid', $data_insert);
                        if (!$userid) {
                            openidLogin_Res0($lang_module['account_active_error']);
                            die;
                        }
                        $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
                        $stmt = $db->prepare('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE userid= :userid');
                        $stmt->bindParam(':userid', $row['userid'], PDO::PARAM_STR);
                        $stmt->execute();
                        $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . $userid . ', :server, :opid, :email )');
                        $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
                        $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
                        $stmt->bindParam(':email', $email, PDO::PARAM_STR);
                        $stmt->execute();
                        $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $userid;
                        $result = $db->query($query);
                        $row = $result->fetch();
                        validUserLog($row, 1, $opid, $current_mode);
                        $info = $lang_module['account_active_ok'] . "<br /><br />\n";
                        $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                        $info .= '[<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '">' . $lang_module['redirect_to_home'] . '</a>]';
                        $contents = user_info_exit($info);
                        $contents .= '<meta http-equiv="refresh" content="2;url=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true) . '" />';
                        include NV_ROOTDIR . '/includes/header.php';
                        echo nv_site_theme($contents);
                        include NV_ROOTDIR . '/includes/footer.php';
                        exit;
                    } else {
                        openidLogin_Res0($lang_module['openid_confirm_failed']);
                        die;
                    }
                }
                $page_title = $mod_title = $lang_module['openid_activate_account'];
                $key_words = $module_info['keywords'];
                $lang_module['login_info'] = sprintf($lang_module['openid_active_confirm_info'], $email);
                $contents = openid_active_confirm($gfx_chk, $attribs);
                include NV_ROOTDIR . '/includes/header.php';
                echo nv_site_theme($contents);
                include NV_ROOTDIR . '/includes/footer.php';
                exit;
            } else {
                $nv_Request->unset_request('openid_attribs', 'session');
                openidLogin_Res0($lang_module['account_register_to_admin']);
                die;
            }
        }
    }
    $option = $nv_Request->get_int('option', 'get', 0);
    if (!$global_config['allowuserreg']) {
        $option = 3;
    }
    $contents = '';
    $page_title = $lang_module['openid_login'];
    if ($option == 3) {
        $error = '';
        if ($nv_Request->isset_request('nv_login', 'post')) {
            $nv_username = $nv_Request->get_title('nv_login', 'post', '', 1);
            $nv_password = $nv_Request->get_title('nv_password', 'post', '');
            $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
            $check_seccode = !$gfx_chk ? true : (nv_capcha_txt($nv_seccode) ? true : false);
            if (!$check_seccode) {
                $error = $lang_global['securitycodeincorrect'];
            } elseif (empty($nv_username)) {
                $error = $lang_global['username_empty'];
            } elseif (empty($nv_password)) {
                $error = $lang_global['password_empty'];
            } else {
                if (defined('NV_IS_USER_FORUM')) {
                    require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
                } else {
                    $error = $lang_global['loginincorrect'];
                    $sql = "SELECT * FROM " . NV_USERS_GLOBALTABLE . " WHERE md5username ='******'";
                    $row = $db->query($sql)->fetch();
                    if (!empty($row)) {
                        if ($row['username'] == $nv_username and $crypt->validate($nv_password, $row['password'])) {
                            if (!$row['active']) {
                                $error = $lang_module['login_no_active'];
                            } else {
                                $error = '';
                                $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($row['userid']) . ', :server, :opid, :email )');
                                $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
                                $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
                                $stmt->bindParam(':email', $email, PDO::PARAM_STR);
                                $stmt->execute();
                                validUserLog($row, 1, $opid);
                            }
                        }
                    }
                }
            }
            if (empty($error)) {
                $nv_Request->unset_request('openid_attribs', 'session');
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
                $info = $lang_module['login_ok'] . "<br /><br />\n";
                $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                $info .= '[<a href="' . $nv_redirect . '">' . $lang_module['redirect_to_back'] . '</a>]';
                $contents .= user_info_exit($info);
                $contents .= '<meta http-equiv="refresh" content="2;url=' . nv_url_rewrite($nv_redirect, true) . '" />';
                include NV_ROOTDIR . '/includes/header.php';
                echo nv_site_theme($contents);
                include NV_ROOTDIR . '/includes/footer.php';
                exit;
            }
            $array_login = array('nv_login' => $nv_username, 'nv_password' => $nv_password, 'nv_redirect' => $nv_redirect, 'login_info' => '<span style="color:#fb490b;">' . $error . '</span>');
        } else {
            $array_login = array('nv_login' => '', 'nv_password' => '', 'login_info' => $lang_module['openid_note1'], 'nv_redirect' => $nv_redirect);
        }
        $contents .= user_openid_login($gfx_chk, $array_login, $attribs);
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents);
        include NV_ROOTDIR . '/includes/footer.php';
        exit;
    } elseif ($option == 1 or $option == 2) {
        $nv_Request->unset_request('openid_attribs', 'session');
        $reg_attribs = set_reg_attribs($attribs);
        if (empty($reg_attribs['username'])) {
            openidLogin_Res0($lang_module['logged_in_failed']);
            die;
        }
        if ($option == 2) {
            // Dang nhap bang mot tai khoan do he thong tao tu dong
            $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . "\n\t\t\t\t(username, md5username, password, email, first_name, last_name, gender, photo, birthday,  regdate,\n\t\t\t\tquestion, answer, passlostkey, view_mail, remember, in_groups,\n\t\t\t\tactive, checknum, last_login, last_ip, last_agent, last_openid, idsite)  VALUES (\n\t\t\t\t:username,\n\t\t\t\t:md5username,\n\t\t\t\t'',\n\t\t\t\t:email,\n\t\t\t\t:first_name,\n\t\t\t\t:last_name,\n\t\t\t\t:gender,\n\t\t\t\t'', 0,\n\t\t\t\t" . NV_CURRENTTIME . ",\n\t\t\t\t'', '', '', 0, 0, '', 1, '', 0, '', '', '', " . intval($global_config['idsite']) . "\n\t\t\t)";
            $data_insert = array();
            $data_insert['username'] = $reg_attribs['username'];
            $data_insert['md5username'] = nv_md5safe($reg_attribs['username']);
            $data_insert['email'] = $reg_attribs['email'];
            $data_insert['first_name'] = $reg_attribs['first_name'];
            $data_insert['last_name'] = $reg_attribs['last_name'];
            $data_insert['gender'] = ucfirst($reg_attribs['gender'] ? $reg_attribs['gender'][0] : 'N');
            $userid = $db->insert_id($sql, 'userid', $data_insert);
            if (!$userid) {
                openidLogin_Res0($lang_module['err_no_save_account']);
                die;
            }
            // Cap nhat so thanh vien
            $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
            $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $userid . ' AND active=1';
            $result = $db->query($query);
            $row = $result->fetch();
            $result->closeCursor();
            // Luu vao bang thong tin tuy chinh
            $query_field = array();
            $query_field['userid'] = $userid;
            $result_field = $db->query('SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_field ORDER BY fid ASC');
            while ($row_f = $result_field->fetch()) {
                $query_field[$row_f['field']] = $db->quote($row_f['default_value']);
            }
            $db->query('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_info (' . implode(', ', array_keys($query_field)) . ') VALUES (' . implode(', ', array_values($query_field)) . ')');
            // Luu vao bang OpenID
            $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($row['userid']) . ', :server, :opid , :email)');
            $stmt->bindParam(':server', $reg_attribs['server'], PDO::PARAM_STR);
            $stmt->bindParam(':opid', $reg_attribs['opid'], PDO::PARAM_STR);
            $stmt->bindParam(':email', $reg_attribs['email'], PDO::PARAM_STR);
            $stmt->execute();
            validUserLog($row, 1, $reg_attribs['opid'], $current_mode);
            $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            Header('Location: ' . nv_url_rewrite($nv_redirect, true));
            exit;
        } else {
            $reg_attribs = serialize($reg_attribs);
            $nv_Request->set_Session('reg_attribs', $reg_attribs);
            Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=register&openid=1&nv_redirect=' . $nv_redirect, true));
            exit;
        }
    }
    $array_user_login = array();
    if (!defined('NV_IS_USER_FORUM')) {
        $array_user_login[] = array('title' => $lang_module['openid_note3'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=1&amp;nv_redirect=' . $nv_redirect);
        $array_user_login[] = array('title' => $lang_module['openid_note4'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=2&amp;nv_redirect=' . $nv_redirect);
    } else {
        $array_user_login[] = array('title' => $lang_module['openid_note6'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=register&amp;nv_redirect=' . $nv_redirect);
    }
    $array_user_login[] = array('title' => $lang_module['openid_note5'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=3&amp;nv_redirect=' . $nv_redirect);
    $page_title = $lang_module['openid_login'];
    $key_words = $module_info['keywords'];
    $mod_title = $lang_module['openid_login'];
    $contents .= user_openid_login2($attribs, $array_user_login);
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
コード例 #5
0
ファイル: index.php プロジェクト: NukeVietCMS/CodeWeb
            nv_chmod_dir($conn_id, NV_UPLOADS_DIR, true);
            ftp_chmod($conn_id, 0644, NV_CONFIG_FILENAME);
            ftp_close($conn_id);
        } else {
            @rename(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_CONFIG_FILENAME, NV_ROOTDIR . '/' . NV_CONFIG_FILENAME);
        }
    }
    if (file_exists(NV_ROOTDIR . '/' . NV_CONFIG_FILENAME)) {
        $finish = 1;
    } else {
        $finish = 2;
    }
    $title = $lang_module['done'];
    $contents = nv_step_7($finish);
}
echo nv_site_theme($step, $title, $contents);
function nv_save_file_config()
{
    global $nv_Request, $file_config_temp, $db_config, $global_config, $step;
    if (is_writable(NV_ROOTDIR . '/' . $file_config_temp) or is_writable(NV_ROOTDIR . '/' . NV_TEMP_DIR)) {
        $global_config['cookie_prefix'] = (empty($global_config['cookie_prefix']) or $global_config['cookie_prefix'] == 'nv4') ? 'nv4c_' . nv_genpass(5) : $global_config['cookie_prefix'];
        $global_config['session_prefix'] = (empty($global_config['session_prefix']) or $global_config['session_prefix'] == 'nv4') ? 'nv4s_' . nv_genpass(6) : $global_config['session_prefix'];
        $global_config['site_email'] = !isset($global_config['site_email']) ? '' : $global_config['site_email'];
        $db_config['dbhost'] = !isset($db_config['dbhost']) ? 'localhost' : $db_config['dbhost'];
        $db_config['dbport'] = !isset($db_config['dbport']) ? '' : $db_config['dbport'];
        $db_config['dbname'] = !isset($db_config['dbname']) ? '' : $db_config['dbname'];
        $db_config['dbuname'] = !isset($db_config['dbuname']) ? '' : $db_config['dbuname'];
        $db_config['dbsystem'] = isset($db_config['dbsystem']) ? $db_config['dbsystem'] : $db_config['dbuname'];
        $db_config['dbpass'] = !isset($db_config['dbpass']) ? '' : $db_config['dbpass'];
        $db_config['prefix'] = !isset($db_config['prefix']) ? 'nv4' : $db_config['prefix'];
        $db_config['charset'] = strstr($db_config['collation'], '_', true);
コード例 #6
0
ファイル: avatar.php プロジェクト: anhtunguyen/vietnamguide
        // Storage in temp dir
        $upload_info = $upload->save_file($_FILES['image_file'], NV_ROOTDIR . '/' . NV_TEMP_DIR, false);
        // Delete upload tmp
        @unlink($_FILES['image_file']['tmp_name']);
        if (empty($upload_info['error'])) {
            $basename = $upload_info['basename'];
            $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . nv_genpass(8) . "_" . $user_info['userid'] . '\\2', $basename);
            $image = new image($upload_info['name'], NV_MAX_WIDTH, NV_MAX_HEIGHT);
            // Resize image, crop image
            $image->resizeXY($array['w'], $array['h']);
            $image->cropFromLeft($array['x1'], $array['y1'], $array['avatar_width'], $array['avatar_height']);
            $image->resizeXY($global_config['avatar_width'], $global_config['avatar_height']);
            // Save new image
            $image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
            $image->close();
            if (file_exists($image->create_Image_info['src'])) {
                $array['success'] = true;
                $array['filename'] = str_replace(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/', '', $image->create_Image_info['src']);
            } else {
                $array['error'] = $lang_module['avata_error_save'];
            }
            @nv_deletefile($upload_info['name']);
        } else {
            $array['error'] = $upload_info['error'];
        }
    }
}
$contents = nv_avatar($array);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents, false);
include NV_ROOTDIR . '/includes/footer.php';
コード例 #7
0
ファイル: editinfo.php プロジェクト: nukeplus/nuke
function opidr($openid_info)
{
    global $lang_module;
    if ($openid_info == 1) {
        $openid_info = array('status' => 'error', 'mess' => $lang_module['canceled_authentication']);
    } elseif ($openid_info == 2) {
        $openid_info = array('status' => 'error', 'mess' => $lang_module['not_logged_in']);
    } elseif ($openid_info == 3) {
        $openid_info = array('status' => 'error', 'mess' => $lang_module['logged_in_failed']);
    } elseif ($openid_info == 4) {
        $openid_info = array('status' => 'error', 'mess' => $lang_module['openid_is_exists']);
    } elseif ($openid_info == 5 or $openid_info == 6) {
        $openid_info = array('status' => 'error', 'mess' => $lang_module['email_is_exists']);
    } else {
        $openid_info = array('status' => 'success', 'mess' => $lang_module['openid_added']);
    }
    $contents = openid_callback($openid_info);
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents, false);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
コード例 #8
0
ファイル: theme.php プロジェクト: hoangvtien/module-nvform
/**
 * nv_theme_nvform_alert()
 *
 * @param mixed $message
 * @param mixed $type
 * @return
 */
function nv_theme_nvform_alert($message_title, $message_content, $type = 'info', $link_back = '', $time_back = 0)
{
    global $module_file, $module_info, $page_title;
    $xtpl = new XTemplate('info.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    if ($type == 'success') {
        $class = 'class="alert alert-success"';
    } elseif ($type == 'warning') {
        $class = 'class="alert alert-warning"';
    } elseif ($type == 'danger') {
        $class = 'class="alert alert-danger"';
    } else {
        $class = 'class="alert alert-info"';
    }
    if (!empty($message_title)) {
        $page_title = $message_title;
        $xtpl->assign('TITLE', $message_title);
        $xtpl->parse('main.title');
    } else {
        $page_title = $module_info['custom_title'];
    }
    $xtpl->assign('CONTENT', $message_content);
    $xtpl->assign('CLASS', $class);
    $xtpl->parse('main');
    $contents = $xtpl->text('main');
    include NV_ROOTDIR . "/includes/header.php";
    echo nv_site_theme($contents);
    include NV_ROOTDIR . "/includes/footer.php";
    exit;
}
コード例 #9
0
ファイル: main.php プロジェクト: lzhao18/nukeviet
                    $global_config['mudim_active'] = $array_op[2];
                    $base_url_rewrite .= '/' . $array_op[2];
                }
            }
        }
        $base_url_rewrite = nv_url_rewrite($base_url_rewrite, true);
        if ($_SERVER['REQUEST_URI'] == $base_url_rewrite) {
            $canonicalUrl = NV_MAIN_DOMAIN . $base_url_rewrite;
        } elseif (NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
            Header('Location: ' . $base_url_rewrite);
            die;
        } else {
            $canonicalUrl = $base_url_rewrite;
        }
    }
}
$bodytext = '';
if (isset($array_department[$fpart]) and !empty($array_department[$fpart]['note'])) {
    $bodytext = $array_department[$fpart]['note'];
} elseif (isset($module_config[$module_name]['bodytext'])) {
    $bodytext = $module_config[$module_name]['bodytext'];
}
if (!empty($bodytext)) {
    $lang_module['note'] = $bodytext;
}
$array_content = array('error' => $error, 'fpart' => $fpart, 'fname' => $fname, 'femail' => $femail, 'fcon' => $fcon, 'ftitle' => $ftitle, 'fphone' => $fphone);
$checkss = md5($client_info['session_id'] . $global_config['sitekey']);
$contents = contact_main_theme($array_content, $array_department, $base_url, $checkss);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents, $full);
include NV_ROOTDIR . '/includes/footer.php';
コード例 #10
0
ファイル: savefile.php プロジェクト: nukeplus/nuke
            $meta_tags = nv_html_meta_tags();
            $content['bodytext'] = $db_slave->query('SELECT bodyhtml FROM ' . NV_PREFIXLANG . '_' . $module_data . '_bodyhtml_' . ceil($content['id'] / 2000) . ' where id=' . $content['id'])->fetchColumn();
            $result = array('url' => $global_config['site_url'], 'meta_tags' => $meta_tags, 'sitename' => $global_config['site_name'], 'title' => $content['title'], 'alias' => $content['alias'], 'image' => '', 'position' => $content['imgposition'], 'time' => nv_date('l - d/m/Y H:i', $content['publtime']), 'status' => $content['status'], 'hometext' => $content['hometext'], 'bodytext' => $content['bodytext'], 'copyright' => $content['copyright'], 'copyvalue' => $module_config[$module_name]['copyright'], 'link' => "<a href=\"" . NV_MY_DOMAIN . $base_url_rewrite . "\" title=\"" . $content['title'] . "\">" . NV_MY_DOMAIN . $base_url_rewrite . "</a>\n", 'contact' => $global_config['site_email'], 'author' => $content['author'], 'source' => $sourcetext);
            $page_title = $result['title'];
            if (!empty($content['homeimgfile']) and $content['imgposition'] > 0) {
                $src = $alt = $note = '';
                $width = $height = 0;
                if ($content['homeimgthumb'] == 1 and $content['imgposition'] == 1 and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload . '/' . $content['homeimgfile'])) {
                    $src = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
                    $width = $module_config[$module_name]['homewidth'];
                } elseif ($content['homeimgthumb'] == 3) {
                    $src = $content['homeimgfile'];
                    $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
                } elseif (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $content['homeimgfile'])) {
                    $src = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
                    $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
                }
                $alt = empty($content['homeimgalt']) ? $content['title'] : $content['homeimgalt'];
                $result['image'] = array('src' => $src, 'width' => $width, 'alt' => $alt, 'note' => $content['homeimgalt'], 'position' => $content['imgposition']);
            }
            $contents = call_user_func('news_print', $result);
            header("Content-Type: text/x-delimtext; name=\"" . $result['alias'] . ".html\"");
            header("Content-disposition: attachment; filename=" . $result['alias'] . ".html");
            include NV_ROOTDIR . '/includes/header.php';
            echo preg_replace_callback("/(src|href)\\=\"([^\"]+)\"/", "nv_src_href_callback", nv_url_rewrite(nv_site_theme($contents, false)));
            include NV_ROOTDIR . '/includes/footer.php';
        }
    }
}
header('Location: ' . $global_config['site_url']);
exit;
コード例 #11
0
        }
        $ratingdetail = array_map("intval", explode("|", $news_contents['ratingdetail']));
        $ratingdetail[0] = isset($ratingdetail[0]) ? intval($ratingdetail[0]) : 0;
        $ratingdetail[1] = isset($ratingdetail[1]) ? intval($ratingdetail[1]) : 0;
        $news_contents['stringrating'] = sprintf($lang_module['stringrating'], $ratingdetail[0], $ratingdetail[1]);
        $ratingdetail[1] = $ratingdetail[1] > 0 ? $ratingdetail[1] : 1;
        $news_contents['numberrating'] = round($ratingdetail[0] / $ratingdetail[1]) - 1;
        $news_contents['langstar'] = array("note" => $lang_module['star_note'], "verypoor" => $lang_module['star_verypoor'], "poor" => $lang_module['star_poor'], "ok" => $lang_module['star_ok'], "good" => $lang_module['star_good}'], "verygood" => $lang_module['star_verygood']);
    }
    $page_title = $news_contents['title'];
    $key_words = $news_contents['keywords'];
    $description = $news_contents['hometext'];
    if (empty($news_contents['author'])) {
        $sql = $db->sql_query(" SELECT `username`, `full_name` FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid` = '" . $news_contents['admin_id'] . "' LIMIT 0,1 ");
        $chk_u = $db->sql_numrows($sql);
        if ($chk_u) {
            list($row) = $db->sql_fetchrowset($sql);
        }
        $news_contents['author_name'] = empty($row['full_name']) ? $row['username'] : $row['full_name'];
    } else {
        $news_contents['author_name'] = $news_contents['author'];
    }
    $contents = detail_theme($news_contents, $related_new_array, $related_array, $topic_array, $commentenable);
} else {
    $contents = no_permission($func_who_view);
}
include NV_ROOTDIR . "/includes/header.php";
$results = nv_site_theme($contents);
// new dBug($results);
echo $results;
include NV_ROOTDIR . "/includes/footer.php";
コード例 #12
0
ファイル: theme.php プロジェクト: hongoctrien/nukeviet
/**
 * user_info_exit_redirect()
 *
 * @param mixed $info
 * @param mixed $nv_redirect
 * @return void
 */
function user_info_exit_redirect($info, $nv_redirect)
{
    global $module_info, $module_file, $lang_module;
    $xtpl = new XTemplate('info_exit_redirect.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('INFO', $info);
    $xtpl->assign('NV_REDIRECT', $nv_redirect);
    $xtpl->parse('main');
    $contents = $xtpl->text('main');
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
}
コード例 #13
0
/**
 * nv_theme_alert()
 *
 * @param mixed $message_title
 * @param mixed $message_content
 * @param mixed $type
 * @param mixed $url_back
 * @param mixed $time_back
 * @return
 */
function nv_theme_alert($message_title, $message_content, $type = 'info', $url_back = '', $time_back = 5, $lang_back = true)
{
    global $module_file, $module_info, $lang_module, $page_title;
    $xtpl = new XTemplate('alert.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('CONTENT', $message_content);
    if ($type == 'success') {
        $xtpl->parse('main.success');
    } elseif ($type == 'warning') {
        $xtpl->parse('main.warning');
    } elseif ($type == 'danger') {
        $xtpl->parse('main.danger');
    } else {
        $xtpl->parse('main.info');
    }
    if (!empty($message_title)) {
        $page_title = $message_title;
        $xtpl->assign('TITLE', $message_title);
        $xtpl->parse('main.title');
    } else {
        $page_title = $module_info['custom_title'];
    }
    if (!empty($url_back)) {
        $xtpl->assign('TIME', $time_back);
        $xtpl->assign('URL', $url_back);
        $xtpl->parse('main.url_back');
        if ($lang_back) {
            $xtpl->parse('main.url_back_button');
        }
    }
    $xtpl->parse('main');
    $contents = $xtpl->text('main');
    include NV_ROOTDIR . "/includes/header.php";
    echo nv_site_theme($contents);
    include NV_ROOTDIR . "/includes/footer.php";
    exit;
}
コード例 #14
0
ファイル: login.php プロジェクト: syphuonglam/creative-portal
/**
 * openidLogin_Res1()
 * Function thuc hien khi OpenID duoc nhan dien
 * 
 * @param mixed $attribs
 * @return
 */
function openidLogin_Res1($attribs)
{
    global $page_title, $key_words, $mod_title, $db, $crypt, $nv_Request, $lang_module, $lang_global, $module_name, $module_info, $global_config, $gfx_chk, $nv_redirect;
    $email = (isset($attribs['contact/email']) and nv_check_valid_email($attribs['contact/email']) == "") ? $attribs['contact/email'] : "";
    if (empty($email)) {
        $nv_Request->unset_request('openid_attribs', 'session');
        openidLogin_Res0($lang_module['logged_in_failed']);
        die;
    }
    $opid = $crypt->hash($attribs['id']);
    $query = "SELECT a.userid AS uid, a.email AS uemail, b.active AS uactive FROM `" . NV_USERS_GLOBALTABLE . "_openid` a, `" . NV_USERS_GLOBALTABLE . "` b \r\n    WHERE a.opid=" . $db->dbescape($opid) . " \r\n    AND a.email=" . $db->dbescape($email) . " \r\n    AND a.userid=b.userid";
    $result = $db->sql_query($query);
    $numrows = $db->sql_numrows($result);
    if ($numrows) {
        list($user_id, $op_email, $user_active) = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        $nv_Request->unset_request('openid_attribs', 'session');
        if ($op_email != $email) {
            openidLogin_Res0($lang_module['not_logged_in']);
            die;
        }
        if (!$user_active) {
            openidLogin_Res0($lang_module['login_no_active']);
            die;
        }
        $query = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid`=" . $db->dbescape($user_id);
        $result = $db->sql_query($query);
        $row = $db->sql_fetchrow($result);
        validUserLog($row, 1, $opid);
        $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name;
        Header("Location: " . $nv_redirect);
        die;
    }
    $query = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `email`=" . $db->dbescape($email);
    $result = $db->sql_query($query);
    $numrows = $db->sql_numrows($result);
    if ($numrows) {
        $nv_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        $login_allowed = false;
        if (empty($nv_row['password'])) {
            $nv_Request->unset_request('openid_attribs', 'session');
            $login_allowed = true;
        }
        if ($nv_Request->isset_request('openid_account_confirm', 'post')) {
            $nv_Request->unset_request('openid_attribs', 'session');
            if (defined('NV_IS_USER_FORUM') and file_exists(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php')) {
                $nv_username = $nv_row['username'];
                $nv_password = $password;
                require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
                if (empty($error)) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            } else {
                $password = $nv_Request->get_string('password', 'post', '');
                $nv_seccode = filter_text_input('nv_seccode', 'post', '');
                $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
                if ($crypt->validate($password, $nv_row['password']) and $nv_seccode) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            }
        }
        if ($login_allowed) {
            $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_openid` VALUES (" . intval($nv_row['userid']) . ", " . $db->dbescape($attribs['id']) . ", " . $db->dbescape($opid) . ", " . $db->dbescape($email) . ")";
            $db->sql_query($sql);
            if (intval($nv_row['active']) != 1) {
                openidLogin_Res0($lang_module['login_no_active']);
            } else {
                validUserLog($nv_row, 1, $opid);
                Header("Location: " . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name);
            }
            die;
        }
        $page_title = $lang_module['openid_login'];
        $key_words = $module_info['keywords'];
        $mod_title = $lang_module['openid_login'];
        $lang_module['login_info'] = sprintf($lang_module['openid_confirm_info'], $email);
        $contents = openid_account_confirm($gfx_chk, $attribs);
        include NV_ROOTDIR . "/includes/header.php";
        echo nv_site_theme($contents);
        include NV_ROOTDIR . "/includes/footer.php";
        exit;
    }
    if ($global_config['allowuserreg'] == 2 or $global_config['allowuserreg'] == 3) {
        $query = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "_reg` WHERE `email`=" . $db->dbescape($email);
        if ($global_config['allowuserreg'] == 2) {
            $query .= " AND `regdate`>" . (NV_CURRENTTIME - 86400);
        }
        $result = $db->sql_query($query);
        $numrows = $db->sql_numrows($result);
        if ($numrows) {
            if ($global_config['allowuserreg'] == 2) {
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if ($nv_Request->isset_request('openid_active_confirm', 'post')) {
                    $nv_Request->unset_request('openid_attribs', 'session');
                    $password = $nv_Request->get_string('password', 'post', '');
                    $nv_seccode = filter_text_input('nv_seccode', 'post', '');
                    $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
                    if ($crypt->validate($password, $row['password']) and $nv_seccode) {
                        $reg_attribs = set_reg_attribs($attribs);
                        $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "` (\r\n                        `userid`, `username`, `password`, `email`, `full_name`, `gender`, `photo`, `birthday`, `regdate`, `website`, \r\n                        `location`, `yim`, `telephone`, `fax`, `mobile`, `question`, `answer`, `passlostkey`, `view_mail`, `remember`, `in_groups`, \r\n                        `active`, `checknum`, `last_login`, `last_ip`, `last_agent`, `last_openid`) VALUES (\r\n                        NULL, \r\n                        " . $db->dbescape($row['username']) . ", \r\n                        " . $db->dbescape($row['password']) . ", \r\n                        " . $db->dbescape($row['email']) . ", \r\n                        " . $db->dbescape(!empty($row['full_name']) ? $row['full_name'] : $reg_attribs['full_name']) . ", \r\n                        " . $db->dbescape($reg_attribs['gender']) . ", \r\n                        '', 0, \r\n                        " . $db->dbescape($row['regdate']) . ", \r\n                        '', '', \r\n                        " . $db->dbescape($reg_attribs['yim']) . ", \r\n                        '', '', '', \r\n                        " . $db->dbescape($row['question']) . ", \r\n                        " . $db->dbescape($row['answer']) . ", \r\n                        '', 1, 1, '', 1, '', 0, '', '', '')";
                        $userid = $db->sql_query_insert_id($sql);
                        if (!$userid) {
                            openidLogin_Res0($lang_module['account_active_error']);
                            die;
                        }
                        $sql = "DELETE FROM `" . NV_USERS_GLOBALTABLE . "_reg` WHERE `userid`=" . $db->dbescape($row['userid']);
                        $db->sql_query($sql);
                        $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_openid` VALUES (" . $userid . ", " . $db->dbescape($attribs['id']) . ", " . $db->dbescape($opid) . ", " . $db->dbescape($email) . ")";
                        $db->sql_query($sql);
                        $query = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid`=" . $db->dbescape($userid);
                        $result = $db->sql_query($query);
                        $row = $db->sql_fetchrow($result);
                        validUserLog($row, 1, $opid);
                        $info = $lang_module['account_active_ok'] . "<br /><br />\n";
                        $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                        $info .= "[<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "\">" . $lang_module['redirect_to_home'] . "</a>]";
                        $contents .= user_info_exit($info);
                        $contents .= "<meta http-equiv=\"refresh\" content=\"2;url=" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "\" />";
                        include NV_ROOTDIR . "/includes/header.php";
                        echo nv_site_theme($contents);
                        include NV_ROOTDIR . "/includes/footer.php";
                        exit;
                    } else {
                        openidLogin_Res0($lang_module['openid_confirm_failed']);
                        die;
                    }
                }
                $page_title = $mod_title = $lang_module['openid_active_title'];
                $key_words = $module_info['keywords'];
                $lang_module['login_info'] = sprintf($lang_module['openid_active_confirm_info'], $email);
                $contents = openid_active_confirm($gfx_chk, $attribs);
                include NV_ROOTDIR . "/includes/header.php";
                echo nv_site_theme($contents);
                include NV_ROOTDIR . "/includes/footer.php";
                exit;
            } else {
                $nv_Request->unset_request('openid_attribs', 'session');
                openidLogin_Res0($lang_module['account_register_to_admin']);
                die;
            }
        }
    }
    $option = $nv_Request->get_int('option', 'get', 0);
    if (!$global_config['allowuserreg']) {
        $option = 3;
    }
    $contents = "";
    if ($option == 3) {
        $error = "";
        if ($nv_Request->isset_request('nv_login', 'post')) {
            $nv_username = filter_text_input('nv_login', 'post', '');
            $nv_password = filter_text_input('nv_password', 'post', '');
            $nv_seccode = filter_text_input('nv_seccode', 'post', '');
            $check_login = nv_check_valid_login($nv_username, NV_UNICKMAX, NV_UNICKMIN);
            $check_pass = nv_check_valid_pass($nv_password, NV_UPASSMAX, NV_UPASSMIN);
            $check_seccode = !$gfx_chk ? true : (nv_capcha_txt($nv_seccode) ? true : false);
            if (!$check_seccode) {
                $error = $lang_global['securitycodeincorrect'];
            } elseif (!empty($check_login)) {
                $error = $check_login;
            } elseif (!empty($check_pass)) {
                $error = $check_pass;
            } else {
                $sql = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `username`=" . $db->dbescape($nv_username);
                $result = $db->sql_query($sql);
                $numrows = $db->sql_numrows($result);
                if ($numrows != 1) {
                    $error = $lang_global['loginincorrect'];
                } else {
                    $row = $db->sql_fetchrow($result);
                    if (empty($row['password']) or !$crypt->validate($nv_password, $row['password'])) {
                        $error = $lang_global['loginincorrect'];
                    } else {
                        if (!$row['active']) {
                            $error = $lang_module['login_no_active'];
                        } else {
                            $nv_Request->unset_request('openid_attribs', 'session');
                            $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_openid` VALUES (" . intval($row['userid']) . ", " . $db->dbescape($attribs['id']) . ", " . $db->dbescape($opid) . ", " . $db->dbescape($email) . ")";
                            $db->sql_query($sql);
                            validUserLog($row, 1, $opid);
                        }
                    }
                }
            }
            if (empty($error)) {
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name;
                $info = $lang_module['login_ok'] . "<br /><br />\n";
                $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                $info .= "[<a href=\"" . $nv_redirect . "\">" . $lang_module['redirect_to_back'] . "</a>]";
                $contents .= user_info_exit($info);
                $contents .= "<meta http-equiv=\"refresh\" content=\"2;url=" . $nv_redirect . "\" />";
                include NV_ROOTDIR . "/includes/header.php";
                echo nv_site_theme($contents);
                include NV_ROOTDIR . "/includes/footer.php";
                exit;
            }
            $array_login = array("nv_login" => $nv_username, "nv_password" => $nv_password, "nv_redirect" => $nv_redirect, 'login_info' => "<span style=\"color:#fb490b;\">" . $error . "</span>");
        } else {
            $array_login = array("nv_login" => '', "nv_password" => '', 'login_info' => $lang_module['openid_note1'], "nv_redirect" => $nv_redirect);
        }
        $contents .= user_openid_login($gfx_chk, $array_login, $attribs);
        include NV_ROOTDIR . "/includes/header.php";
        echo nv_site_theme($contents);
        include NV_ROOTDIR . "/includes/footer.php";
        exit;
    } elseif ($option == 1 or $option == 2) {
        $nv_Request->unset_request('openid_attribs', 'session');
        $reg_attribs = set_reg_attribs($attribs);
        if (empty($reg_attribs['username'])) {
            openidLogin_Res0($lang_module['logged_in_failed']);
            die;
        }
        if ($option == 2) {
            $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "` \r\n            (`userid`, `username`, `password`, `email`, `full_name`, `gender`, `photo`, `birthday`, \r\n            `regdate`, `website`, `location`, `yim`, `telephone`, `fax`, `mobile`, `question`, `answer`, `passlostkey`, \r\n            `view_mail`, `remember`, `in_groups`, `active`, `checknum`, `last_login`, `last_ip`, `last_agent`, `last_openid`) VALUES \r\n            (\r\n            NULL, \r\n            " . $db->dbescape($reg_attribs['username']) . ", \r\n            '', \r\n            " . $db->dbescape($reg_attribs['email']) . ", \r\n            " . $db->dbescape($reg_attribs['full_name']) . ", \r\n            " . $db->dbescape(ucfirst($reg_attribs['gender'])) . ", \r\n            '', 0, " . NV_CURRENTTIME . ", '', '', \r\n            " . $db->dbescape($reg_attribs['yim']) . ", \r\n            '', '', '', '', '', '', 0, 0, '', 1, '', 0, '', '', ''\r\n            )";
            $userid = $db->sql_query_insert_id($sql);
            if (!$userid) {
                openidLogin_Res0($lang_module['err_no_save_account']);
                die;
            }
            $query = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid`=" . $userid . " AND `active`=1";
            $result = $db->sql_query($query);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_openid` VALUES (" . intval($row['userid']) . ", " . $db->dbescape($reg_attribs['openid']) . ", " . $db->dbescape($reg_attribs['opid']) . ", " . $db->dbescape($reg_attribs['email']) . ")";
            $db->sql_query($sql);
            validUserLog($row, 1, $reg_attribs['opid']);
            $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name;
            Header("Location: " . $nv_redirect);
            exit;
        } else {
            $reg_attribs = serialize($reg_attribs);
            $nv_Request->set_Session('reg_attribs', $reg_attribs);
            Header("Location: " . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=register&openid=1&nv_redirect=" . $nv_redirect);
            exit;
        }
    }
    $array_user_login = array();
    if (!defined('NV_IS_USER_FORUM')) {
        $array_user_login[] = array("title" => $lang_module['openid_note3'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=login&amp;server=" . $attribs['server'] . "&amp;result=1&amp;option=1&amp;nv_redirect=" . $nv_redirect);
        $array_user_login[] = array("title" => $lang_module['openid_note4'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=login&amp;server=" . $attribs['server'] . "&amp;result=1&amp;option=2&amp;nv_redirect=" . $nv_redirect);
    } else {
        $array_user_login[] = array("title" => $lang_module['openid_note6'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=register&amp;nv_redirect=" . $nv_redirect);
    }
    $array_user_login[] = array("title" => $lang_module['openid_note5'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=login&amp;server=" . $attribs['server'] . "&amp;result=1&amp;option=3&amp;nv_redirect=" . $nv_redirect);
    $contents .= user_openid_login2($attribs, $array_user_login);
    include NV_ROOTDIR . "/includes/header.php";
    echo nv_site_theme($contents);
    include NV_ROOTDIR . "/includes/footer.php";
    exit;
}