<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
'-------------------------------------
'功能：用户修改网站信息
'更新：2004-12-27 19:02
'作者：未知-部落忍者
'演示：http://www.0cc.cn/link/
'-------------------------------------

dim action
dim strerror
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理网站信息_<%=WebName&ChannelName%>_本程序由[★零星部落★（0cc.cn)]提供</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<!--#include file="top.asp"-->
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_title1">
  <tr> 
    <td align="center"><a href="index.asp">系统使用说明</a>&nbsp;|&nbsp;<a href="addlink.asp">申请友情链接</a>&nbsp;|&nbsp;<a href="morelink.asp">查询网站点击</a>&nbsp;|&nbsp;<a href="editlink.asp"><font color="#0000FF">管理网站信息</font></a>&nbsp;|&nbsp;<a href="getcode.asp">重获链接代码</a></td>
  </tr>
</table>
<%
action=request("action")
if action="chklogin" then
	call chklogin
elseif action="listinfo" and session("username")<>"" then
	call listinfo
elseif action="showlog" and session("username")<>"" then
	call showlog
elseif action="saveedit" and session("username")<>"" then
	call saveedit
elseif action="exit" then
	call exitlogin
else
	call loginform
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 CL_Link where username='"&username&"'")
	if rs.eof then
		strerror="<li>无此用户名"
		call loginform
	else
		if rs("password")<>md5(password,16) then
			strerror="<li>密码不符"
			call loginform
		else
			session("username")=username
			call listinfo
		end if
	end if
end if
	
end sub

sub listinfo
if session("username")="" then
response.end
end if
dim rs
set rs=hx.execute("select * from CL_Link where username='"&session("username")&"'")
call shownav("修改网站信息")
%>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr>
    <td>
<form method="post" action="?action=saveedit">
        <div align="center"><a href="editlink.asp?action=listinfo">修改网站信息</a> 
          <a href="editlink.asp?action=showlog">详细点击记录</a> <a href="editlink.asp?action=listinfo"></a> 
          <a href="?action=exit">退出管理</a> </div>
        <table border="1" bordercolorlight="#000000" cellspacing="0"
bordercolordark="#FFFFFF">
              <tr> 
                <td> <div align="center">用 户 名：</div></td>
                <td> <%=rs("username")%>(不能修改)</td>
              </tr>
              <tr> 
                <td> <div align="center">网站名称：</div></td>
                <td> <input type="text" name="sitename" size="14" maxlength="12" value="<%=rs("sitename")%>">
              <font color="#CC0000">* 不能超过12个字符（6个汉字）</font></td>
              </tr>
              <tr> 
                <td> <div align="center">网站地址：</div></td>
                <td> <input type="text" name="siteurl" size="50" maxlength="110" value="<%=rs("siteurl")%>"> 
                  <font color="#CC0000">* 不能超过100个字符</font></td>
              </tr>
              <tr> 
                <td> <div align="center">图片地址：</div></td>
                
            <td> 
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input type="text" name="sitelogo" size="50" maxlength="100" value="<%=rs("sitelogo")%>"> 
                    <br>
                    可选项，不能超过100个字符 （图片大小尺寸为:88*31，如果暂时没有，请留空） </td>
                  <td width="90"><img src="<%=rs("sitelogo")%>" width=88 height=31></td>
                </tr>
              </table>
              
            </td>
              </tr>
              <tr> 
                <td> <div align="center">网站类型：</div></td>
                <td> <select name="webtype" size="1">
					<%call hx.listwebtype(rs("webtype"))%>
                  </select> <font color="#CC0000">* <font color="#FF0000">请正确选择您网站的类型</font></font> 
                </td>
              </tr>
              <tr> 
                <td> <div align="center">密　　码：</div></td>
                <td> <input type="password" name="password" size="10" maxlength="12" value="<%=rs("password")%>">
              <font color="#CC0000">* 不能超过12个字符</font></td>
              </tr>
              <tr> 
                <td> <div align="center">密码确认：</div></td>
                <td> <input type="password" name="pwdconfirm" size="10" maxlength="12" value="<%=rs("password")%>">
              <font color="#CC0000">* 请再输一遍确认</font></td>
              </tr>
              <tr> 
                <td> <div align="center">联系邮箱：</div></td>
                <td> <input type="text" name="email" size="30" maxlength="50" value="<%=rs("email")%>"> 
                  <font color="#CC0000">* 请输入有效的邮件地址，不能超过50个字符</font></td>
              </tr>
              <tr> 
                <td> <div align="center">网站简介：<font color="#FF0000"></font></div></td>
                <td> <textarea rows="4" name="siteintro" cols="70"><%=rs("siteintro")%></textarea> 
                  <br> <font color="#FF0000">*</font> <font color="#CC0000">不能超过200个字符（100个汉字）</font> 
                </td>
              </tr>
              <tr> 
                <td colspan="2" align="center" class="td"> <input type="submit" value=" 确 定 " name="yes"> 
                  <input type="reset"  value=" 重 写 " name="reset">
            </td>
              </tr>
            </table>
      </form></td>
  </tr>
</table>
<%end sub%>

<%sub loginform
call shownav("第一步：登陆")
%>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr><form method="post" action="?action=chklogin">
    <td>
        <div align="center"><%=strerror%></div>
            <table width="300" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
              <tr> 
                <td width="100%" align="center" class="td">用 户 名： 
                  <input name="username" type="text" id="username" size="10" maxlength="12"> 
                </td>
              </tr>
              <tr> 
                <td width="100%" align="center" class="td">密　　码： 
                  <input name="password" type="password" id="password" size="10" maxlength="12"> 
                </td>
              </tr>
              <tr> 
                <th width="100%"> <input type="submit" value="登陆管理" name="submit"> 
                </th>
              </tr>
            </table>
     </td> </form>
  </tr>
</table>
<%end sub%>
<%sub showlog
call shownav("详细点击记录")
dim rs%>
<table border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr>
    <td><div align="center"><a href="editlink.asp?action=listinfo">修改网站信息</a> 
        <a href="editlink.asp?action=showlog">详细点击记录</a> <a href="editlink.asp?action=listinfo"></a> 
        <a href="?action=exit">退出管理</a> </div>
      <table width="95%" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr>
          <td><div align="center">点入记录（你站对我站的贡献）最近3天的记录</div></td>
        </tr>
      </table>
      <table width="95%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
        <tr align="center"> 
          <td width="120">时间</td>
          <td width="100">IP地址</td>
          <td>来源</td>
        </tr>
        <%
	
	set rs=hx.execute("select * from CL_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>暂时还没有记录</td></tr>"
	else
		do while not rs.eof
	%>
        <tr> 
          <td><%=rs("dateandtime")%></td>
          <td><%="<a href='http://www.0cc.cn/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>
      <br>
      <table width="95%" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr> 
          <td><div align="center">点出记录（我站对你站的贡献）最近3天的记录</div></td>
        </tr>
      </table>
      <table width="95%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
        <tr align="center"> 
          <td width="120">时间</td>
          <td width="100">IP地址</td>
          <td>来源</td>
        </tr>
        <%
	
	set rs=hx.execute("select * from CL_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>暂时还没有记录</td></tr>"
	else
		do while not rs.eof
	%>
        <tr> 
          <td><%=rs("dateandtime")%></td>
          <td><%="<a href='http://www.0cc.cn/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></td>
  </tr>
</table>
<%end sub%>

<%
sub saveedit

dim username,sitename,siteurl,sitelogo,email,password,pwdconfirm,webtype,siteintro
sitename=hx.checkstr(request.form("sitename"),12)
siteurl=hx.checkstr(request.form("siteurl"),100)
sitelogo=hx.checkstr(request.form("sitelogo"),100)
email=hx.checkstr(request.form("email"),50)
password=hx.checkstr(request.form("password"),16)
pwdconfirm=hx.checkstr(request.form("pwdconfirm"),16)
webtype=request.form("webtype")
siteintro=hx.checkstr(request.form("siteintro"),250)

dim blnerror,strerror
blnerror=false
if session("username")="" then
	blnerror=true
	strerror="<li>意外出错，请重新登陆"
end if
if sitename="" or siteurl="" or password="" or siteintro="" or email="" then
	blnerror=true
	strerror=strerror & "<li>请检查是否有必填信息没有填写"
end if
if hx.blnfilter(sitename) then
	blnerror = true
	strerror = strerror & "<li>网站名称不能包含某些特殊关键词"
end if
if hx.blnfilter(siteintro) then
	blnerror = true
	strerror = strerror & "<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 blnerror=true then
		call shownav("错误信息")
		%>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr>
    <td>
		<%	
		response.write strerror
		response.write "<p><< <a href=javascript:history.go(-1)>返回上一页 </a> << <a href=editlink.asp?action=listinfo>返回管理首页</a></p>"
		%>
</td></tr></table>
		<%
	else
		if sitelogo="" then
			sitelogo="http://" & hx.BaseUrl & "images/wu.gif"
		elseif left(sitelogo,7)<>"http://" then
			sitelogo="http://" & sitelogo
		end if
		if left(siteurl,7)<>"http://" then
			siteurl="http://" & siteurl
		end if
		dim rs,sql
		sql= "select * from CL_Link where username='"&session("username")&"'"
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,1,3
		rs("email")=email
		rs("sitename")=sitename
		rs("webtype")=webtype
		if len(password)<16 then
		rs("password")=md5(password,16)
		end if
		rs("siteurl")=siteurl
		rs("siteintro")=siteintro
		rs("sitelogo")=sitelogo 
		rs.Update
		rs.close
		set rs=nothing
		call shownav("资料修改成功")
		%>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr>
    <td>
		<%
		response.write "<p align=center>资料修改成功</p>"   
		response.write "<p><< <a href=javascript:history.go(-1)>返回上一页 </a> << <a href=editlink.asp?action=listinfo>返回管理首页</a> << <a href=editlink.asp?action=exit>退出管理</a></p>"
		%>
</td></tr></table>
		<%
end if

end sub

sub shownav(str)
%>
<table border="0" align="center" cellpadding="3" cellspacing="0" class="main_tdbg">
  <tr> 
    <td height="30">您的位置:<a href="<%=WebUrl%>">首页</a> -- <a href="index.asp"><%=ChannelName%></a> -- <a href="editlink.asp"><font color="#0000FF">管理网站信息</font></a> -- <%=str%> 
    </td>
  </tr>
</table>
<%
end sub
CloseDatabase
%>
<!--#include file="under.asp"-->
</body> 
</html>
