Mailbox Authentication Code A
<title>example30</title>
<%
function chkemail (email) ' Define Process
Chkemail=true ' initialization function result
Names=split (email, "@") ' The Split function is to split the string into multiple substrings with the specified characters and save the substrings in a one-dimensional array
If UBound (names) <>1 Then ' UBound function returns the maximum subscript of an array
Chkemail=false ' message Format error, return False
Exit function ' jump out of process
End If
For each name in names ' for Each loop statement
The If Len (name) <=0 Then ' len function gets the length of the string
Chkemail=false ' message Format error, return False
Exit function ' jump out of process
End If
Next
End Function ' The definition of the ending procedure
%>
<body>
<form method= "POST" action= "example30.asp" name = form1>
<p align= "center" > Please input e-mail: <input type= "text" name= "email" size= "value=<%=request.form" ("email")%> ></p>
<p align= "center" ><input type= "Submit" value= "confirm" name= "Submit" ></p>
</form>
<%
If Request.Form ("submit") = "OK" Then ' click OK ' button
Email=request.form ("email") ' Read the input string
If Chkemail (email) Then ' calls Chkemail procedure
Response.Write (' <script>alert (' message format ') </scirpt> ') ' Returns True, prompt is properly formatted
Else ' returns false
Response.Write (' <script>alert (' message Format error ') </script> ') ' Prompt format error
End If
End If
%>
</body>
Mailbox Authentication Code Two
<title>example31</title>
<body>
<form method= "POST" action= "example31_index.asp" name = form1>
<p align= "center" > Please input e-mail: <input type= "text" name= "email" size= "value=<%=request.form" ("email")%> ></p>
<p align= "center" ><input type= "Submit" value= "confirm" name= "Submit" ></p>
</form>
<%
If Request.Form ("submit") = "OK" Then ' click OK ' button
Email=request.form ("email") ' Read the input string
If Chkemail (email) Then ' calls Chkemail procedure
Response.Write (' <script>alert (' message format ') </scirpt> ') ' Returns True, prompt is properly formatted
Else ' returns false
Response.Write (' <script>alert (' message Format error ') </script> ') ' Prompt format error
End If
End If
%>
</body>