<!--#include file="conn.asp"-->
<%
'-------------------------------------
'功能：管理员管理网站信息
'天天智能友情链接管理系统
'天天DV网制作 http://www.ttdv.cn
'博大网址库http://www.ip126.com

'可自由传播和免费使用，但必须保留此完整版权信息
'本程序撷取了ITlearner、博大网址库等优秀程序中的源代码，对他们的作者表示感谢
'-------------------------------------

	if session(hxCacheName&"_admin")<>"OK" then
        response.redirect("admin_login.asp")
	end if
	dim username
	username=hx.checkstr(request("username"),12)
	dim strerror
	dim rs,sql

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改网站信息_<%=WebName & ChannelName%></title>
<link href="../style.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--#include file="../md5.asp"-->
<script language=javascript src=../images/mouse_on_title.js></script>
<script LANGUAGE=JavaScript>
  function textLimitCheck(thisArea, maxLength){
    if (thisArea.value.length > maxLength){
      alert(maxLength + ' 个字限制. \r超出的将自动去除.');
      thisArea.value = thisArea.value.substring(0, maxLength);
      thisArea.focus();
    }
    /*回写span的值，当前填写文字的数量*/
    messageCount.innerText = thisArea.value.length;
  }
</script>
<%
sub saveedit
dim username,ttname,tturl,ttlogo,email,password,pwdconfirm,webtype,ttinfo,IsVerify,top
username=hx.checkstr(request.form("username"),12)
ttname=hx.checkstr(request.form("ttname"),30)
tturl=hx.checkstr(request.form("tturl"),100)
ttlogo=hx.checkstr(request.form("ttlogo"),100)
email=hx.checkstr(request.form("email"),50)
password=hx.checkstr(request.form("password"),32)
pwdconfirm=hx.checkstr(request.form("pwdconfirm"),32)
webtype=request.form("webtype")
ttinfo=hx.checkstr(request.form("ttinfo"),120)
top=cint(request.form("top"))
dim outc,outj,outp,inc,inj,inp,zdate,indate,outdate,fromdate
outc=cint(request.form("outc"))
outj=cint(request.form("outj"))
outp=CSng(request.form("outp"))
inc=cint(request.form("inc"))
inj=cint(request.form("inj"))
inp=CSng(request.form("inp"))
fromdate=cdate(request.form("fromdate"))
zdate=cdate(request.form("dateandtime"))
indate=cdate(request.form("indate"))
outdate=cdate(request.form("outdate"))
IsVerify=request.form("IsVerify")

dim blnerror
blnerror=false
if username="" then
	blnerror=true
	strerror="<li>意外出错，请选择用户名"
else
	sql="select * from tt_Link where username='"&username&"'"
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,2
	if rs.eof then
		blnerror=true
		strerror="<li>没有该用户"
	end if	
end if
if ttname="" or tturl=""  or ttinfo="" or email="" then
blnerror=true
strerror=strerror & "<li>请检查是否有必填信息没有填写"
end if
if hx.blnfilter(ttname,1) then
	blnerror = true
	strerror = strerror & "<li>网站名称不能包含某些特殊关键词"
end if
if hx.blnfilter(ttinfo,1) then
	blnerror = true
	strerror = strerror & "<li>网站简介不能包含某些特殊关键词"
end if
if hx.blnfilter(tturl,2) then
	blnerror = true
	strerror = strerror & "<li>此域名已经被屏蔽！"
end if
if ttlogo="" then
ttlogo="" &WebUrl & "link/images/wu.gif"
end if
if webtype="" or not isnumeric(webtype) then
blnerror=true
strerror=strerror & "<li>请正确选择网站类型"
end if
if IsVerify="1" then
IsVerify=strTrue
else
IsVerify=strFalse
end if
if (password<>"" or pwdconfirm<>"") and password<>pwdconfirm then
blnerror=true
strerror=strerror & "<li>两次密码不相同"
end if

if blnerror=true then
	
	response.write strerror
	response.write "<p><< <a href=""javascript:history.go(-1)"">返回上一页 </a> << <a href=""admin_manage.asp"">返回管理首页</a></p>"

else

		rs("outc")=outc
		rs("outj")=outj
		rs("outp")=outp
		rs("inc")=inc
		rs("inj")=inj
		rs("inp")=inp
		rs("email")=email
		rs("ttname")=ttname
		rs("webtype")=webtype
		if password<>"" then		
		rs("password")=md5(password)
		end if		
		rs("tturl")=tturl
		rs("ttinfo")=ttinfo
		rs("ttlogo")=ttlogo
		rs("indate")=indate
		rs("outdate")=outdate
		rs("fromdate")=fromdate
		rs("dateandtime")=zdate
		rs("IsVerify")=IsVerify	
		rs("top")=top	
		rs.Update
	response.write "<p>修改成功</p>"
	response.write "<p><< <a href=""javascript:history.go(-1)"">返回上一页 </a> << <a href=""admin_manage.asp"">返回管理首页</a></p>"
		'删除系统缓存	
		set hxcache=new cls_cache
		hxcache.DelCahe("js")
		set hxcache=nothing
end if
end sub
%>
<!--#include file="top.asp"-->
<div class="path<%=skin%>">
您的位置:<a href="<%=WebUrl%>">首页</a> -> <a href="admin_manage.asp">管理首页</a> -> 修改网站信息
</div>
<div class="mainbar_a<%=skin%>">
<%
	dim action
	action=request("action")
	select case action
	case "saveedit"
		call saveedit
	case else
		call showlist	
	end select

	sub showlist
	dim rs
	rs=hx.execute("select * from tt_Link where username='"&username&"'")
	%> <form action="?username=<%=username%>&Action=saveedit" method="POST">
       <table width="90%" border="0" cellpadding="3" cellspacing="1" bgcolor="#000000">
          <tr class="tr<%=skin%>"> 
            <td align="center">用 户 名：</td>
            <td colspan="5"><%=rs("username")%>
              <input name="username" type="hidden" id="username" value="<%=rs("username")%>" >
              <input name="IsVerify" type="checkbox" id="IsVerify" value="1"<%if rs("IsVerify")=strTrue then Response.Write " checked"%>>是否通过审核             
              </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">网站名称：</td>
            <td colspan="5"> <input name="ttname" type="text" id="ttname" value="<%=rs("ttname")%>" size="50" maxlength="30">&nbsp;&nbsp; <img src=../images/memo.gif alt="不能超过30个字符（15个汉字）"></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">网站地址：</td>
            <td colspan="5"> <input name="tturl" type="text" id="tturl" value="<%=rs("tturl")%>" size="50" maxlength="110">&nbsp;&nbsp; <img src=../images/memo.gif alt="不能超过100个字符"></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">注册时间：</td>
            <td colspan="5"> <input name="dateandtime" type="text" id="dateandtime" value="<%=rs("dateandtime")%>" size="16" maxlength="20"> 
            </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td>统计时间：</td>
            <td><input name="fromdate" type="text" id="fromdate" value="<%=rs("fromdate")%>" size="16" maxlength="20"> 
            </td>
            <td>点入时间：</td>
            <td> <input type="text" name="indate" size="10" maxlength="10" value="<%=rs("indate")%>"> 
            </td>
            <td>点出时间：</td>
            <td> <input type="text" name="outdate" size="10" maxlength="10" value="<%=rs("outdate")%>"> 
            </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td>总计点入：</td>
            <td> <input type="text" name="inc" size="16" maxlength="8" value="<%=rs("inc")%>"> 
            </td>
            <td>今天点入：</td>
            <td> <font color="#FF0000"> 
              <input type="text" name="inj" size="16" maxlength="8" value="<%=rs("inj")%>">
              </font></td>
            <td>平均点入：</td>
            <td> <input type="text" name="inp" size="16" maxlength="8" value="<%=rs("inp")%>"> 
            </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td>总击点出：</td>
            <td> <input type="text" name="outc" size="16" maxlength="8" value="<%=rs("outc")%>"> 
            </td>
            <td>今天点出：</td>
            <td> <font color="#FF0000"> 
              <input type="text" name="outj" size="16" maxlength="8" value="<%=rs("outj")%>">
              </font></td>
            <td>平均点出： </td>
            <td> <input type="text" name="outp" size="16" maxlength="8" value="<%=rs("outp")%>"> 
            </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">图片地址：</td>
            <td colspan="4"> <input name="ttlogo" type="text" id="ttlogo" value="<%=rs("ttlogo")%>" size="50" maxlength="100">&nbsp;&nbsp; <img src=../images/memo.gif alt="可选项，不能超过100个字符 （图片大小尺寸为:88*31，如果暂时没有，请留空）"> 
               </td>
            <td><img src="<%=rs("ttlogo")%>" width=88 height=31></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">网站类型：</td>
            <td colspan="5"> <select name="webtype" size="1">
                <%call hx.listwebtype(rs("webtype"),0)%>
              </select> </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">密　　码：</td>
            <td colspan="5"> <input name="password" type="password" id="password" value="" size="10" maxlength="12">&nbsp;&nbsp; <img src=../images/memo.gif alt="不改密码请留空。不能超过12个字符"></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">密码确认：</td>
            <td colspan="5"> <input name="pwdconfirm" type="password" id="pwdconfirm" value="" size="10" maxlength="12">&nbsp;&nbsp; <img src=../images/memo.gif alt="请再输一遍确认"></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">联系邮箱：</td>
            <td colspan="5"> <input type="text" name="email" size="30" maxlength="50" value="<%=rs("email")%>">&nbsp;&nbsp; <img src=../images/memo.gif alt="请输入有效的邮件地址，不能超过50个字符"></td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">网站简介：</td>
            <td colspan="5"> <textarea name="ttinfo" cols="70" rows="4" id="ttinfo" onkeyUp="textLimitCheck(this, 50);"><%=rs("ttinfo")%></textarea>
              <br>
              <font color="#FF0000">*</font> 限 100 个字符 已输入 <font color="#CC0000"><span id="messageCount">0</span></font> 个字&nbsp;&nbsp; <img src=../images/memo.gif alt="不能超过100个字符（50个汉字）">
            </td>
          </tr>
          <tr class="tr<%=skin%>"> 
            <td align="center">是否固顶：</td>
            <td colspan="5"> <input name="top" type="text" id="top" value="<%=rs("top")%>" size="5" >&nbsp;&nbsp; <img src=../images/memo.gif alt="请填入数字，越大越靠前，数值相同者<br>平均点入数大者为先。0为不固顶"></td>
          </tr>          
          <tr class="tr<%=skin%>"> 
            <td colspan="6" align="center" class="td"> <input type="submit" value=" 确 定 " name="yes"> 
              <input name="reset" type="reset"  
value=" 重 写 "> </td>
          </tr>
        </table>
      </form>
      <%end sub%> 
</div>
<!--#include file="../under.asp"-->
<%set hx=nothing%>
</body>
</html>
