<% Dim i,ErrorMsg,x x=0 Redim Msg(5) ReDim arInput(5) arInput(0) = Request.Form("txtUsername") arInput(1) = Request.Form("txtPassword1") arInput(2) = Request.Form("txtPassword2") arInput(3) = Request.Form("txtEmail") arInput(4) = Request.Form("optGender") 'arInput(5) = Request.Form("iGM") If Request.Form("btnRegister") = "Register" Then Response.Write "" If CheckUser(arInput(0)) Then Response.Write "Username already exists!" Response.end End if 'make sure any of the textboxes is not left blank for i=0 To UBound(arInput)-1 If arInput(i)="" Then Msg(1)="Please fill up the form completely," &_ " we cannot process incomplete forms!
" Exit for End if Next 'email format check if InStr(1,arInput(3),"@")=0 or InStr(1,arinput(3),".")=0 then Msg(2) = "Your email is incorrect...! (" &arInput(3)&")
" end If If Len(arInput(0))< 4 Or len(arInput(1)) < 6 Then Msg(3) = "Your username/password does not meet the " &_ "minimum number of characters required.
" End if 'compares password if the same If not strComp(arInput(1),arInput(2),1)=0 Then Msg(4) = "Oh common.... input password did not match!
" End If For Each ErrorMsg In Msg If not Len(ErrorMsg)=0 Then x=x+1 Response.Write x &". " &ErrorMsg End if next If x=0 Then 'Response.write CheckUser(arInput(0)) RegisterAccount(arInput) Response.Write "Your account with the following "&_ "info was successfully created!
" Response.Write "Username: " &arInput(0) &"
" If arInput(4)=1 Then Response.Write "Gender: Male
" Else Response.Write "Gender: Female
" End if Response.Write "Email: " &arInput(3) &"
" Response.End End if End If '------------------------------------------------------------- Function RegisterAccount(AccountArray) 'write the account info to vadd.txt '------------------------------------------------------------- Dim fso, f,sdata,GM GM=0 sdata=Array(AccountArray(0),AccountArray(1),AccountArray(4),AccountArray(3),GM) Const vAdd = "\Lolo-5ttevlxhuh\I:\vAdd.txt" Const ForAppending = 8 Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(vAdd, ForAppending, True) f.Writeline Join(sdata,",") f.Close End Function '------------------------------------------------------------- Function CheckUser(user) 'check the user if it exists '------------------------------------------------------------- Dim fso, f, f1, fc, s,files,colUser,strUser CheckUser=false Const vAccount = "\Lolo-5ttevlxhuh\I:\vPlayer" Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(vAccount) Set fc = f.Files For Each f1 in fc Set files = fso.OpenTextFile(vAccount &"\"&f1.name, ForReading) colUser = split(files.ReadLine,",") strUser=Trim(colUser(1)) If StrComp(strUser,user,0)=0 Then CheckUser=true Set files = Nothing Set fso=Nothing Set f=Nothing Set fc=nothing Exit function End If Next Set files = nothing Set fso=Nothing Set f=Nothing Set fc=nothing End function %>