高分求救 用asp写一个自动领取激活码的功能
高分求救用asp写一个自动领取激活码的功能1.后台能输入激活码2.激活码的领取次数可以后台控制(可是一次,多次,或者无限次)做好后分不是问题因为本人不是学习asp的所以不...
高分求救 用asp写一个自动领取激活码的功能
1.后台能输入激活码
2.激活码的领取次数可以后台控制(可是一次 ,多次,或者无限次)
做好后 分不是问题
因为本人不是学习asp的 所以 不是很会写 希望能写的朋友帮我写一个
我也只能用高分 答谢了(做完后可高分酬谢!!)
本人qq290273103 展开
1.后台能输入激活码
2.激活码的领取次数可以后台控制(可是一次 ,多次,或者无限次)
做好后 分不是问题
因为本人不是学习asp的 所以 不是很会写 希望能写的朋友帮我写一个
我也只能用高分 答谢了(做完后可高分酬谢!!)
本人qq290273103 展开
展开全部
今天上午无事,帮你写了几页:
1,建立新表:以Access为例,表一名activate,用户激活码使用表
Id(自动编号),UserId(用户ID),UserCode(激活码,文本),CodeFlag(数字,状态,0未激活1已激活),AcDate(日期,到期时间,默认值"now()")
表二名activateCode,系统发放的激活码表
Id(自动编号),UserId(领卡用户ID),AcCode(激活码,文本),CodeFlag(数字,使用状态,默认0未用1已领取)
在用户表中添加一字段,字段名UserCodeFlag,数字,初始值0,未激活,1已激活(未激活的用户在某些功能上受限,请自己添加)
2,设定激活码参数,激活码生成函数
共二函数:
CodeFunction.asp:
<%
Dim UserCodeAcnum,UserAcDate
UserCodeAcnum = 5'激活码可领取数
UserAcDate = 365'激活一次的有效果时间天数
Function GetActivateCode(str_len)'生成大写字母和数字混合型激活码
Dim Seed,SeedAry,Seed_Str,Seed_Str1,TempStr,i,m
str_len = Cint(str_len)
Seed_Str = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
Seed_Str1 = "0 1 2 3 4 5 6 7 8 9"
Seed = ""
Seed = Seed&Seed_Str& " " &Seed_Str1
SeedAry = Split(Seed," ")
m = Ubound(SeedAry)
TempStr = ""
Do While Len(TempStr) < str_len
Randomize Timer()
TempStr = TempStr & SeedAry(m*Rnd)
Loop
GetActivateCode = TempStr
End Function
'GetActivateValue(n,k):生成激活码并入库过程
'n:一次生成条数;k:激活码长度,最长不能超过50,20左右为宜
Sub GetActivateValue(n,k)
Dim i
For i = 1 to n
Conn.Execute("insert Into activateCode(AcCode)Values('"&GetActivateCode(k)&"')")
Next
'Conn.Close
End Sub
%>
3,管理员后台生成激活码页面:
ManageCard.asp
请替换下三行中的“???”,第一行为库链接文件
<!--#include file="???.asp"-->
<!--#include file="CodeFunction.asp"-->
<LINK href="???.css" type=text/css rel=stylesheet>
<%
Call Main()
Sub Main()
Call CodeCss()
Select Case Request("action")
Case "DelAllCard"
Call DelAllCard()
Case "DelNewCard"
Call DelNewCard()
Case "DelOldCard"
Call DelOldCard()
Case "SeeCard"
Call SeeCard()
Case "AddCode"
Call UpdateAccode()
Call ManageCode()
Case "Form_Dellall"
Call SetDellCard()
Case Else
Call ActivateMain()
Call ManageCode()
End Select
Conn.Close:Set Conn = Nothing
End Sub
Sub DelAllCard()
Call ActivateMain()
Call LinkList()
Response.Write "<div class=Listdiv>"& VbCrLf
Response.Write "<div style=""margin:30;"">"& VbCrLf
Response.Write "<form method=POST action=""?action=Form_Dellall"" name=form2>"& VbCrLf
Response.Write "确定删除所有激活卡吗?"& VbCrLf
Response.Write "<input type=""submit"" value="" 确定删除 "" name=""button2"">"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</div>"& VbCrLf
End Sub
Sub SetDellCard()
Conn.Execute("Delete From activateCode")
Response.redirect "ManageCard.asp"
End Sub
Sub DelNewCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub DelOldCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub SeeCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub LinkList()
Response.Write "<div><b>激活卡管理</b> <a href=?action=SeeCard>查看已用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelOldCard>删除已用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelNewCard>删除未用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelAllCard>删除全部激活卡</a><div>"& VbCrLf
End Sub
Sub ActivateMain()
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>生成激活卡</b></div>"& VbCrLf
Response.Write "<form method=POST action=""?action=AddCode"" name=form1>"& VbCrLf
Response.Write "<div>"& VbCrLf
Response.Write "选择激活卡生成张数:<select name=""CodeNum"">"& VbCrLf
Response.Write "<option value=""10"">10张</option>"& VbCrLf
Response.Write "<option value=""50"" selected>50张</option>"& VbCrLf
Response.Write "<option value=""100"">100张</option>"& VbCrLf
Response.Write "<option value=""500"">500张</option>"& VbCrLf
Response.Write "</select>"& VbCrLf
Response.Write "卡号长度:<select name=""CodeLen"">"& VbCrLf
Response.Write "<option value=""16"" selected>16字符</option>"& VbCrLf
Response.Write "<option value=""24"">24字符</option>"& VbCrLf
Response.Write "<option value=""32"">32字符</option>"& VbCrLf
Response.Write "</select>"& VbCrLf
Response.Write "<input type=""submit"" value="" 确定生成 "" name=""button1"">"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
'Response.Write "<DIV class=linediv1></DIV>"& VbCrLf
Response.Write "<DIV class=linediv></DIV>"& VbCrLf
End Sub
Sub UpdateAccode()
Dim CodeNumber,CodeLen
CodeNumber = Trim(Request("CodeNum"))
CodeLen = Trim(Request("CodeLen"))
If Isnumeric(CodeNum) = False Then Exit Sub
If Isnumeric(CodeLen) = False Then Exit Sub
CodeNumber = Cint(CodeNumber)
CodeLen = Cint(CodeLen)
Call GetActivateValue(CodeNumber,CodeLen)
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>激活卡生成成功!</b></div>"& VbCrLf
Response.Write "<form method=POST action= name=form2>"& VbCrLf
Response.Write "<div>"&CodeNumber&"张激活卡生成完成。<a href=""?action=Main"">继续生成激活卡</a>"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
Response.Write "<DIV class=linediv> </DIV>"& VbCrLf
End Sub
Sub ManageCode()
Dim MaxPage,totalPut,cPage,Infonum
if Request("page")<>"" then
cPage=cint(request("page"))
else
cPage=1
end if
Infonum = 1
Response.Write "<DIV Style=""width=:100%;margin:0;"">"& VbCrLf
Call LinkList()
Response.Write "<div class=Listdiv>"& VbCrLf
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select AcCode From activateCode Where CodeFlag=0 Order By Id Desc"
Rs.Open Sql,Conn,1,1
If Rs.eof and rs.bof then
Response.write "<p>暂时没有任何激活卡。" & VbCrLf
Else
i=0
MaxPage=30
totalPut=Rs.recordcount
InfoNum = totalPut-(CPage-1)*MaxPage
If InfoNum <100 And InfoNum >9 Then InfoNum = "0"&InfoNum
If InfoNum <10 Then InfoNum = "00"&InfoNum
Do while not Rs.eof
i = i+1
Response.Write "<li class=li1>"&Infonum&") "&Rs(0)&"</li>"& VbCrLf
If i >= MaxPage Then Exit Do
Rs.movenext
InfoNum = InfoNum-1
If InfoNum <100 And InfoNum >9 Then InfoNum = "0"&InfoNum
If InfoNum <10 Then InfoNum = "00"&InfoNum
Loop
End If
Rs.Close:Set Rs = Nothing
Response.Write "<div>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
End Sub
Sub CodeCss()
Response.Write "<style type=""text/css"">"& VbCrLf
Response.Write "BODY {margin:0;Padding:0;COLOR:#444;font-family:宋体;font-size: 9pt }"& VbCrLf
Response.Write "input {border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt; COLOR:#333;line-height:14px}"& VbCrLf
Response.Write "textarea {border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt;}"& VbCrLf
Response.Write "select {border-width: 1; border-color: #000; background-color: #eee; font-family: 宋体; font-size: 9pt;}"& VbCrLf
Response.Write "A {COLOR: #444;font-family:Verdana}"& VbCrLf
Response.Write "A:link {color:0000aa;TEXT-DECORATION: none }"& VbCrLf
Response.Write "A:visited {color:0000aa;TEXT-DECORATION: none }"& VbCrLf
Response.Write "A:hover {COLOR: #ff2200;TEXT-DECORATION: none }"& VbCrLf
Response.Write ".headdiv{height:80px;width:100%;margin:0;padding:10;background:#f8f8f8}"& VbCrLf
Response.Write ".Linediv1{border-bottom: #ccc 2px solid;width:100%;margin:0;padding:0;line-heignt:1px;;height:1px}"& VbCrLf
Response.Write ".Linediv{border-top: #999 1px solid;width:100%;margin:0;padding:0;line-heignt:1px;height:1px}"& VbCrLf
Response.Write ".Listdiv{width:480px;padding:10;background:#eee}"& VbCrLf
Response.Write ".li1{width:250px;line-height:16px;font-size:12px;list-style:none;color:069}"& VbCrLf
Response.Write "</style>"& VbCrLf
End Sub
%>
耽误了好几个小时,我也该去做点其他的事了,把分给我了再写吧,记得加精彩回答哦,否则懒得写了。
1,建立新表:以Access为例,表一名activate,用户激活码使用表
Id(自动编号),UserId(用户ID),UserCode(激活码,文本),CodeFlag(数字,状态,0未激活1已激活),AcDate(日期,到期时间,默认值"now()")
表二名activateCode,系统发放的激活码表
Id(自动编号),UserId(领卡用户ID),AcCode(激活码,文本),CodeFlag(数字,使用状态,默认0未用1已领取)
在用户表中添加一字段,字段名UserCodeFlag,数字,初始值0,未激活,1已激活(未激活的用户在某些功能上受限,请自己添加)
2,设定激活码参数,激活码生成函数
共二函数:
CodeFunction.asp:
<%
Dim UserCodeAcnum,UserAcDate
UserCodeAcnum = 5'激活码可领取数
UserAcDate = 365'激活一次的有效果时间天数
Function GetActivateCode(str_len)'生成大写字母和数字混合型激活码
Dim Seed,SeedAry,Seed_Str,Seed_Str1,TempStr,i,m
str_len = Cint(str_len)
Seed_Str = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
Seed_Str1 = "0 1 2 3 4 5 6 7 8 9"
Seed = ""
Seed = Seed&Seed_Str& " " &Seed_Str1
SeedAry = Split(Seed," ")
m = Ubound(SeedAry)
TempStr = ""
Do While Len(TempStr) < str_len
Randomize Timer()
TempStr = TempStr & SeedAry(m*Rnd)
Loop
GetActivateCode = TempStr
End Function
'GetActivateValue(n,k):生成激活码并入库过程
'n:一次生成条数;k:激活码长度,最长不能超过50,20左右为宜
Sub GetActivateValue(n,k)
Dim i
For i = 1 to n
Conn.Execute("insert Into activateCode(AcCode)Values('"&GetActivateCode(k)&"')")
Next
'Conn.Close
End Sub
%>
3,管理员后台生成激活码页面:
ManageCard.asp
请替换下三行中的“???”,第一行为库链接文件
<!--#include file="???.asp"-->
<!--#include file="CodeFunction.asp"-->
<LINK href="???.css" type=text/css rel=stylesheet>
<%
Call Main()
Sub Main()
Call CodeCss()
Select Case Request("action")
Case "DelAllCard"
Call DelAllCard()
Case "DelNewCard"
Call DelNewCard()
Case "DelOldCard"
Call DelOldCard()
Case "SeeCard"
Call SeeCard()
Case "AddCode"
Call UpdateAccode()
Call ManageCode()
Case "Form_Dellall"
Call SetDellCard()
Case Else
Call ActivateMain()
Call ManageCode()
End Select
Conn.Close:Set Conn = Nothing
End Sub
Sub DelAllCard()
Call ActivateMain()
Call LinkList()
Response.Write "<div class=Listdiv>"& VbCrLf
Response.Write "<div style=""margin:30;"">"& VbCrLf
Response.Write "<form method=POST action=""?action=Form_Dellall"" name=form2>"& VbCrLf
Response.Write "确定删除所有激活卡吗?"& VbCrLf
Response.Write "<input type=""submit"" value="" 确定删除 "" name=""button2"">"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</div>"& VbCrLf
End Sub
Sub SetDellCard()
Conn.Execute("Delete From activateCode")
Response.redirect "ManageCard.asp"
End Sub
Sub DelNewCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub DelOldCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub SeeCard()
Call ActivateMain()
Call LinkList()
End Sub
Sub LinkList()
Response.Write "<div><b>激活卡管理</b> <a href=?action=SeeCard>查看已用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelOldCard>删除已用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelNewCard>删除未用激活卡</a>"& VbCrLf
Response.Write " <a href=?action=DelAllCard>删除全部激活卡</a><div>"& VbCrLf
End Sub
Sub ActivateMain()
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>生成激活卡</b></div>"& VbCrLf
Response.Write "<form method=POST action=""?action=AddCode"" name=form1>"& VbCrLf
Response.Write "<div>"& VbCrLf
Response.Write "选择激活卡生成张数:<select name=""CodeNum"">"& VbCrLf
Response.Write "<option value=""10"">10张</option>"& VbCrLf
Response.Write "<option value=""50"" selected>50张</option>"& VbCrLf
Response.Write "<option value=""100"">100张</option>"& VbCrLf
Response.Write "<option value=""500"">500张</option>"& VbCrLf
Response.Write "</select>"& VbCrLf
Response.Write "卡号长度:<select name=""CodeLen"">"& VbCrLf
Response.Write "<option value=""16"" selected>16字符</option>"& VbCrLf
Response.Write "<option value=""24"">24字符</option>"& VbCrLf
Response.Write "<option value=""32"">32字符</option>"& VbCrLf
Response.Write "</select>"& VbCrLf
Response.Write "<input type=""submit"" value="" 确定生成 "" name=""button1"">"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
'Response.Write "<DIV class=linediv1></DIV>"& VbCrLf
Response.Write "<DIV class=linediv></DIV>"& VbCrLf
End Sub
Sub UpdateAccode()
Dim CodeNumber,CodeLen
CodeNumber = Trim(Request("CodeNum"))
CodeLen = Trim(Request("CodeLen"))
If Isnumeric(CodeNum) = False Then Exit Sub
If Isnumeric(CodeLen) = False Then Exit Sub
CodeNumber = Cint(CodeNumber)
CodeLen = Cint(CodeLen)
Call GetActivateValue(CodeNumber,CodeLen)
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>激活卡生成成功!</b></div>"& VbCrLf
Response.Write "<form method=POST action= name=form2>"& VbCrLf
Response.Write "<div>"&CodeNumber&"张激活卡生成完成。<a href=""?action=Main"">继续生成激活卡</a>"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
Response.Write "<DIV class=linediv> </DIV>"& VbCrLf
End Sub
Sub ManageCode()
Dim MaxPage,totalPut,cPage,Infonum
if Request("page")<>"" then
cPage=cint(request("page"))
else
cPage=1
end if
Infonum = 1
Response.Write "<DIV Style=""width=:100%;margin:0;"">"& VbCrLf
Call LinkList()
Response.Write "<div class=Listdiv>"& VbCrLf
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select AcCode From activateCode Where CodeFlag=0 Order By Id Desc"
Rs.Open Sql,Conn,1,1
If Rs.eof and rs.bof then
Response.write "<p>暂时没有任何激活卡。" & VbCrLf
Else
i=0
MaxPage=30
totalPut=Rs.recordcount
InfoNum = totalPut-(CPage-1)*MaxPage
If InfoNum <100 And InfoNum >9 Then InfoNum = "0"&InfoNum
If InfoNum <10 Then InfoNum = "00"&InfoNum
Do while not Rs.eof
i = i+1
Response.Write "<li class=li1>"&Infonum&") "&Rs(0)&"</li>"& VbCrLf
If i >= MaxPage Then Exit Do
Rs.movenext
InfoNum = InfoNum-1
If InfoNum <100 And InfoNum >9 Then InfoNum = "0"&InfoNum
If InfoNum <10 Then InfoNum = "00"&InfoNum
Loop
End If
Rs.Close:Set Rs = Nothing
Response.Write "<div>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
End Sub
Sub CodeCss()
Response.Write "<style type=""text/css"">"& VbCrLf
Response.Write "BODY {margin:0;Padding:0;COLOR:#444;font-family:宋体;font-size: 9pt }"& VbCrLf
Response.Write "input {border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt; COLOR:#333;line-height:14px}"& VbCrLf
Response.Write "textarea {border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt;}"& VbCrLf
Response.Write "select {border-width: 1; border-color: #000; background-color: #eee; font-family: 宋体; font-size: 9pt;}"& VbCrLf
Response.Write "A {COLOR: #444;font-family:Verdana}"& VbCrLf
Response.Write "A:link {color:0000aa;TEXT-DECORATION: none }"& VbCrLf
Response.Write "A:visited {color:0000aa;TEXT-DECORATION: none }"& VbCrLf
Response.Write "A:hover {COLOR: #ff2200;TEXT-DECORATION: none }"& VbCrLf
Response.Write ".headdiv{height:80px;width:100%;margin:0;padding:10;background:#f8f8f8}"& VbCrLf
Response.Write ".Linediv1{border-bottom: #ccc 2px solid;width:100%;margin:0;padding:0;line-heignt:1px;;height:1px}"& VbCrLf
Response.Write ".Linediv{border-top: #999 1px solid;width:100%;margin:0;padding:0;line-heignt:1px;height:1px}"& VbCrLf
Response.Write ".Listdiv{width:480px;padding:10;background:#eee}"& VbCrLf
Response.Write ".li1{width:250px;line-height:16px;font-size:12px;list-style:none;color:069}"& VbCrLf
Response.Write "</style>"& VbCrLf
End Sub
%>
耽误了好几个小时,我也该去做点其他的事了,把分给我了再写吧,记得加精彩回答哦,否则懒得写了。
AiPPT
2024-09-19 广告
2024-09-19 广告
作为北京饼干科技有限公司的工作人员,关于AIPPT免费生成PPT的功能,我可以简要介绍如下:AIPPT是一款基于人工智能技术的PPT制作工具,它为用户提供了免费生成PPT的便捷服务。用户只需简单输入PPT的主题或内容大纲,AIPPT便能智能...
点击进入详情页
本回答由AiPPT提供
展开全部
露脊鲸还在不停的玩着杂耍。
欧姆正在一步一步向露脊鲸靠近,BBC Jeans。
国际在线专稿:据英国《逐日邮报》报道,近日一位名叫阿克赛尔?欧姆(Axel Ohm)的冲浪运发动和世界上最宏大动物之一的鲸鱼在海面上来了个“密切接触”。
欧姆的朋友,德国摄影师迈克尔?波力查(Michael Poliza)当时正在离南非西开普敦邻近的海面上拍摄欧姆在安静的水面上泛船的气象,忽然一头露脊鲸从海面下窜了出来。欧姆被这壮观的气象所迷住,他迟缓的向露脊鲸移动。
波力查后来回想道:“这头露脊鲸前后五次从水中跃起,就像在玩杂耍一般。我想它是感到到了欧姆的存在,随后便想弄明白欧姆到底是何物。”
成年的露脊鲸体重接近40吨,Armani Jeans,露脊鲸一度几乎要在地球上尽迹,GHD IV Salon Styler。(海澜)
进进图酷首页观看更多出色图片
华为推入门级智能手机Ideos:定价100美元起
内地首条6代线试产 32英寸液晶屏实现中国造
医生冒险超常规用药抢救病危高管
欧姆正在一步一步向露脊鲸靠近,BBC Jeans。
国际在线专稿:据英国《逐日邮报》报道,近日一位名叫阿克赛尔?欧姆(Axel Ohm)的冲浪运发动和世界上最宏大动物之一的鲸鱼在海面上来了个“密切接触”。
欧姆的朋友,德国摄影师迈克尔?波力查(Michael Poliza)当时正在离南非西开普敦邻近的海面上拍摄欧姆在安静的水面上泛船的气象,忽然一头露脊鲸从海面下窜了出来。欧姆被这壮观的气象所迷住,他迟缓的向露脊鲸移动。
波力查后来回想道:“这头露脊鲸前后五次从水中跃起,就像在玩杂耍一般。我想它是感到到了欧姆的存在,随后便想弄明白欧姆到底是何物。”
成年的露脊鲸体重接近40吨,Armani Jeans,露脊鲸一度几乎要在地球上尽迹,GHD IV Salon Styler。(海澜)
进进图酷首页观看更多出色图片
华为推入门级智能手机Ideos:定价100美元起
内地首条6代线试产 32英寸液晶屏实现中国造
医生冒险超常规用药抢救病危高管
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
150块钱还能帮你写下……
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询