<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Const dbdns = "../"
Const Htmldns = "../"
Const Base_Target = ""
Const ChannelID = 1
ClassID = ""
%>
<!--#include file="../AppCode/Conn.asp"-->
<!--#include file="../AppCode/fun/function.asp"-->
<!--#include file="../AppCode/Pager.asp"-->
<!--#include file="../AppCode/fun/md5.asp"-->
<!--#include file="../AppCode/Class/Ok3w_User.asp"-->
<!--#include file="../AppCode/Class/Ok3w_Article.asp"-->
<!--#include file="../inc/vbs.asp"-->
<%
Set User = New Ok3w_User
Set Article = New Ok3w_Article

User_Name = Trim(Replace(User.IsLogin(),"'",""))
If User_Name = "" Then
	Call MessageBox("你还没有登陆或是登陆已经超时。","login.asp")
End If

a = Trim(Request.QueryString("a"))
b = Trim(Request.QueryString("b"))

If Trim(Request.QueryString("action")) = "LoginOut" Then
	Session(SiteID & "_Ok3w.Net_User_Name") = ""
	Response.Redirect("../")
End If

If a="user_edit" And b="save" Then
	Call  User.UserEdit()
	Call MessageBox("操作成功","?a=user_eidt&rnd=" & Now())
End If

If a="a_edit" And b="save" Then
	a_id = Request.QueryString("a_id")
	Call Article.User_Article_Save(a_id)
	Call MessageBox("操作成功","?a=a_list&rnd=" & Now())
End If

If a="a_del" Then
	a_id = Cdbl(Request.QueryString("a_id"))
	Call Article.User_Article_Del(a_id,User_Name)
	Call MessageBox("操作成功","?a=a_list&rnd=" & Now())
End If
%>
<!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-Type" content="text/html; charset=gb2312" />
<title>会员登陆 - <%=Application(SiteID & "_Ok3w_SiteName")%></title>
<link rel="stylesheet" type="text/css" href="../themes/v1/style.css">
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/ads.js"></script>
<script language="javascript" src="../js/calendar.js"></script>
</head>

<body>
<!--#include file="../inc/head.asp"-->
<div class="list_twidth">
     <!--left-->
      <div class="mframe mR">
   	    <div class=tm>
   	      <div class=tit><SPAN class=tt><a href="<%=Htmldns%>">网站首页</a> &gt;&gt; 会员登陆</SPAN></div>
   	    </div>
        <div class=wrapper>
        <DIV class=mm id=bodyTd>
<div style="font-size:14px; padding:5px 0px; border:1px solid #CCC; background-color:#F5F5F5; text-align:center; color:#999; margin-bottom:15px;"><a href="index.asp">个人资料</a> | <a href="?a=a_edit">投稿/推荐文章</a> | <a href="?a=a_list">管理文章</a> | <a href="?action=LoginOut">安全退出</a></div>
<%
Select Case a
	Case "a_edit"
		a_id = Trim(Request.QueryString("a_id"))
		Call Article_Edit(a_id)
	Case "a_list"
		Call Article_List()
	Case Else
		Call user_edit()
End Select
%>

<%Private Sub user_edit()
Sql = "select * from Ok3w_User where User_Name='" & User_Name & "'"
Rs.Open Sql,Conn,1,1
%>
<div><strong style="color:#333333">个人资料</strong></div>
<table border="0" cellspacing="5" cellpadding="0">
  <form id="form1" name="form1" method="post" action="?a=user_edit&b=save">
<script language="JavaScript" type="text/javascript">
function ChkReg(frm)
{
	if(frm.User_Password.value.trim()=="")
	{
		alert("原密码不能为空，请输入");
		frm.User_Password.focus();
		return false;
	}
	
	if(frm.User_Password21.value.trim()!="")
	{
		if(frm.User_Password21.value.trim().length<6 || frm.User_Password21.value.trim().length>20)
		{
			alert("新密码只能是6-20位字符");
			frm.User_Password21.focus();
			return false;
		}
		
		if(frm.User_Password21.value != frm.User_Password22.value)
		{
			alert("两次新密码输入不一致，请输入");
			frm.User_Password22.focus();
			return false;
		}
	}
	
	var exp2=/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9._-]*$/
	if(frm.Mail.value.match(exp2)==null)
	{
		alert("电子邮件不正确，请输入");
		frm.Mail.focus();
		return false;
	}
	frm.bntSubmit.disabled=true;
	
	frm.submit();
}
</script>
    
    <tr>
      <td align="right">用户名：</td>
      <td><img src="../<%=GetUserDengjiValue(2,GetUserDengjiID(Rs("Jifen")))%>" /> <strong><%=Rs("User_Name")%></strong> 注册时间：<strong><%=Rs("RegTime")%></strong> 最后登陆：<strong><%= Rs("LastLoginTime")%></strong></td>
    </tr>
    <tr>
      <td align="right">积分：</td>
      <td><%=Rs("Jifen")%></td>
    </tr>
    <tr>
      <td align="right">原密码：</td>
      <td><input name="User_Password" type="password" id="User_Password" size="20" maxlength="20" />
          <span class="red">*</span>6-20位字符</td>
    </tr>
    <tr>
      <td align="right">新密码：</td>
      <td><input name="User_Password21" type="password" id="User_Password21" size="20" maxlength="20" />
          <span class="red">*</span>6-20位字符，不改请留空</td>
    </tr>
    <tr>
      <td align="right">密认新密码：</td>
      <td><input name="User_Password22" type="password" id="User_Password22" size="20" maxlength="20" />
          <span class="red">*</span></td>
    </tr>
    <tr>
      <td align="right">邮箱：</td>
      <td><input name="Mail" type="text" id="Mail" value="<%=Rs("Mail")%>" size="35" maxlength="50" />
          <span class="red">*</span>请填最常用邮箱，方便联系</td>
    </tr>
    
    <tr>
      <td align="right">姓名：</td>
      <td><input name="Name" type="text" id="Name" value="<%=Rs("Name")%>" size="10" maxlength="8" /></td>
    </tr>
    <tr>
      <td align="right">性别：</td>
      <td><input type="radio" name="Sex" value="男" <%If Rs("Sex")="男" Then%>checked="checked"<%End If%>/>
        男
        <input type="radio" name="Sex" value="女" <%If Rs("Sex")="女" Then%>checked="checked"<%End If%>/>
        女
        <input name="Sex" type="radio" value="保密" <%If Rs("Sex")="保密" Then%>checked="checked"<%End If%> />
        保密</td>
    </tr>
    <tr>
      <td align="right">出生年月日：</td>
      <td><input name="Birthday" type="text" id="Birthday" onfocus="cdr.show(this,'1980-01-01');" value="<%= Rs("Birthday")%>" size="10" maxlength="8" /></td>
    </tr>
    <tr>
      <td align="right">电话：</td>
      <td><input name="Tel" type="text" id="Tel" value="<%=Rs("Tel")%>" size="15" maxlength="15" /></td>
    </tr>
    <tr>
      <td align="right">QQ：</td>
      <td><input name="QQ" type="text" id="QQ" value="<%=Rs("QQ")%>" size="15" maxlength="15" /></td>
    </tr>
    <tr>
      <td align="right">联系地址：</td>
      <td><input name="Address" type="text" id="Address" value="<%=Rs("Address")%>" size="35" maxlength="50" /></td>
    </tr>
    <tr>
      <td align="right">邮编：</td>
      <td><input name="Zip" type="text" id="Zip" value="<%=Rs("Zip")%>" size="10" maxlength="6" /></td>
    </tr>
    <tr>
      <td align="right">自我介绍：</td>
      <td><textarea name="Content" cols="60" rows="8" id="Content"><%=Rs("Content")%></textarea></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="bntSubmit" type="button" id="bntSubmit" onclick="ChkReg(this.form);" value="Ok！立即修改" />
          <input name="action" type="hidden" id="action" value="Reg" /></td>
    </tr>
    <%Rs.Close%>
  </form>
</table>
<%End Sub%>	


<%Private Sub Article_List()%>
<div><strong style="color:#333333;">管理文章</strong></div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="8">
  <tr>
    <td align="center"><strong>标题</strong></td>
    <td align="center"><strong>录入时间</strong></td>
    <td align="center"><strong>状态</strong></td>
    <td align="center"><strong>操作</strong></td>
  </tr>
  <%
Sql = "Select * from Ok3w_Article where Inputer='" & Replace(User_Name,"'","") & "' order by ID desc"
Rs.Open Sql,Conn,1,1
If Not(Rs.Eof And Rs.Bof) Then
Do While Not Rs.Eof
%>
  <tr style="border-top:1px dotted #CCC;">
    <td align="center" style="border-top:1px dotted #CCC; padding-top:8px;"><%=Rs("Title")%></td>
    <td align="center" style="border-top:1px dotted #CCC; padding-top:8px;"><%=Rs("AddTime")%></td>
    <td align="center" style="border-top:1px dotted #CCC; padding-top:8px;"><%If Rs("IsPass")=1 Then%>开通<%Else%><font color="#FF0000">待审</font><%End If%></td>
    <td align="center" style="border-top:1px dotted #CCC; padding-top:8px;"><%If Rs("IsPass")=0 Then%><a href="?a=a_edit&a_id=<%=Rs("ID")%>">修改/查看</a> <a href="?a=a_del&a_id=<%=Rs("ID")%>"  onclick="if(!confirm('真的要删除吗？')) return false;">删除</a><%Else%>&nbsp;<%End If%></td>
  </tr>
  <%
	Rs.MoveNext
Loop
Else
%>
  <tr>
    <td colspan="4" align="center" style="border-top:1px dotted #CCC; padding-top:8px;">暂无内容</td>
  </tr>
  <%End If
Rs.Close
%>
</table>
<%End Sub%>



<%Private Sub Article_Edit(ID)
If ID<>"" Then
	Call Article.Load(Cdbl(ID))
	If Article.Inputer<>User_Name Then
		Call MessageBox("对不起，你无法修改别人的文章","")
	End If
	If Article.IsPass=1 Then
		Call MessageBox("对不起，已经开通的文章，不能再修改","")
	End If
End If
%>
<div><strong style=" color:#333333">投稿/推荐文章</strong></div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
<form id="form1" name="form1" method="post" action="?a=a_edit&b=save&a_id=<%=ID%>">
<script language="JavaScript" type="text/javascript">
function ChkForm(frm)
{
	if(frm.ClassID.value.trim()=="")
	{
		alert("分类不能为空，请输入");
		frm.ClassID.focus();
		return false;
	}
	if(frm.Title.value.trim()=="")
	{
		alert("标题不能为空，请输入");
		frm.Title.focus();
		return false;
	}
	var __Content = Content___Frame.frames[0].document.body.innerHTML.trim();
	if(__Content=="<P></P>" || __Content=="<P>&nbsp;</P>")
	{
		alert("内容不能为空，请输入");
		Content___Frame.frames[0].focus();
		return false;
	}
	
	frm.bntSubmit.disabled = true;	
	frm.submit();
}
</script>
    <tr bgcolor="#FFFFFF">
      <td align="right">&nbsp;</td>
      <td colspan="3" style="line-height:170%;">一、管理员审核后，将会公开显示出来；<br />
        二、
        审核通过后你将无法再对文章进行编辑；<br />
        三、如果是转载，请认真注明来源和作者。</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right">录入者</td>
      <td colspan="3"><input name="textfield2" type="text" disabled="disabled" value="<%=User_Name%>" size="25" maxlength="20" /></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="70" align="right">分类</td>
      <td colspan="3"><select name="ClassID"><option value="">点这里选择分类</option>
						  <%Call InitClassSelectOption(ChannelId,0,Article.ClassID)%></select>
	  </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right">标题<span class="red">*</span></td>
      <td colspan="3"><input name="Title" type="text" id="Title" value="<%=Article.Title%>" size="50" maxlength="50" /></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right">内容<span class="red">*</span></td>
      <td colspan="3">
<script type="text/javascript" src="../fckeditor/fckeditor.js"></script>
<textarea name="Content" id="Content" style="display:none;"><%=Article.Content%></textarea>
<script type="text/javascript">
Ok3w_CreateFCKeditor(2,"Content","User","580","200");
</script>
	  </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right">来源</td>
      <td><input name="ComeFrom" type="text" id="ComeFrom" value="<%=Article.ComeFrom%>" size="25" maxlength="50" /></td>
      <td align="right">作者</td>
      <td><input name="Author" type="text" id="Author" value="<%=Article.Author%>" size="25" maxlength="50" /></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align="right">&nbsp;</td>
      <td colspan="3"><input name="bntSubmit" type="button" id="bntSubmit" onclick="ChkForm(this.form);" value="Ok！立即提交"/></td>
    </tr>
  </form>
</table>
<%End Sub%>
        </DIV>

     </div>
    
    </div>
    
     <!--right-->
	<div style="float:right; width:250px;">
      <div class=lframe>
      	<div class=tm><SPAN class=tt>最新添加</SPAN> </div>
      	<div class=wrapper>
     		 <div class="mm box1">
     		 <UL>
       			 <%Call Ok3w_Article_List("",10,16,False,False,False,0,False,"new","li")%>  
             </UL>
             </div>
        </div>
      </div>    
      <div class=lframe>
     	 <div class=tm><SPAN class=tt>热门阅读</SPAN> </div>
     	 <div class=wrapper>
     		 <div class="mm box1">
      		 <UL>
       			 <%Call Ok3w_Article_List("",10,16,False,False,False,0,False,"hot","li")%>
             </UL>
             </div>
          </div>
       </div>
	</div>
</div>
<!--#include file="../inc/foot.asp"-->
</body>
</html>