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

'可自由传播和免费使用，但必须保留此完整版权信息
'本程序撷取了ITlearner、博大网址库智能友情链接系统、飞
'越智能友情链接系统等优秀程序中的源代码，对他们的作者表示感谢
'-------------------------------------
dim action
dim strerror
%>
<!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%> - Powered By ttdv</title>
<link rel="stylesheet" href="style.css">
</head>
<BODY background="images/back.gif">
<script language=javascript src=http://www.99shik.cn/link/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>
<!--#include file="top.asp"-->
<%
action=request("action")
dim username
username = session("username")
if action="chklogin" then
	call chklogin
elseif action="loginform" then
	call loginform
elseif action="getcode" and username<>"" then
	call getcode
elseif action="showlog" and username<>"" then
	call showlog
elseif action="saveedit" and username<>"" then
	call saveedit
elseif action="exit" then
	call exitlogin
else
	call listinfo
end if

sub exitlogin
	session("username")=""
	strerror="<li>成功退出"
	call loginform
end sub

sub chklogin
dim username,password
username=hx.checkstr(request.form("username"),12)
password=hx.checkstr(request.form("password"),12)
if username="" or password="" then
	strerror="<li>请重新输入"
	call loginform
else
	dim rs
	set rs=hx.execute("select * from tt_Link where username='"&username&"'")
	if rs.eof then
		strerror="<li>无此用户名"
		call loginform
	else
		if rs("password")<>md5(password) then
			strerror="<li>密码不符"
			call loginform
		else
			session("username")=username
			call listinfo
		end if
	end if
end if
	
end sub

sub shownavbar
%>
<p align="center"><br> <a href="?action=getcode">获取链接代码</a> <a href="?action=listinfo">修改网站信息</a> <a href="?action=showlog">详细点击记录</a> <a href="?action=exit">退出管理</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.99shik.cn" target="_blank">久久时空</a></p>
<%
end sub

sub getcode
call shownav("获取链接代码")
%>
<div class="bt<%=skin%>">
  <%call shownavbar%>
  <ul>
    <li>点击越多，排名越前，前<%=LineLogo*LineNum%>名可以显示图标，其它则显示文字。</li>
    <li>请注意：只有日均点击大于<%=inpc%>次，才会在页面上显示。</li>
    <li>站长推荐贵站使用文字链接，如果您愿意使用图标链接，请将图片拷贝到您的服务器上，这样的好处有：<br>
      1.增加贵站页面上显示此logo的速度，2.减少我站调用此图片的流量，谢谢！</li>
  </ul>
  <table width="100%" border="0" align="center">
    <tr valign="top">
      <td width="50%"><p>文字链接 <font color="#0000FF">代码：</font><br>
      网站名称：<%=WebName%><br>
      网&nbsp;&nbsp;&nbsp;&nbsp;址：http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%><br>
      网站简介：<%=WebAlt%><p><br>
      或：<br>      
          <textarea name="textarea" style="width:96%;height:80px;"><a href="http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%>" target="_blank" title="<%=WebAlt%>"><%=WebName%></a></textarea>
        <p><font color="#0000FF">显示样式：</font><a href="http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%>" target="_blank" title="<%=WebAlt%>"><%=WebName%></a></p></td>
      <td width="50%"><p>图标链接<font color="#0000FF"> 代码：</font><br>
      网站名称：<%=WebName%><br>
      网&nbsp;&nbsp;&nbsp;&nbsp;址：http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%><br>
      图标地址：http://<%=hx.BaseUrl%>images/logo.gif<br>
      网站简介：<%=WebAlt%><p>
      或：<br>        
          <textarea name="textarea2" style="width:96%;height:80px;"><a href="http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%>" target="_blank"><img src="http://<%=hx.BaseUrl%>images/logo.gif" width="88" height="31" alt="<%=WebAlt%>" border="0"></a></textarea>
        </p>
        <p><font color="#0000FF">显示样式：</font><a href="http://<%=hx.BaseUrl%>ttindex.asp?id=<%=username%>" target="_blank"><img src="http://<%=hx.BaseUrl%>images/logo.gif" width="88" height="31" alt="<%=WebAlt%>" border="0"></a></p></td>
    </tr>
  </table>
</div>
<%
end sub

sub listinfo
if session("username")="" then
	call loginform
	exit sub
end if
dim rs,problem2
set rs=hx.execute("select * from tt_Link where username='"&session("username")&"'")
call shownav("修改网站信息")
%>
<div class="bt<%=skin%>"><br>
  <%call shownavbar%>
  <form method="post" action="?action=saveedit&problem2=<%=rs("problem")%>">
    <table width="90%" border="0" cellpadding="3" cellspacing="1" bgcolor="#000000" align="center">
      <tr class="tr<%=skin%>">
        <td width="100" align="center">用 户 名：</td>
        <td><%=rs("username")%>(不能修改)</td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">网站名称：</td>
        <td><input type="text" name="ttname" size="14" maxlength="30" value="<%=rs("ttname")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="不能超过30个字符（15个汉字）"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">网站地址：</td>
        <td><input type="text" name="tturl" size="50" maxlength="110" value="<%=rs("tturl")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="不能超过100个字符"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">图片地址：</td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><input type="text" name="ttlogo" size="50" maxlength="100" value="<%=rs("ttlogo")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="可选项，不能超过100个字符 （图片大小尺寸为:88*31，如果暂时没有，请留空）"></td>
              <td><img src="<%=rs("ttlogo")%>" width=88 height=31></td>
            </tr>
          </table></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">网站类型：</td>
        <td><select name="webtype" size="1">
            <%call hx.listwebtype(rs("webtype"),0)%>
          </select>&nbsp;&nbsp; <img src=images/memo.gif alt="请正确选择您网站的类型"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">密　　码：</td>
        <td><input type="password" name="password" size="10" maxlength="12" value="<%=rs("password")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="4~12个字符"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">密码确认：</td>
        <td><input type="password" name="pwdconfirm" size="10" maxlength="12" value="<%=rs("password")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="请再输一遍确认"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">密码问题：</td>
        <td><input name="problem" type="text" id="problem" size="12" maxlength="12" value="<%=rs("problem")%>">&nbsp;&nbsp; <img src=images/memo.gif alt="用于密码保护和找回密码。12个字符内"></td>
      </tr>
      <tr class="tr<%=skin%>">
        <td align="center">密码答案：</td>
        <td><input name="answer" type="text" id="answer" size="12" maxlength="12" value="">&nbsp;&nbsp; <img src=images/memo.gif alt="找回密码时要回答的内容。限12个字符内，不改留空"></td>
      </tr> 
      <tr class="tr<%=skin%>">
        <td align="center">答案确认：</td>
        <td><input name="answerconfirm" type="text" id="answerconfirm" size="12" maxlength="12" value="">&nbsp;&nbsp; <img src=images/memo.gif alt="请再输一遍确认"></td>
      </tr>                   
      <tr class="tr<%=skin%>">
        <td align="center">联系邮箱：</td>
        <td><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><%if rs("maillist")=1 then%>               
                <input type="radio" name="maillist" value="1" id="maillist" checked>
                 订阅&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="maillist" value="0" id="maillist">
                不订阅&nbsp;&nbsp; <img src=images/memo.gif alt="如果想获得本站最新资讯请加入邮件列表"></td>
                <%else%>                         
                <input type="radio" name="maillist" value="1" id="maillist">
                订阅&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="maillist" value="0" id="maillist" checked>
                不订阅&nbsp;&nbsp; <img src=images/memo.gif alt="如果想获得本站最新资讯请加入邮件列表"><%end if%></td>
      </tr>       
      <tr class="tr<%=skin%>">
        <td align="center">网站简介：</td>
        <td><textarea rows="4" name="ttinfo" cols="70" onkeyUp="textLimitCheck(this, 100);"><%=rs("ttinfo")%></textarea>
          <br>限 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 colspan="2" align="center" class="td"><input type="submit" value=" 确 定 " name="yes">
          <input type="reset"  value=" 重 写 " name="reset">
        </td>
      </tr>
    </table>
  </form>
</div>
<%end sub%>
<%sub loginform
call shownav("第一步：登陆")
%>
<div class="mainbar_a<%=skin%>">
  <form method="post" action="?action=chklogin">
    <div align="center"><%=strerror%></div>
    <table width="300" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000">
      <tr class="tr<%=skin%>">
        <td class="tr0">用 户 名：
          <input name="username" type="text" id="username" size="10" maxlength="12">
        </td>
      </tr>
      <tr class="tr<%=skin%>">
        <td class="tr0">密　　码：
          <input name="password" type="password" id="password" size="10" maxlength="12">
        </td>
      </tr>
      <tr class="tr<%=skin%>">
        <td class="tr0"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="登陆管理" name="submit"> &nbsp;         <BUTTON 
                        onclick="window.open('getpwd.asp','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=420,height=175,left=300,top=300');">忘记密码</BUTTON>
        </td>
      </tr>
    </table>
  </form>
</div>
<%end sub%>
<%sub showlog
call shownav("详细点击记录")
dim rs%>
<div class="bt<%=skin%>">
  <%call shownavbar%>
  <%
dim allin,allout
allin = hx.execute("select count(0) from tt_Log where inout=0 and dateandtime>"&SqlNowString&"-3 and username='"&session("username")&"'")(0)
allout = hx.execute("select count(0) from tt_Log where inout=1 and dateandtime>"&SqlNowString&"-3 and username='"&session("username")&"'")(0)
%>
  <div align="center">最近三天点入点出日志统计：点入：<%=allin%>次 点出：<%=allout%>次</div>
  <p align="center">点入记录最近3天的记录</p>
  <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000">
    <tr align="center" class="tr<%=skin%>">
      <td width="120">时间</td>
      <td width="100">IP地址</td>
      <td>来源</td>
    </tr>
    <%	
	set rs=hx.execute("select * from tt_Log where inout=0 and dateandtime>"&SqlNowString&"-3 and username='"&session("username")&"' order by id desc")
	if rs.eof then
		Response.write "<tr><td colspan=""3"" align=""center"" class=""tr2"">暂时还没有记录</td></tr>"
	else
		do while not rs.eof
	%>
    <tr class="tr<%=skin%>">
      <td><%=rs("dateandtime")%></td>
      <td><%="<a href='http://www.ip138.com/ips.asp?ip="&rs("ip")&"' title='查询此IP地址所在区域' target='_blank'>"&rs("ip")&"</a>"%></td>
      <td><%if trim(rs("come"))="" then
		  	response.write "无"
		  else
		  	response.write "<a href="""&rs("come")&""" target=""_blank"">"&rs("come")&"</a>"
		  end if%></td>
    </tr>
    <%
		rs.movenext
		loop
	end if
	set rs=nothing%>
  </table>
  <p align="center">点出记录最近3天的记录</p>
  <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000">
    <tr align="center" class="tr<%=skin%>">
      <td width="120">时间</td>
      <td width="100">IP地址</td>
      <td>来源</td>
    </tr>
    <%	
	set rs=hx.execute("select * from tt_Log where inout=1 and dateandtime>"&SqlNowString&"-3 and username='"&session("username")&"' order by id desc")
	if rs.eof then
		Response.write "<tr><td colspan=""3"" align=""center"" class=""tr2"">暂时还没有记录</td></tr>"
	else
		do while not rs.eof
	%>
    <tr class="tr<%=skin%>">
      <td><%=rs("dateandtime")%></td>
      <td><%="<a href='http://www.itlearner.com/ip/ipinfo.asp?ip="&rs("ip")&"' title='查询此IP地址所在区域' target='_blank'>"&rs("ip")&"</a>"%></td>
      <td><%if trim(rs("come"))="" then
		  	response.write "无"
		  else
		  	response.write "<a href="&rs("come")&" target=_blank>"&rs("come")&"</a>"
		  end if%>
      </td>
    </tr>
    <%
		rs.movenext
		loop
	end if
	set rs=nothing%>
  </table>
</div>
<%end sub%>
<%
sub saveedit

dim username,ttname,tturl,ttlogo,email,password,pwdconfirm,webtype,ttinfo,maillist,problem,answer,answerconfirm,problem2
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)
maillist=request.form("maillist")
password=hx.checkstr(request.form("password"),32)
pwdconfirm=hx.checkstr(request.form("pwdconfirm"),32)
problem=hx.checkstr(request.form("problem"),12)
answer=request.form("answer")
answerconfirm=request.form("answerconfirm")
webtype=request.form("webtype")
ttinfo=hx.checkstr(request.form("ttinfo"),100)
problem2=request("problem2")
dim blnerror,strerror
blnerror=false
if session("username")="" then
	blnerror=true
	strerror="<li>意外出错，请重新登陆"
end if
if ttname="" or tturl="" or password="" or problem="" 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>此域名已经被屏蔽！</li>"
end if
if not isnumeric(webtype) then
	blnerror=true
	strerror=strerror & "<li>请正确选择网站类型"
end if
if password<>pwdconfirm then
	blnerror=true
	strerror=strerror & "<li>两次密码不相同"
end if
if problem<>problem2 and answer="" then
	blnerror=true
	strerror=strerror & "<li>修改了密码问题请同时修改答案，请重新输入问题和答案"
end if
if answer<>answerconfirm then
	blnerror=true
	strerror=strerror & "<li>两次密码答案不相同，请重新输入问题和答案"
end if

	if blnerror=true then
		call shownav("错误信息")
		response.write "<div class=""mainbar"">"
		response.write strerror
		response.write "<p><< <a href=""javascript:history.go(-1)"">返回上一页 </a> << <a href=""admin.asp"">返回管理首页</a></p>"
		response.write "</div>"
	else
		if ttlogo="" then
			ttlogo="http://" & hx.BaseUrl & "images/wu.gif"
		elseif left(ttlogo,7)<>"http://" then
			ttlogo="http://" & ttlogo
		end if
		if left(tturl,7)<>"http://" then
			tturl="http://" & tturl
		end if
		dim rs,sql
		sql= "select * from tt_Link where username='"&session("username")&"'"
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,1,3
		rs("email")=email
		rs("maillist")=maillist
		rs("ttname")=ttname
		rs("webtype")=webtype
		if len(password)<32 then
		rs("password")=md5(password)
		end if
		rs("problem")=problem
		if answer<>"" then
		rs("answer")=md5(answer)
		end if
		rs("tturl")=tturl
		rs("ttinfo")=ttinfo
		rs("ttlogo")=ttlogo 
		rs.Update
		rs.close
		set rs=nothing
		call shownav("资料修改成功")
		response.write "<div class=""mainbar"">"
		response.write "<p align=center>资料修改成功</p>"   
		response.write "<p><< <a href=""javascript:history.go(-1)"">返回上一页 </a> << <a href=""admin.asp"">返回管理首页</a> << <a href=""admin.asp?action=exit"">退出管理</a></p>"
		response.write "</div>"	
		'删除系统缓存	
		set hxcache=new cls_cache
		hxcache.DelCahe("js")
		set hxcache=nothing
end if

end sub

sub shownav(str)
%>
<div class="bt<%=skin%>"> 您的位置:<a href="<%=WebUrl%>">首页</a> -- <a href="index.asp"><%=ChannelName%></a> -- <a href="admin.asp" >管理网站信息</a> -- <%=str%>   &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;选择肤色：
          <select name="skin" id="skin" onChange="javascript:location.href='admin.asp?skin='+document.all.skin.value">
              <option value="1" selected>蓝天白云</option>              
              <option value="2" <%if skin=2 then response.write("selected")%>>水晶紫色</option>
              <option value="3" <%if skin=3 then response.write("selected")%>>秋意盎然</option>
              <option value="4" <%if skin=4 then response.write("selected")%>>粉色回忆</option>
              <option value="5" <%if skin=5 then response.write("selected")%>>浓浓绿意</option>
              <option value="6" <%if skin=6 then response.write("selected")%>>橘子红了</option>
              <option value="7" <%if skin=7 then response.write("selected")%>>青青河草</option>
              <option value="8" <%if skin=8 then response.write("selected")%>>黄金季节</option>
            </select></div>
<%
end sub
%>
<!--#include file="under.asp"-->
<%set hx=nothing%>
</body>
</html>