2013年9月6日 星期五

asp-register , asp-if-then-elseif-else-end if (if in file.asp)

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE><%= pageTitle %></TITLE>
</HEAD>
<BODY bgcolor="32C800">
<CENTER>
<A href="http://localhost/index.asp">
<IMG SRC="/images/logo.gif" ALT="Primary Outpost Logo" HEIGHT="67" WIDTH="496" border=0></A>
<BR clear="left">
<A href="/news/news.asp">
<IMG SRC="/images/news.gif" BORDER=0 ALIGN="middle" ALT="News" HEIGHT="39" WIDTH="39"></A>
<A href="/news/archives.asp">
<IMG SRC="/images/archives.gif" BORDER=0 ALIGN="middle" ALT="Archived News" HEIGHT="39" WIDTH="39"></A>
<A href="/bazaar/bazaar.asp">
<IMG SRC="/images/bazaar.gif" BORDER=0 ALIGN="middle" ALT="The Bazaar" HEIGHT="39" WIDTH="39"></A>
<A href="/auction/auctions.asp">
<IMG SRC="/images/auction.gif" BORDER=0 ALIGN="middle" ALT="Auctions" HEIGHT="39" WIDTH="39"></A>
<A href="/mySpace/mySpace.asp">
<IMG SRC="/images/myspace.gif" BORDER=0 ALIGN="middle" ALT="mySpace" HEIGHT="39" WIDTH="39"></A>
<A href="/register.asp">
<IMG SRC="/images/register.gif" BORDER=0 ALIGN="middle" ALT="Register" HEIGHT="39" WIDTH="39"></A>
<BR clear="left">
<P>
</CENTER>
<%
On Error Resume Next
p_userid = Request("p_name")
p_pass1 = Request("p_pass1")
p_pass2 = Request("p_pass2")
p_first = Request("p_first")
p_last = Request("p_last")
p_email = Request("p_email")
if p_pass1 = p_pass2 then
set outpostDB = server.createObject("ADODB.Connection")
outpostDB.open "outpost"
theSQL = "insert into members "
theSQL = theSQL & "(username, password, first_name, last_name, "
theSQL = theSQL & "email, believes_in_aliens)"
theSQL = theSQL & " values ('"&p_userid&"', '"&p_pass1&"', '"
theSQL = theSQL & p_first&"', '"&p_last&"', '"&p_email&"', '"
theSQL = theSQL & p_believes_in_aliens&"')"
outpostDB.Execute(theSQL)
for each p_medium in Request("p_medium")
theSQL = "insert into userid_medium (userid, medium) values ('"
theSQL = theSQL & p_userid&"', '"&p_medium&"')"
outpostDB.Execute(theSQL)
next
outpostDB.close
set outpostDB = Nothing
%>
<!--asp-if-->
<%      if Err.number = 0 then 
'All is well with the world %>
<H2>User Registration</H2>
Thank you for registering with Primary Outpost!
<%      else %>
'There was a problem with their registration
<H2>Problem</H2>
There was a problem with your registration.
Please go back and choose a different username.
<%      end if
else
'p_pass1 doesn't match p_pass2
%>
<H2>Password Error</H2>
Both entries for your password must match.
Please try again.  Thank you!
<%
end if
%>
</BODY>
</HTML>

沒有留言:

張貼留言