⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addnew.asp

📁 一个java源程序用于气泡法的java
💻 ASP
字号:
<!--#include file="include.asp"-->
<%
 if not session("log") then response.redirect "login.asp"
 if request.form("submit")<>empty then call add_user()
%>

<html>
<head>
<title>加入新用户</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {  font-size: 9pt}
input {  font-size: 9pt}
.button {  font-size: 9pt; color: #FFFFFF; background-color: #000000}
-->
</style>
</head>

<body bgcolor="#6A4F9A" text="#FFFFFF">
<div align="center">
  <form method="post" action="addnew.asp" name="form01">
    <p>&nbsp;</p><table width="372" border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="2">
      <tr bgcolor="#CCCCCC"> 
        <td colspan="3" align="center" height="28"><font color="#FFFFFF"><font color="#000000">加 
          入 新 用 户 及 初 始 化 设 置</font></font></td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">用户名称:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="user" size="30" maxlength="30">
        </td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">网站名称:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="title" size="30" maxlength="30">
        </td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">网站地址:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="web_url" size="30" maxlength="100" value="http://">
        </td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">总IP次数:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="ip_hits" size="30" maxlength="30" value="0">
          <font color="#990000"> 初始</font></td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">总访问次数:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="count" size="30" maxlength="30" value="0">
          <font color="#990000">初始</font> </td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="102" align="right"><font color="#000000">计数器地址:</font></td>
        <td colspan="2" width="256"> 
          <input type="text" name="path" size="30" maxlength="150" value="http://www.caiqing.net/counter">
          <font color="#990000">初始</font> </td>
      </tr>
      <tr bgcolor="#FFFFFF" align="center"> 
        <td colspan="3" height="47"> 
          <input type="submit" name="Submit" value="确定" class="button">
          <input type="reset" name="reset" value="重输" class="button">
          <input type="button" name="Submit2" value="关闭" class="button" onclick="javascript:window.close()">
        </td>
      </tr>
    </table>
    <br>
  </form>
  <p>&nbsp;</p>
</div>
</body>
<%
 conn.close()
 set conn=nothing
%>
</html>
<%
function add_user()
 dim user,start_date,title,web_url,path,count,ip_hits
 dim error,err_msg,back,fullpath
 dim sql,rs

 error=0
 
 start_date=now()
 user=trim(request.form("user"))
 title=trim(request.form("title"))
 web_url=trim(request.form("web_url"))
 path=trim(request.form("path"))
 count=trim(request.form("count"))
 ip_hits=trim(request.form("ip_hits"))

 if user=empty then error=3
 if title=empty then error=1
 if web_url=empty then web_url="http://"
 if path=empty then error=2
 if count=empty then count=0
 if ip_hits=empty then ip_hits=0
 if not isnumeric(count) then error=4
 if not isnumeric(ip_hits) then error=5

 if error<>0 then

  back="<a href='javascript:history.back()'>返回</a>"
 
  select case error
   case 1
    err_msg="网站名称不能为空!"&back
   case 2
    err_msg="计数器地址不能为空!"&back
   case 3
    err_msg="用户名称不能为空!"&back
   case 4
    err_msg="总访问次数必须为数字!"&back
   case 5
    err_msg="总IP次数必须为数字!"&back
  end select
    
   response.write err_msg 
   conn.close()
   set conn=nothing
   response.end

  else

  sql="select * from cnt_msg where user01='"&user&"'"
  set rs=conn.execute(sql)

   if not rs.eof then
    response.write "用户名已存在,请选择其它用户名!【<a href='javascript:history.back()'>返回</a>】"
    rs.close()
    conn.close()
    set rs=nothing
    set conn=nothing
    response.end
   end if
     
    sql="insert into cnt_msg (user01,title,web_url,path,count01,ip_hits,start_date,ave_count,ave_ip_hits) values "
    sql=sql&"('"&user&"','"&title&"','"&web_url&"','"&path&"',"&count&","&ip_hits&",'"&start_date&"',"&count&","&ip_hits&")"
    conn.execute(sql)
    response.write "加入新用户成功!!<p>"
    fullpath="<script src='"&path&"/counter.asp?user="&user&"'></script>"
    fullpath=server.htmlencode(fullpath)
    response.write "计数器连接代码:<p>"&fullpath
    conn.close()
    set conn=nothing
    response.end

  end if

end function
%>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -