|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
因为ASP脚本语言非常简单,因此其代码也简单易懂,结合HTML代码,可快速地完成网站的应用程序。还无法完全实现一些企业级的功能:完全的集群、负载均横。ThisarticleGeneratesapasswordrandom,RequiresadatabaseandMailsthePassword.
<%@language="vbscript"%>
******************************
<%
codebyManikantan
WebDeveloper
3rdAgenda
Nungambakkam,ChennaiIndia
%>
<%
setmail=server.CreateObject("cdonts.newmail")
mail.subject="ThankYouforRegistering"
mail.to=mailidmail.from="Webmaster@thesite"
mail.body="ThisistheInitialPasswordtooursite...."&vbcrlf
&href=mailto:mailid="user@ursite.com>mailid="user@ursite.com"
address="address"
otherdatalikephonenumberasperthememberdatabaseinthesite
allthesevaluesareobtainedfromtherequestmethodfroma.htmwhichsubmitstothisfile
Mainlyemployedinregistration
AssumesYouhavecdonts.dllinstalledinthewebserver.
setconn=server.CreateObject("adodb.connection")
conn.Open"dsn","uid","pwd"
setrec=conn.Execute("selectcount(*)frommembertable")
id=cint(rec.fields(0))+1
r=rnd*50
Response.Writer&"<br>"
fori=0to20
ifcint(r)>0andcint(r)<26thenstr=str+chr(97+cint(r))
r=rnd*100
next
Response.Writestr
pwd=left(str,2)
pwd=pwd&id
pwd=pwd&right(str,2)
pwd=pwd&second(time)
AnUpdateQuerycanbePassedfromherefortheusername,passwordandotherdetailsorcanbetriggered
fromanotherpagewhentheuserrespondstothemail...Somethinglikesendingaurlasamailandon
clickoftheurlinthemail..callanotherpagewhichupdates..sowecanbesurethatonlyconfirmed
usersareupdated
%>
<br>
<%
setmail=server.CreateObject("cdonts.newmail")
mail.subject="ThankYouforRegistering"
mail.to=mailid
mail.from="Webmaster@thesite"
mail.body="ThisistheInitialPasswordtooursite...."&vbcrlf&"ChangeitifYouWant"&vbcrlf&
pwd&vbcrlf&"ThankYouforUsingtheSite"
mail.send
%>
TheNewPasswordhasbeenMailed.
使用filesystemobject,可以对服务器上的文件进行操作,浏览、复制、移动、删除等。有ado的支持,asp对数据库的操作非常得心应手。你甚至可以像使用本地数据库那样,管理远程主机上的数据库,对表格、记录进行各种操作。 |
|