PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

关于调用登陆框的问题? [复制链接]

1#
我调用了个自己论坛上的登陆框放在自己的首页但是显示出现错误如:www.senlikeji.com.cn  怎么改成自己网站能用的就像我们PG上的登录框一样,现附上代码高手指点下~改什么地方
<%@ Import Namespace="DXBBS.Business"%>
<%@ Import Namespace="DXBBS.Components"%>
<%@ Import Namespace="DXBBS.DataProviders"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Language" c>
<meta http-equiv="Content-Type" c>
<link href="<% =ForumConfig.ReadConfigInfo().SkinPath%>/style.css" type="text/css" rel="stylesheet" media="all" />
</head>
<script language="C#" runat="server">
protected void Page_Load(object sender,EventArgs e)
{
    if (Sessions.UserID == 0)
    {
        Forum.CheckCookies();
    }
if (!this.IsPostBack)
{
        //退出登录
        if (Request.QueryString["Action"] == "Logout")
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies["DXBBS"];
            if (cookie != null)
            {
                cookie.Expires = DateTime.Now.AddYears(-300);
                HttpContext.Current.Response.Cookies.Add(cookie);
            }
            if (Sessions.UserID != 0)
            {
                Hashtable onlinelist = (Hashtable)Caches.Read(CacheKey.OnlineList);
                if (onlinelist != null)
                {
                    if (onlinelist[Sessions.UserID.ToString()] != null)
                    {
                        onlinelist.Remove(Sessions.UserID.ToString());
                    }
                }
            }
            Sessions.Abandon();
            Response.Redirect("LoginForm.aspx");
        }
        //检查是否开启登录验证码
  if (ForumConfig.ReadConfigInfo().LoginCode == 0)
        {
            LoginCode.Visible = false;
        }
}
}
protected void LoginButton_Click(object sender, EventArgs e)
{
string username = Filter.KillJapan(UserName.Text.Trim());
    string userpass = Password.Text.Trim();
    string usercode = string.Empty;
    if (ForumConfig.ReadConfigInfo().LoginCode == 1)
    {
        usercode = UserCode.Text.Trim();
    }
    userpass = (FormsAuthentication.HashPasswordForStoringInConfigFile(userpass, "MD5")).Substring(8, 16).ToLower();
    if (Forum.CheckCode(usercode) || ForumConfig.ReadConfigInfo().LoginCode == 0)
    {
        UserInfo user = new UserInfo();
        using (DataProvider dp = new DataProvider())
        {
            user = Forum.CheckUser(username, userpass, false, dp);
            if (user.ID != 0)
            {
                Forum.UpdateTodayLogin(dp);
                Forum.AddCoinPoint(user.ID, ForumConfig.ReadConfigInfo().LoginCoin, ForumConfig.ReadConfigInfo().LoginPoint, dp);
            }
        }
        if (user.ID != 0)
        {
            //检查用户状态
            if (user.State == 1)
            {
                Script.Alert("你的用户名未审核,暂时无法登录");
            }
            if (user.State == 2)
            {
                Script.Alert("你的用户名已被锁定,暂时无法登录");
            }
            //如果隐身登录
            if (HideLogin.Checked == true)
            {
                Sessions.IsHide = true;
            }
            //处理COOKIES
            int CookiesDay = Convert.ToInt32(UserCookies.SelectedValue);
            HttpCookie cookie = new HttpCookie("DXBBS");
            cookie["UserName"] = Filter.Encode(username,ForumConfig.ReadConfigInfo().SecureKey);
            cookie["UserPass"] = Filter.Encode(userpass,ForumConfig.ReadConfigInfo().SecureKey);
            cookie["Key"] = Filter.Encode(Clients.CookiesKey,ForumConfig.ReadConfigInfo().SecureKey);
            if (CookiesDay != 0)
            {
                cookie.Expires = DateTime.Now.AddDays(CookiesDay);
            }
            cookie["IsHide"] = Sessions.IsHide.ToString();
            HttpContext.Current.Response.Cookies.Add(cookie);
            LevelInfo level = Forum.ReadLevelCacheInfo(user.LevelID);
            //用户ID
            Sessions.UserID = user.ID;
            //用户名
            Sessions.UserName = user.UserName;
            //用户等级ID
            Sessions.LevelID = user.LevelID;
            //用户等级
            Sessions.LevelName = level.LevelName;
            //用户等级类型
            Sessions.LevelType = (LevelType)user.LevelType;
            //用户圈子ID
            Sessions.TeamID = user.TeamID;
            //用户头像
            Sessions.Photo = user.Photo;
            //用户发帖量
            Sessions.Topic = user.Topic;
            //用户回帖量
            Sessions.Reply = user.Reply;
            //用户金币
            Sessions.Coin = user.Coin;
            //用户积分
            Sessions.Point = user.Point;
            //用户今天上传文件数
            Sessions.UploadNum = user.UploadNum;
            //用户上次上传文件时间
            Sessions.UploadTime = user.UploadTime;
            //用户注册时间
            Sessions.RegTime = user.RegTime;
            Response.Redirect("LoginForm.aspx");
        }
        else
        {
            Script.Alert("登录失败,用户名或密码错误");
        }
    }
    else
    {
        Script.Alert("验证码错误");
    }
}
</script>
<body>
<% if (Sessions.UserID == 0)
   { %>
<form runat="server">
<table width="100%"  border="0" cellspacing="1" cellpadding="3" height="100%" class="Normal_Table">
    <tr class="Table_Header">
        <td width="100%" colspan="2" align="center">用户登录</td>
    </tr>
    <tr class="Table_Middle">
        <td width="40%" align="right">用户名:</td><td width="60%"> <aspextBox ID="UserName" Width="180px" runat="server"/> <asp:RequiredFieldValidator ID="NeedName" ErrorMessage="请输入用户名" C runat="server" /></td>
    </tr>
    <tr class="Table_Middle">
        <td width="40%" align="right">密码:</td><td width="60%"> <aspextBox ID="Password" TextMode="password" Width="180px" runat="server"/> <asp:RequiredFieldValidator ID="NeedPassword" ErrorMessage="请输入密码" C runat="server" /></td>
    </tr>
    <asplaceHolder ID="LoginCode" runat="server">
    <tr class="Table_Middle">
        <td width="40%" align="right">验证码:</td><td width="60%"> <aspextBox ID="UserCode" Width="50px" runat="server"></aspextBox> <asp:RequiredFieldValidator ID="NeedCode" ErrorMessage="请输入验证码" C Display="dynamic" runat="server" /> <img src="ShowCode.aspx"></td>
    </tr>
    </asplaceHolder>
    <tr class="Table_Middle">
        <td width="40%" align="right">保存登录:</td><td width="60%"> <aspropDownList ID="UserCookies" runat="server"><aspistItem Value="0" Text="不保存" /><aspistItem Value="1" Text="保存一天" /><aspistItem Value="7" Text="保存一周" /><aspistItem Value="30" Text="保存一月" /><aspistItem Value="365" Text="保存一年" /></aspropDownList> <asp:CheckBox ID="HideLogin" Text="隐身登录" runat="server" /></td>
    </tr>
    <tr class="Table_Middle">
        <td width="100%" colspan="2" align="center"><asp:Button ID="LoginButton" Text="确定登录"  runat="server" />
   <input type="button" value="还没注册" name="B2" ></td>
    </tr>
</table>
</form>
<%}else{%>
<table width="100%"  border="0" cellspacing="1" cellpadding="3" height="100%" class="Normal_Table">
    <tr class="Table_Header">
        <td width="100%" colspan="2" align="center">用户登录</td>
    </tr>
    <tr class="Table_Middle">
        <td>欢迎你:<span class="Red"><b><% =Sessions.UserName %></b></span></td>
    </tr>
    <tr class="Table_Middle">
        <td>等级:<b><% =Sessions.LevelName %></b></td>
    </tr>
    <tr class="Table_Middle">
        <td>金币:<b><% =Sessions.Coin %></b>,  积分:<b><% =Sessions.Point %></b></td>
    </tr>
    <tr class="Table_Middle">
        <td>发帖:<b><% =Sessions.Topic %></b>,  回复:<b><% =Sessions.Reply %></b></td>
    </tr>
    <tr class="Table_Middle">
        <td>注册时间:<b><% =Sessions.RegTime %></b></td>
    </tr>
    <tr class="Table_Middle">
        <td>[ <a href="ControlPanel.aspx" target="_blank">用户中心</a> ] [ <a href="Index.aspx" target="_blank">进入论坛</a> ] [ <a href="?Action=Logout">退出登录</a> ]</td>
    </tr>
</table>
<%}%>
</body>
</html>
分享 转发
TOP
发新话题 回复该主题