<% function generate() dim randomTemp dim random for i=0 to 5 randomTemp = randomNumber(97,122) random = random & chr(randomTemp) next generate = random end function function randomNumber(min, max) dim range range = max - min randomize randomNumber = int(range*rnd) + min end function %>

<% custFirstName = request.form("custFirstName") custLastName = request.form("custLastName") custDOB = request.form("DOBMth") & "/" & request.form("DOBDay") & "/" & request.form("DOBYr") custDOR = now() custAdd = request.form("custAdd") custCountry = request.form("custCountry") custPostal = request.form("custPostal") custContactNo = request.form("custContactNo") custEmail = request.form("custEmail") password = generate() sqlQuery = "SELECT custEmail FROM customer where custEmail='" & custEmail & "'" Set conn = Server.CreateObject("ADODB.Connection") conn.Open "shopusersdb" Set Connection = conn Set rs = conn.Execute(sqlQuery) if rs.EOF then sqlQuery = "INSERT INTO customer (custEmail,password,custFirstName,custLastName,custDOR,custDOB,custAdd,custCountry,custPostal,custContactNo,credits,custType) VALUES('" & custEmail & "','" & password & "','" & custFirstName & "','" & custLastName & "','" & custDOR & "','" & custDOB & "','" & custAdd & "','" & custCountry & "','" & custPostal & "','" & custContactNo & "'," & "0,'NORMAL')" conn.Execute(sqlQuery) result = "1" dim objSendmail message = "=============================
" _ & "shop.CheekyIdeas.com
" _ & "=============================

" _ & "Dear " & custFirstName & ",
" _ & "Thank you for signing up with shop.cheekyideas.com

" _ & "Please use the following details to login.

" _ & "Your UserID: " & custEmail & "
" _ & "Your Password: " & password & "

" _ & "Start shopping now!

" _ & "Yours cheekily,

" _ & "Charmaine

" _ & "shop.CheekyIdeas.com" Set objSendmail = CreateObject("CDONTS.NewMail") With objSendmail .MailFormat = 0 .BodyFormat = 0 .From = "shop@cheekyideas.com" .to = custEmail .bcc = "ian@cheekyideas.com" .Subject = "<--shop.CheekyIdeas.com-Registration Confirmation-->" .Body ="" & message & "" .Send End With set objSendmail = NOTHING else result = "0" end if rs.close conn.close set rs = nothing set conn = nothing response.redirect("registerSummary.asp?result=" & result) %>