I have a asp page called 'reg_confirm.asp'
The problem i am having is that everytime the page is refreshed the MySQL DB is updated (i.e. my insert statement is run).
How can i only allow this once?
Code:
<% ' Last Edit: CRM_08mar05 %>
<%
agencyid = Session("agencyid")
forename = request.form("forename")
surname = request.form("surname")
comp_name = request.form("comp_name")
position = request.form("position")
email = request.form("email")
agency_id = request.form("agency_id")
agent_id = request.form("agent_id")
user_name = request.form("user_name")
pass_word = request.Form("pass_word")
response.write "agency_id = " & agency_id & "<br>"
response.write "agent_id = " & agent_id & "<br>"
response.write "user_name = " & user_name & "<br>"
response.write "pass_word = " & pass_word & "<br>"
'response.write "Agency ID = " & agencyid & "<br>"
'response.write "Forename = " & forename & "<br>"
'response.write "Surname = " & surname & "<br>"
'response.write "Comp Name = " & comp_name & "<br>"
'response.write "Position = " & position & "<br>"
'response.write "Email = " & email & "<br>"
function fixquotes(str)
fixquotes=Replace(str,"'","")
end function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Terms & Conditions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
set rsreg=con.execute("insert into authusers_reg (agencyid,forename,surname,company_name,email,posi tion) values ('"& agencyid &"','"& fixquotes(forename) &"', '"& fixquotes(surname) &"', '"& comp_name &"', '"& email &"', '"& fixquotes(position) &"')")
'response.write "" &("insert into authusers_reg (agencyid,forename,surname,company_name,email,posi tion) values ('"& agencyid &"','"& forename &"', '"& surname &"', '"& comp_name &"', '"& email &"', '"& position &"')")& "<br>"
%>
<body bgcolor="#f5f5f5">
<form name="form">
<table width="550" bgcolor="#ECECEC" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="16" bgcolor="#ECECEC"><img src="images/top_lefbb.gif" width="16" height="16"></td>
<td height="16" bgcolor="#ECECEC" background="images/top_midbb.gif"><img src="images/top_midbb.gif" width="16" height="16"></td>
<td width="24" bgcolor="#ECECEC"><img src="images/top_rigbb.gif" width="24" height="16"></td>
</tr>
<tr>
<td width="16" background="images/cen_lef.gif"><img src="images/cen_lef.gif" width="16" height="11"></td>
<td><Table width="100%" border="1" bordercolor="#666666" align="center" cellpadding="0" cellspacing="1">
<tr bgcolor="#006699" bordercolor="#000000" border="1"><Td width="100%" align="Left"><span class="style1"><strong>Registration Confirmation</strong></span></td>
</tr>
<%
'forename = this.form.forename.value
'response.write "Forename = " & forename & "<br>"
%>
<tr>
<td height="25" align="center" bordercolor="#ececec" border="0">
Congratulations <%=forename & " " & surname %>,
</td>
</tr>
<tr><td height="25" align="center" bordercolor="#ececec" border="0">
You have successfully registered
</td>
</tr>
<tr bgcolor="#ececec" bordercolor="#ececec">
<td bgcolor="#ececec" bordercolor="#ececec" align="center">
<input type="button" name="finish" id="finish" value="Finish" onmouseover="style.cursor='hand'" onClick="location.href='logincheck.asp?agencyid=<% =agency_id%>&agentid=<%agent_id%>&username=<%=user _name%>&password=<%=pass_word%>'">
</td></tr>
<%
'finish = this.form.finish.value
'response.write "Finish = " & finish & "<br>"
'if request.form("finish") = "finish" then
'response.redirect "/mackenzie/login.asp"
'end if
%>
</table>
</td>
<td width="24" background="images/cen_rigBB.gif" bgcolor="#ECECEC"><img src="images/cen_rigBB.gif" width="24" height="11"></td>
</tr>
<tr bgcolor="#ECECEC">
<td width="16" height="16"><img src="images/bot_lefbb.gif" width="16" height="16"></td>
<td height="16" bgcolor="#ECECEC" background="images/bot_midbb.gif"><img src="images/bot_midbb.gif" width="16" height="16"></td>
<td width="24" height="16" bgcolor="#ECECEC"><img src="images/bot_rigbb.gif" width="24" height="16"></td>
</tr>
</table>
</form>
</body>
</html>
www.crmpicco.co.uk
www.milklemonadechocolate.uk.tt