邮箱注册机这些东西很多,一般都是写成桌面应用程序的,很少有人写成web程序吧,至少我没见到过。
今天我就来写一个web版的示例,而且用这个貌似有点过时了的asp来写。web程序有个好处,就是外出时,
带个手机能上网就行了,随时随地的方便呀!!
下面看几张效果图:
程序源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sohu邮箱注册机 - ASP高级编程 - [By EnVon]</title>
<%
response.expires= -1
response.addheader "pragma","no-cache"
response.AddHeader "cache-control","no-store"
%>
<!-- #include file="inc/Ev_HttpRequest.asp" -->
</head>
<body>
<%
'|---------------------------------------------------------------------------
'|
'| ASP写邮箱注册机,SOHU邮箱注册机,[By EnVon,QQ:407542585] [2012愚人节]
'|
'| 注意:sohu注册是有限制的,注册几个之后就不能注册了,
'| 这样也好,不让一些人拿去刷账号;本源码供学习交流吧,貌似现在很少人用asp了!
'|
'|---------------------------------------------------------------------------
'|
Dim doAction,http
Set http=New Ev_HttpRequest
doAction=Request("doAction")
Select Case Lcase(doAction)
Case "getcode"
Call GetVerCode()
Case "reg"
Call RegAccount()
Case Else
Call ShowRegForm()
End Select
Private Function RegAccount()
Dim pUrl,pData,pRef,pCok,Data,uName,uPass,uCode
uCode=Request("verCode")
If Len(uCode)>0 Then
'生成注册信息
uName=Lcase(Ev_RndString(6))&Ev_RndNumber(5)
uPass=Ev_RndString(8)
pUrl="http://passport.sohu.com/web/Passportregister.action"
pData="shortname="&uName&"&domainName=sohu.com&user.password="&uPass&"&password2="&uPass&"&validate="&uCode
pData=pData&"&uuidCode=&app_para=appid%3D1000&ot_registerid=®isterid=&appid=1000&autologin=1"
pData=pData&"&ru=http%3A%2F%2Fmail.sohu.com%2Freg%2Fsignup_success.jsp®isterType=Passport&showAllType=0"
pRef="http://passport.sohu.com/web/dispatchAction.action?appid=1000&ru=http://mail.sohu.com/reg/signup_success.jsp"
pCok="JSESSIONID="&Session("sohu_JSESSIONID")
'提交注册表单
Data=http.PostData(pUrl, pData, pRef, pCok, "gb2312", "", 0)
If Instr(Data,"恭喜您,已经成功注册") Then
'注册成功
Session("sohu_succ_total")=1+Session("sohu_succ_total")
Call Ev_SaveToFile(Server.MapPath("sohu.txt"), "成功"&chr(9)&uName&chr(9)&uPass&vbCrlf,8)
Else
'注册失败
Session("sohu_fail_total")=1+Session("sohu_fail_total")
Call Ev_SaveToFile(Server.MapPath("sohu.txt"), "失败"&chr(9)&uName&chr(9)&uPass&vbCrlf,8)
End If
Session("sohu_nearly_account")=uName & " - " & uPass
End If
'清除http对象
Call http.ClearHttpObject
Response.Redirect "?doAction=show"
End Function
Private Sub GetVerCode()
Dim gUrl,Header,Data,JSESSIONID
Call http.ClearHttpObject
Set http=New Ev_HttpRequest
'取得会话JSESSIONID
gUrl="http://passport.sohu.com/web/dispatchAction.action?appid=1000&ru=http://mail.sohu.com/reg/signup_success.jsp"
Data=http.GetData(gUrl, "", "", "gb2312", Header, 0)
JSESSIONID=EV_Mid(Header, "Set-Cookie: JSESSIONID=", ";", 1, 0)
Session("sohu_JSESSIONID")=JSESSIONID
'取验证码
gUrl="http://passport.sohu.com/servlet/Captcha?time=0.76085387"&Ev_RndNumber(8)
Call http.GetVerifyImage(gUrl, "", "", header, 0)
End Sub
Private Sub ShowRegForm()
%>
搜狐邮箱注册机ASP版,随时随地,手机上网也可以注册邮箱啦!<br />
注册结果保存在当前目录sohu.txt文件。<br />
<form action="" method="get">
<img src="?doAction=getCode" style="width:180px;height:80px;border:1px solid #000000;" />
<br /><br />
注册成功:<%=NUM(Session("sohu_succ_total"))%>
<br />
注册失败:<%=NUM(Session("sohu_fail_total"))%>
<br />
最新账号:<%=Session("sohu_nearly_account")%>
<br /><br />
请输入验证码:<input type="text" name="verCode" />
<input type="submit" value="注册" />
<input type="hidden" name="doAction" value="reg" />
</form>
<%
End Sub
Public Function NUM(s)
If Len(""&