<%bstr=Server.MapPath( "l") bstr=left(bstr,len(bstr)-2) helpfilestr=bstr+"\help.htm" clubstr=mid(bstr,instr(bstr,"group")+6,99) if left(bstr,10)="C:\Inetpub" then bstr=left(bstr,instr(bstr,"group")-1)+"data1\"+clubstr+"_" else bstr=left(bstr,instr(bstr,"group")-1)+"data\"+clubstr+"_" end if Server.ScriptTimeout = 300 homepagefilestr=bstr+"homepage.txt" rem check case of key words rem increase width of Username in Admin page rem highlight data within text messages rem text font of middle initial Dim fieldsize,fieldstart,fieldnames,fieldtype,ub,recorddata,formstr,certstr,certuserstr,fstr Dim rec,reportdatastr,fieldnum, certlevel actionstr=trim(request.querystring()) Nldsessionid= Request.Cookies("NLDSESSIONID") certfilestr=bstr+"certificate.txt" debugfilestr=bstr+"debug.txt" passwordfilestr=bstr+"password.txt" logfilestr=bstr+"log.txt" eventfilestr=bstr+"events.txt" eventarchivefilestr=bstr+"eventsarchive.txt" memberfilestr=bstr+"members.txt" memberarchivefilestr=bstr+"membersarchive.txt" activityfilestr=bstr+"activities.txt" adminfilestr=bstr+"parameters.txt" Set fieldnum = CreateObject("Scripting.dictionary") if mid(actionstr,1,1)="0" then actionstr=mid(actionstr,2,99) tmp=getrecno(certfilestr,"Nldsessionid`EQU`" & trim(Nldsessionid)) if tmp<>-1 then fstr=bstr+getfield(2) temp=putfield(certfilestr,tmp,"Certexpires",cstr(dateadd("s",-60,now))) end if end if if actionstr="" then rem or (len(Nldsessionid)<24 and actionstr<>"l") set homepagefile = CreateObject("Scripting.FileSystemObject").OpenTextFile(homepagefilestr) tmp=homepagefile.read(1) if tmp="*" then Response.Redirect homepagefile.readline else response.write tmp while homepagefile.AtEndOfStream=FALSE astr=homepagefile.read(1) if astr="~" then astr=chr(13) end if response.write astr wend end if homepagefile.close else Set fsd = CreateObject("Scripting.FileSystemObject") set debugfile = fsd.CreateTextFile(debugfilestr,TRUE) debugfile.writeline "Enter Main_page" debugfile.writeline z1 debugfile.close temp=doaction() temp=footer() end if function killit(killstr) Set fsd = CreateObject("Scripting.FileSystemObject") set tmpfile = fsd.CreateTextFile(killstr,TRUE) tmpfile.close end function function logon() formstr=replace(request.form("formdata"),"¬¬¬","&") actionstr=request.form("Action") usernamestr=request.form("Username") passwordstr=request.form("Password") newpasswordstr=request.form("Newpassword") newpassword2str=request.form("Newpassword2") if newpasswordstr<>newpassword2str then tmp=logact("-","Passwords don't match: "+Usernamestr) temp=userinformation("The Newpassword and the repeated Newpassword need to be identical. The orginal password has not been changed. Please try changing the orginal password again.") logon=false exit function end if if newpasswordstr<>"" then if validstr(newpasswordstr)=0 or newpasswordstr=usernamestr then tmp=logact("-","Password not valid: "+Usernamestr) temp=userinformation("Change of password failed. For security reasons, new passwords must be from 5 to 10 characters long and contain upper/ lower case letters and numbers. Password must contain at least one letter and one number and must not be the same as the Username.") logon=false exit function end if end if tmplog=getrecno(passwordfilestr,"Username`EQU`" + Usernamestr) if tmplog<>-1 then if getrecorddata("Password")=trim(passwordstr) then certexpires=dateadd("s",15*60,now) certuserstr=Usernamestr certgroup="" certlevel=getrecorddata("Profile") fstr=bstr+certuserstr criteriastr="Username`EQU`" & certuserstr if getrecno(memberfilestr,criteriastr)<>-1 then certgroup=getrecorddata("Subgroup") if getrecorddata("Approve")="U" then temp=userinformation("Logon failed because the Member details are Unapproved. Contact your Administrator to Approve your Member details.") temp=logact(certuserstr,"Logon failed because Member record is Unapproved") logon=false exit function end if tmp1=getrecorddata("Renewal_date") if ubound(split(tmp1,":"))<>2 and instr("COX",certlevel)>0 then temp=userinformation("Logon failed because the Membership expiry date has not been set. Contact your Administrator to set your Membership.") tmp1=logact(certuserstr,"Logon failed because Membership expired.") logon=false exit function end if if (tmp10 then temp=userinformation("Logon failed because the Membership has expired. Contact your Administrator to Renew your Membership.") tmp1=logact(certuserstr,"Logon failed because Membership expired.") logon=false exit function end if else certgroup="All" if instr("USEZ",certlevel)=0 then certgroup="Nil" actionstr="m4" temp=userinformation("Your Member Details have not yet been input. You must enter these details to gain full access to the system.") end if end if Nldsessionid=Gencode()&Gencode() criteriastr="Nldsessionid`EQU`" & Nldsessionid while (getrecno(certfilestr,criteriastr)<>-1) Nldsessionid=Gencode()&Gencode() criteriastr="Nldsessionid`EQU`" & Nldsessionid wend recorddata=Nldsessionid+left(cstr(certexpires)+space(25),25)+left(usernamestr+" ",10)+left(certgroup+" ",3)+left(certlevel+" ",1) temp=copytolive("rec","",certfilestr) if newpasswordstr<>"" then temp=putfield(passwordfilestr,tmplog,"Password",newpasswordstr) temp=userinformation("Your Password has been updated.") temp=logact(certuserstr,"Password updated") end if logon=true tmp1=trim(mid(copytolive("firstl",certfilestr,""),25,25)) temp=logact(certuserstr,"OK") if isdate(tmp1) then if cdate(tmp1)>dateadd("h",-24,now) then if rnd>.5 then tmp1=trim(mid(copytolive("firstl",activityfilestr,""),11,20)) if isdate(tmp1) then if cdate(tmp1)>dateadd("d",-7,now) then tmp1=trim(mid(copytolive("firstl",logfilestr,""),11,20)) if isdate(tmp1) then if cdate(tmp1)>dateadd("d",-45,now) then exit function end if end if criteriastr="Logdate`CE2`-" temp=getrecords("find",fstr+"001",logfilestr,criteriastr,1,99999) temp=copytolive("copy",fstr+"001",logfilestr) exit function end if end if criteriastr="Logdate`CE1`-" temp=getrecords("find",fstr+"001",activityfilestr,criteriastr,1,99999) temp=copytolive("copy",fstr+"001",activityfilestr) end if exit function end if end if criteriastr="Certexpires`CER`-" temp=getrecords("find",fstr+"001",certfilestr,criteriastr,1,99999) temp=copytolive("copy",fstr+"001",certfilestr) tmp=logact(certuserstr,"Certificate file cleaned") exit function end if end if tmp=logact("-","Logon failed using Username"+Usernamestr) temp=userinformation("Your logon attempt failed. Please try again so that your requested action can be completed and contact your Administrator if the problem persists.") logon=false end function function logact(userstr,actstr) tmprecorddata=recorddata recorddata=left(userstr+space(10),10)+left(cstr(now)+space(20),20)+actstr temp=copytolive("rec","",logfilestr) recorddata=tmprecorddata end function function logaction(actstr) tmprecorddata=recorddata recorddata=left(certuserstr+space(10),10)+left(cstr(now)+space(20),20)+actstr temp=copytolive("rec","",activityfilestr) recorddata=tmprecorddata end function function doaction() if actionstr="l" then if logon()=false then temp=header() temp=Logon_page() exit function end if else formstr=request.form() end if tmpn=getrecno(certfilestr,"Nldsessionid`EQU`" & trim(Nldsessionid)) if tmpn=-1 then temp=header() temp=userinformation("You need to logon so that your requested action can be completed.") temp=Logon_page() exit function end if if actionstr<>"q0" then temp=header() end if certexpires=cdate(getfield(1)) certuserstr=getfield(2) certgroup=getfield(3) certlevel=getfield(4) fstr=bstr+certuserstr if certexpires"R" then temp=Member_Update("") else temp=Member_Renewal_Update("") end if case "m1" temp=MemberRecall() case "m2" temp=Search_database() case "m3" temp=Member_search() case "m4" temp=Member_Update("") case "m6" temp=Member_Renewal_Update("") end select end function function help_page() set helppagefile = CreateObject("Scripting.FileSystemObject").OpenTextFile(helpfilestr) while helppagefile.AtEndOfStream=FALSE response.write helppagefile.read(1) wend helppagefile.close end function function Useraccount_Update(msgstr) temp=Admin_options_page(msgstr) temp=Update_user_page() end function function Useraccount_Post() usernamestr=get_form_arg("Username") profilestr=get_form_arg("Profile") resetpasswordstr=get_form_arg("Resetpassword") temp=copytolive("head",passwordfilestr,"") criteriastr="Username`EQU`" + trim(usernamestr) if getrecno(passwordfilestr,criteriastr)=-1 then if validstr(usernamestr)=0 then msgstr="No Username was created. For security reasons, Usernames must be from 5 to 10 characters long and contain upper case letters, lower case letters or numbers. Usernames must contain at least one number and one letter." else rem username does not exists if profilestr="Nochange" then msgstr="No Username was created. A profile for the Username must be selected from the drop down menu before a Username can be created." else recorddata=space(fieldstart(ubound(fieldstart))) temp=putrecorddata("Username",usernamestr) temp=putrecorddata("Password","TEMP") temp=putrecorddata("Profile",profilestr) temp=putrecorddata("Logdate",now) temp=copytolive("rec","",passwordfilestr) msgstr="A new account has been created for '"+usernamestr+"'"+" with the password set to 'TEMP' (case sensitive)." end if end if else if resetpasswordstr<>"ON" then msgstr="The Username and its Password were NOT changed as the Username already exists and 'Enable details of an existing Username to be updated' box was not ticked. Repeat the action with the box ticked or choose a different Username." else temp=putrecorddata("Password","TEMP") if profilestr<>"Nochange" then temp=putrecorddata("Profile",profilestr) end if temp=putrecorddata("Logdate",now) temprecorddata=recorddata temp=getrecords("delete",fstr+"001",passwordfilestr,criteriastr,1,-1) recorddata=temprecorddata temp=copytolive("rec","",fstr+"001") temp=copytolive("copy",fstr+"001",passwordfilestr) msgstr="The account has been updated for '"+usernamestr+"' as a '"+conprofile(profilestr)+"'. The password has been reset to 'TEMP' (case sensitive)" end if end if temp=Useraccount_Update(msgstr) end function function Diary_dates_Update(msgstr) temp=Admin_options_page(msgstr) temp=Diary_dates_page(get_diary_dates()) end function function get_diary_dates() set adminfile = CreateObject("Scripting.FileSystemObject").OpenTextFile(adminfilestr) get_diary_dates=split(adminfile.readline,",") adminfile.close end function function Diary_dates_Post() set adminfile = CreateObject("Scripting.FileSystemObject").OpenTextFile(adminfilestr) tmparr=split(adminfile.readline,",") adminfile.close updateary=split(filterhex(get_formdata()),"|",99) Set adminfileout = CreateObject("Scripting.FileSystemObject").CreateTextFile(adminfilestr,TRUE) adminfileout.writeline "data1,"&tidydate(updateary(0),1)&","&updateary(1)&","&updateary(2) adminfileout.close temp=Diary_dates_Update("Diary cut-off details have been updated") end function function Homepage_update(msgstr) temp=Admin_options_page(msgstr) temp=Update_homepage_page() end function function Homepage_post() formdatastr=filterhex(get_form_arg("S1")) Set fsd = CreateObject("Scripting.FileSystemObject") set homepagefile = fsd.CreateTextFile(homepagefilestr,TRUE) homepagefile.write formdatastr homepagefile.close Homepage_update("The Homepage HTML has been updated - the new Homepage is now active.") end function function view_event_diary() tmparr=get_diary_dates() diaryletter=tmparr(2) if cdatestr()>=tmparr(1) then diaryletter=tmparr(3) end if rem filter out diary letter and sort on date formstr="D1=3&D2=STW&D3="&diaryletter&"&D4=A&D5=4&D6=MTE&D7=1990:01:01&D8=A&D9=0&D10=EQU&D11=&D12=N&T1=1&T2=9999&T4=Basic2&T3=Event&ButA.x=7&ButA.y=4" temp=Search_database() end function function Log_search() Logfieldtext=array("No Selection","Username","Profile","Logdate","Action") temp=Admin_options_page("") t=search_for_page("a transaction",Logfieldtext,"Narrow list,Narrow,Wide list,Wide","Usernames,Usernames,Logfile,Logfile,Activities,Activities","a3") end function function Event_Search() Eventfieldtext=array("No Selection","Event title","Description","Diary Reference","Start time","End time","Book by","How to book","Location","Host name","Host daytime tel","Host evening tel","Host mobile tel","Host email","Host reference","How to book","Event website","Update by","When updated","Approved by","When approved","Approved") temp=Event_options_page("") temp=search_for_page("an event",Eventfieldtext,"Event Diary,Basic2,Event list,Basic1,Minutes of meetings,Minutes,Narrow list,Narrow,Wide list,Wide","Live Database,Event,Event archive,Eventarchive","u1") end function function Member_search() Memberfieldtext=array("No Selection","Username","Saluation","Firstname","Initials","Surname","House no.","Town","County","Postcode","Daytime tel","Mobile","Email","Date of birth","Occupation","Market source","Bulletin method","Subgroup","Update by","When updated","Approved by","When approved","Renewal date","Member type","Approve","Street address") temp=Member_options_page("") t=search_for_page("a member",Memberfieldtext,"Basic report,Basic,Narrow list,Narrow,Wide list,Wide","Live Database,Member,Member archived,Memberarchive","m2") end function function Search_report(whatstr,partstr,dbasestr,reportstr,appstr) Select case whatstr&":"&partstr case "Event:Head" temp=event_options_page("") if appstr<>"" then userinformation(appstr) end if case "Member:Head" temp=member_options_page("") if appstr<>"" then userinformation(appstr) end if end select rem A=Event, B=Diary Note,C=Diary Header,D=Diary Footer,E=Committee Minutes Select case whatstr&":"&partstr&":"&reportstr case "Event:Head:Basic1" temp=event_01_report_h() case "Event:Body:Basic1" temp=event_01_report() case "Event:Foot:Basic1" temp=event_01_report_f() case "Event:Head:Basic2" temp=event_02_report_h() case "Event:Body:Basic2" temp=event_02_report() case "Event:Body:Basic2A" temp=event_02A_report() case "Event:Body:Basic2B" temp=event_02B_report() case "Event:Body:Basic2C" temp=event_02C_report() case "Event:Body:Basic2D" temp=event_02D_report() case "Event:Foot:Basic2" temp=event_02_report_f() case "Event:Head:Minutes" temp=event_00_report_h() case "Event:Body:MinutesE" temp=event_00E_report() case "Event:Foot:Minutes" temp=event_00_report_f() case "Event:Update_page:Detail" temp=host_options_page("") temp=Event_update_page(poparray(eventfilestr,recorddata),dbasestr) case "Event:Head:Narrow" temp=flat_report_h(whatstr,"Event_reference,Event_title,Host_reference,Starttime,Booktime,Host_name,Description") case "Event:Body:Narrow" rec("Event_reference")=mid(rec("Event_reference"),1,6) temp=flat_report() case "Event:Foot:Narrow" temp=flat_report_f() case "Event:Head:Wide" temp=flat_report_h(whatstr,"Event_reference,Event_title,Subgroup,Href,Host_reference,Starttime,Endtime,Booktime,How_to_book,Host_name,Host_daytime_tel,Host_evening_tel,Host_mobile_tel,Host_email,Approve,Description") case "Event:Body:Wide" rec("Event_reference")=mid(rec("Event_reference"),1,6) temp=flat_report() case "Event:Foot:Wide" temp=flat_report_f() case "Member:Head:Basic" temp=member_01_report_h() case "Member:Body:Basic" temp=member_01_report() case "Member:Foot:Basic" temp=member_01_report_f() case "Member:Head:Narrow" temp=flat_report_h(whatstr,"Username,Surname,Postcode") case "Member:Body:Narrow" temp=flat_report() case "Member:Foot:Narrow" temp=flat_report_f() case "Member:Head:Wide" temp=flat_report_h(whatstr,"Username,Saluation,Firstname,Initials,Surname,House_number,Town,County,Postcode,Daytime_tel,Mobile,Email,Date_of_birth,Occupation,Market_source,Renewal_date,Member_type,Approve,Street_address") case "Member:Body:Wide" temp=flat_report() case "Member:Foot:Wide" temp=flat_report_f() case "Member:Update_page:Detail" temp=member_options_page("") temp=member_update_page(poparray(memberfilestr,recorddata),dbasestr,0) case "Member:Update_renewal_page:Detail" temp=member_options_page("") temp=member_update_renewal_page(poparray(memberfilestr,recorddata),dbasestr) case "Logfile:Head:Wide" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Logdate,Action") case "Logfile:Body:Wide" temp=flat_report() case "Logfile:Foot:Wide" temp=flat_report_f() case "Logfile:Head:Narrow" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Logdate,Action") case "Logfile:Body:Narrow" temp=flat_report() case "Logfile:Foot:Narrow" temp=flat_report_f() case "Activities:Head:Wide" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Logdate,Action") case "Activities:Body:Wide" temp=flat_report() case "Activities:Foot:Wide" temp=flat_report_f() case "Activities:Head:Narrow" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Logdate,Action") case "Activities:Body:Narrow" temp=flat_report() case "Activities:Foot:Narrow" temp=flat_report_f() case "Usernames:Head:Wide" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Profile,Logdate") case "Usernames:Body:Wide" temp=flat_report() case "Usernames:Foot:Wide" temp=flat_report_f() case "Usernames:Head:Narrow" temp=admin_options_page("") temp=flat_report_h(whatstr,"Username,Profile,Logdate") case "Usernames:Body:Narrow" temp=flat_report() case "Usernames:Foot:Narrow" temp=flat_report_f() end select end function function nowstr() nowstr=tidydate(cstr(year(now))&":"&cstr(month(now))&":"&cstr(day(now))&":"&cstr(hour(now))&":"&cstr(minute(now)),0) end function function cdatestr() cdatestr=tidydate(cstr(year(now))&":"&cstr(month(now))&":"&cstr(day(now)),0) end function function dt(tstr1,tstr2) dt="" dt1=split(tstr1,":") if ubound(dt1)<>2 and ubound(dt1)<>4 then dt1=split("2099:01:01:00:00",":") end if if ubound(dt1)=2 then dt1=split(tstr1&":00:00",":") end if select case tstr2 case "d" dt=cstr(dt1(2)) case "m" dt=cstr(dt1(1)) case "y" dt=cstr(dt1(0)) case "h" dt=cstr(dt1(3)) case "min" dt=cstr(dt1(4)) end select end function function Gencode() tdate=now randomize timenum=cdbl(int(rnd*100000)+100000*(Second(tdate)+60*(minute(tdate)+60*hour(tdate))+24*60*60*(day(tdate)+31*month(tdate)+366*(year(tdate)-100*int(year(tdate)/100))))) timenum=(timenum*(rnd*1000))/10 timestr="" for i=1 to 6 timenum=timenum/26 t1=int(26*(timenum-int(timenum))) timestr=timestr&chr(asc("a")+t1) next for i=1 to 6 timenum=timenum/10+rnd*1000 t1=int(10*(timenum-int(timenum))) timestr=timestr&chr(asc("0")+t1) next gencode=timestr end function function hexn(hstr) hexn=-10000 if hstr>="0" and hstr<="9" then hexn=cint(hstr) end if if hstr>="a" and hstr<="f" then hexn=asc(hstr)-asc("a")+10 end if if hstr>="A" and hstr<="F" then hexn=asc(hstr)-asc("A")+10 end if end function function get_form_arg(arg1) tmps="&"+formstr tmpn=instr(tmps,arg1+"=") if tmpn=0 then get_form_arg="" exit function end if tmpn1=instr(tmpn,tmps,"&") if tmpn1=0 then get_form_arg=mid(tmps,tmpn+len(arg1)+1,len(tmps)) exit function end if get_form_arg=mid(tmps,tmpn+len(arg1)+1,tmpn1-tmpn-len(arg1)-1) end function function get_arg(argstr) if argstr="" then tmp_formdatastr=formstr else tmp_formdatastr=get_form_arg(argstr) end if tmp_formdatastr=replace(tmp_formdatastr,"+"," ") xpos=instr(tmp_formdatastr,"%") while xpos>0 hexstr=mid(tmp_formdatastr,xpos,3) hval=hexn(mid(hexstr,2,1))*16+hexn(mid(hexstr,3,1)) if hval>0 then tmp_formdatastr=replace(tmp_formdatastr,hexstr,chr(hval)) end if xpos=instr(xpos+1,formdatastr,"%") wend get_arg=tmp_formdatastr end function function cmonthstr(mdate) mn=split("Dec,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",",") cmonthstr=mn(mdate) end function function condatestr(ddate) date1=split(ddate,":") wd=split("-,Sun,Mon,Tued,Wed,Thur,Fri,Sat",",") wd1="th" select case date1(2) case 1 wd1="st" case 2 wd1="nd" case 3 wd1="rd" end select condatestr=wd(weekday(DateSerial(date1(0),date1(1),date1(2))))&" "&cstr(date1(2))&wd1&" "&cmonthstr(date1(1)) end function function contime1str(atime) atime1=split(atime,":") if ubound(atime1)=4 then h1=atime1(3) m2=atime1(4) else h1=0 m2=0 end if if h1=12 and m2=0 then contime1str="Midday" exit function end if if atime1(0)="2099" then contime1str="TBD" exit function end if if h1=0 and m2=0 then contime1str="Midnight" exit function end if contime1str=cstr(h1)&":"&cstr(m2) end function function contimestr(stime,etime) tsstr=contime1str(stime) testr=contime1str(etime) if tsstr="TBD" then if testr<>"TBD" then contimestr=tsstr&"
until "&condatestr(etime)&" at "&testr else contimestr="" end if exit function end if if testr="TBD" then if tsstr="Midnight" then tsstr="Time to be set" end if contimestr=tsstr exit function end if if condatestr(stime)<>condatestr(etime) then if testr="Midnight" then testr="" end if contimestr=tsstr&" -
"&condatestr(etime)&" - "&testr exit function end if if (tsstr=testr) then if testr="Midnight" then testr="" end if contimestr=testr exit function end if if testr="Midnight" then contimestr=tsstr&" - onwards" exit function end if contimestr=tsstr&" - "&testr end function function Search_database() tempstr=formstr+"x" Butn=mid(tempstr,instr(tempstr,"But")+3,1) Eventfieldname=array("No Selection","Event_title","Description","Subgroup","Starttime","Endtime","Booktime","How_to_book","Location","Host_name","Host_daytime_tel","Host_evening_tel","Host_mobile_tel","Host_email","Host_reference","How_to_book","Href","Update_by","Update_when","Approve_by","Approve_when","Approve") Memberfieldname=array("No Selection","Username","Saluation","Firstname","Initials","Surname","House_number","Town","County","Postcode","Daytime_tel","Mobile","Email","Date_of_birth","Occupation","Market_source","Bulletin_method","Subgroup","Update_by","Update_when","Approve_by","Approve_when","Renewal_date","Member_type","Approve","Street_address") Logfieldname=array("No Selection","Username","Logdate","Action") startlinen=get_arg("T1") linesn=get_arg("T2") sourcestr=get_arg("T3") reportstr=get_arg("T4") functstr="find" actstr="" if Butn="9" then functstr="Approve" if Sourcestr<>"Event" and Sourcestr<>"Member" then actstr="Block Approval can only be performed on the Event and Member Live Databases. Records have not been Approved." functstr="NoApprove" else actstr="The following records have been Approved." end if end if select case Sourcestr case "Event" redim Searchfieldname(ubound(eventfieldname)) for i=0 to ubound(eventfieldname) Searchfieldname(i)=eventfieldname(i) next Searchfilestr=Eventfilestr dbasestr="Live database" case "Eventarchive" redim Searchfieldname(ubound(eventfieldname)) for i=0 to ubound(eventfieldname) Searchfieldname(i)=eventfieldname(i) next Searchfilestr=Eventarchivefilestr dbasestr="Archive" sourcestr="Event" case "Member" redim Searchfieldname(ubound(memberfieldname)) for i=0 to ubound(memberfieldname) Searchfieldname(i)=memberfieldname(i) next Searchfilestr=Memberfilestr dbasestr="Live database" case "Memberarchive" redim Searchfieldname(ubound(memberfieldname)) for i=0 to ubound(memberfieldname) Searchfieldname(i)=memberfieldname(i) next Searchfilestr=Memberarchivefilestr dbasestr="Archive" sourcestr="Member" case "Logfile" redim Searchfieldname(ubound(logfieldname)) for i=0 to ubound(logfieldname) Searchfieldname(i)=Logfieldname(i) next Searchfilestr=logfilestr dbasestr="Live database" case "Activities" redim Searchfieldname(ubound(logfieldname)) for i=0 to ubound(logfieldname) Searchfieldname(i)=Logfieldname(i) next Searchfilestr=activityfilestr dbasestr="Activities" case "Usernames" redim Searchfieldname(ubound(logfieldname)) for i=0 to ubound(logfieldname) Searchfieldname(i)=Logfieldname(i) next Searchfilestr=passwordfilestr dbasestr="Usernames" end select temp=search_report(Sourcestr,"Head",dbasestr,reportstr,actstr) formdatastr="&"&get_arg("") formdatastr=mid(formdatastr,instr(formdatastr,"&D1="),len(formdatastr)-instr(formdatastr,"L1")) for i=0 to 15 formdatastr=replace(formdatastr,"&D"&cstr(i)&"=","|") next tstr=split(formdatastr,"|",13) criteriastr="" criteriastr=Searchfieldname(cint(tstr(1)))+"`"+tstr(2)+"`"+tstr(3)+"`"+tstr(4) if tstr(5)<>"0" then criteriastr=criteriastr+"¬"+Searchfieldname(cint(tstr(5)))+"`"+tstr(6)+"`"+tstr(7)+"`"+tstr(8) end if if tstr(9)<>"0" then criteriastr=criteriastr+"¬"+Searchfieldname(cint(tstr(9)))+"`"+tstr(10)+"`"+tstr(11)+"`"+tstr(12) end if select case functstr case "find" temp=getrecords("find",fstr+"001",searchfilestr,criteriastr,cint(startlinen),cint(linesn)) case "Approve" temp=getrecords("approve",fstr+"001",searchfilestr,criteriastr,cint(startlinen),cint(linesn)) temp=getrecords("delete",fstr+"002",searchfilestr,criteriastr,cint(startlinen),cint(linesn)) temp=copytolive("add",fstr+"001",fstr+"002") temp=copytolive("copy",fstr+"002",searchfilestr) case "NoApprove" criteriastr="xxx`xxx`xxx" temp=getrecords("find",fstr+"001",searchfilestr,criteriastr,cint(startlinen),cint(linesn)) end select Set fsr = CreateObject("Scripting.FileSystemObject") set searchfile = fsr.OpenTextFile(fstr+"001") Dim rec1,size1 Set rec = CreateObject("Scripting.Dictionary") size1=split(searchfile.readline,",",-1) rec1=split(searchfile.readline,",",-1) type1=split(searchfile.readline,",",-1) rem temp is number of lines in getrecords output serialn=startlinen while (searchfile.AtEndOfStream=FALSE) rem load rec with record data recorddata=searchfile.readline rec.removeall size0=1 rec.add "Serial",serialn serialn=serialn+1 for i =0 to ubound(rec1) tempstr=mid(recorddata,size0,size1(i)) if tempstr="" then tempstr="." end if rec.add rec1(i),tempstr size0=size0+size1(i) next if (sourcestr<>"Event" or instr(certstr,"er")=0 or rec("Approve")="Y") then if sourcestr<>"Event" or reportstr="Narrow" or reportstr="Wide" then temp=search_report(Sourcestr,"Body",dbasestr,reportstr,"") else temp=search_report(Sourcestr,"Body",dbasestr,reportstr&rec("Event_type"),"") end if end if wend searchfile.close tmp=killit(fstr+"001") temp=search_report(Sourcestr,"Foot",dbasestr,reportstr,"") end function function no_find_event(referstr,textstr) temp=host_update("The Event Reference '"+referstr+"' has not been found in the "+textstr+". The event may have been deleted otherwise try a different Event Reference.") end function function member_detail(referstr) criteriastr="Username`EQU`" + referstr dbasestr="Live database" if getrecno(memberfilestr,criteriastr)=-1 then dbasestr="Archive" if getrecno(memberarchivefilestr,criteriastr)=-1 then temp=Member_update("The username '"+referstr+"' has not been found in the Live database or archive. Please try another username.") exit function end if end if temp=Search_report("Member","Update_page",dbasestr,"Detail","") end function function Host_Update(msgstr) temp=Host_options_page(msgstr) temp=Event_update_page(poparray(eventfilestr,""),"Newly input") end function function event_update() tempstr=replace(formstr+"x","%3A",":") Butn=mid(tempstr,instr(tempstr,"But")+3,1) if Butn="8" then Butn="5" Rem But8 is followed by ":"+referstr referencestr=mid(tempstr,instr(tempstr,"But")+5,6) else referencestr=get_form_arg("e1") end if select case Butn case "1" Rem Enter temp=UpdateDetails("Event",eventfilestr) case "2" Rem Approve criteriastr="Event_reference`EQ6`" + left(trim(referencestr)+" ",6) fieldn=getrecno(eventfilestr,criteriastr) if fieldn>0 then tmp=putuserdate(eventfilestr,"Y",criteriastr) temp=host_update("The event has been approved") else temp=no_find_event(referencestr,"Live Event Database") end if case "3" Rem Unapprove criteriastr="Event_reference`EQ6`" + left(trim(referencestr)+" ",6) fieldn=getrecno(eventfilestr,criteriastr) if fieldn>0 then tmp=putuserdate(eventfilestr,"U",criteriastr) temp=host_update("The event has been unapproved") else temp=no_find_event(referencestr,"Live Event Database") end if case "4" rem Delete if instr(certstr,"hs")>0 then referencestr=left(referencestr,6) criteriastr="Event_reference`EQ6`" + trim(referencestr) else criteriastr="Event_reference`EQU`" + trim(referencestr) end if if getrecno(eventfilestr,criteriastr)>0 then temp=getrecords("find",fstr+"001",eventfilestr,criteriastr,1,-1) temp=copytolive("add",fstr+"001",eventarchivefilestr) temp=getrecords("delete",fstr+"001",eventfilestr,criteriastr,1,-1) temp=copytolive("copy",fstr+"001",eventfilestr) temp=host_update("The event has been transferred to the Archive") exit function else if getrecno(eventarchivefilestr,criteriastr)>0 then temp=getrecords("delete",fstr+"001",eventarchivefilestr,criteriastr,1,-1) temp=copytolive("copy",fstr+"001",eventarchivefilestr) temp=host_update("The event has been permanently deleted from the Archive") exit function else temp=no_find_event(referencestr,"Live or Archived Event Databases") end if end if case "5" Rem Find dbasestr="Live database" if instr(certstr,"hv")>0 then referencestr=left(referencestr,6) criteriastr="Event_reference`EQ6`" + trim(referencestr) else if len(referencestr)<12 then tmplogaction(actionstr&"5 - failed. Insufficient access rights") tmp=userinformation("You do not have sufficient access rights to view the detail of an event or a full 12 character Event Reference must be used. You might wish to logon using a difference username or recall the event using the full 12 character Event Reference.") tmp=logon_page() exit function end if criteriastr="Event_reference`EQU`" + trim(referencestr) end if if getrecno(eventfilestr,criteriastr)=-1 then dbasestr="Archive" if getrecno(eventarchivefilestr,criteriastr)=-1 then rem event_code is not valid temp=no_find_event(referencestr,"Live or Archived Event Databases") exit function end if end if if len(referencestr)<12 then recorddata=left(referencestr+space(12),12)+mid(recorddata,13,len(recorddata)) end if temp=Search_report("Event","Update_page",dbasestr,"Detail","") exit function end select end function function Member_Update(msgstr) temp=Member_options_page(msgstr) tempstr="" if actionstr="m4" then tempstr=left(certuserstr+space(10),10) end if if actionstr="m0" and certuserstr<>"" and certlevel="C" then criteriastr="Username`EQU`" + certuserstr if getrecno(memberfilestr,criteriastr)=-1 then tempstr="" else tempstr=recorddata end if end if temp=Member_update_page(poparray(memberfilestr,tempstr),"Live database",0) end function function Member_Renewal_Update(msgstr) temp=Member_options_page(msgstr) temp=Member_update_renewal_page(poparray(memberfilestr,""),"Live database") end function function MemberRecall() tempstr=formstr+"x" Butn=mid(tempstr,instr(tempstr,"But")+3,1) if Butn="5" and mid(tempstr,instr(tempstr,"But")+4,1)=":" then referencestr=mid(tempstr,instr(tempstr,"But")+5,10) else referencestr=get_form_arg("e1") end if if instr(certstr,"mo")=0 and (referencestr<>certuserstr) then logaction(actionstr&butn&" - failed. Insufficient access rights") temp=userinformation("You are logged on under username '"&certuserstr&"' which does not provide access rights to change the details of another member '"&referencestr&"'. To complete the selected action, logon using a username with appropriate access rights. Press 'Back' to return to the member details you have just typed.") temp=Logon_page() exit function end if criteriastr="Username`EQU`" + trim(referencestr) select case Butn case "1" Rem Enter temp=UpdateDetails("Member",memberfilestr) case "2" Rem Approve fieldn=getrecno(memberfilestr,criteriastr) if fieldn>0 then tmp=putuserdate(memberfilestr,"Y",criteriastr) temp=Member_update("The Member has been approved.") exit function end if temp=no_find_member(referencestr) case "3" Rem Unapprove fieldn=getrecno(memberfilestr,criteriastr) if fieldn>0 then tmp=putuserdate(memberfilestr,"U",criteriastr) temp=Member_update("The Member has been unapproved.") exit function end if temp=no_find_member(referencestr) case "4" rem Delete if getrecno(memberfilestr,criteriastr)>0 then temp=getrecords("find",fstr+"001",memberfilestr,criteriastr,1,-1) temp=copytolive("add",fstr+"001",memberarchivefilestr) temp=getrecords("delete",fstr+"001",memberfilestr,criteriastr,1,-1) temp=copytolive("copy",fstr+"001",memberfilestr) temp=Member_update("The Member's details have been transfered to the archive") temp=logaction(actionstr&"4 - Member details sucessfully archived.") exit function else if getrecno(memberarchivefilestr,criteriastr)>0 then temp=getrecords("delete",fstr+"001",memberarchivefilestr,criteriastr,1,-1) temp=copytolive("copy",fstr+"001",memberarchivefilestr) temp=Member_update("The Member's details have been permanently deleted from the archive") temp=logaction(actionstr&"4 - Member details sucessfully deleted from archive.") exit function end if temp=logaction(actionstr&"4 - member delete failed. Member not found.") temp=Member_update("The Member has not been found in the Live database or the Archive") end if case "5" Rem Find temp=Member_detail(referencestr) exit function case "6" Rem Findrenewal fieldn=getrecno(memberfilestr,criteriastr) if fieldn>0 then dbasestr="Live database" temp=Search_report("Member","Update_renewal_page",dbasestr,"Detail","") exit function end if temp=no_find_member(referencestr) case "7" Rem Renewal tmpbol=isnumeric(get_arg("e30c"))and isnumeric(get_arg("e30b")) and isnumeric(get_arg("e30a")) and (get_arg("e31")<>"") if tmpbol=false then temp=Member_renewal_update("The Membership Type can not be blank and the Renewal Date fields must be numbers for a Member to be renewed.") temp=logaction(actionstr&"7 - member renewal failed. Error in renewal filed data.") exit function end if fieldn=getrecno(memberfilestr,criteriastr) if fieldn>0 then if getrecorddata("Approve")="U" then temp=logaction(actionstr&"7 - member renewal failed. Member record is unapproved.") temp=Member_renewal_update("The Member details for '"+referencestr+"' have been 'Unapproved' and so can not be changed. Please contact your Administrator to Approved the details.") exit function end if renewal_date=tidydate(get_arg("e30a")&":"&get_arg("e30b")&":"&get_arg("e30c"),0) tmp=putrecorddata("Renewal_date",renewal_date) tmp=putrecorddata("Member_type",get_arg("e31")) tmprecorddata=recorddata tmp=getrecords("delete",fstr+"001",memberfilestr,criteriastr,1,-1) recorddata=tmprecorddata tmp=copytolive("rec","",fstr+"001") temp=copytolive("copy",fstr+"001",memberfilestr) temp=Member_renewal_update("The Membership has been renewed for '"+referencestr+"'") exit function end if temp=Member_renewal_update("The Member '"+referencestr+"' has not been found in the Live database.") end select end function function putuserdate(putfilestr,upstr,crit1) temp=putrecorddata("Approve",upstr) temp=putrecorddata("Approve_by",certuserstr) temp=putrecorddata("Approve_when",nowstr()) tmprecorddata=recorddata temp=getrecords("delete",fstr+"001",putfilestr,crit1,1,99999) recorddata=tmprecorddata temp=copytolive("rec","",fstr+"001") temp=copytolive("copy",fstr+"001",putfilestr) end function function tidydate(d1str,opt1) tidydate="2099:01:01:00:00" t1str="" dt1=split(d1str,":") if ubound(dt1)<>2 and ubound(dt1)<>4 then debugit("1") exit function end if if opt1=1 then tmp=dt1(0) dt1(0)=dt1(2) dt1(2)=tmp end if if isnumeric(dt1(0))=false then debugit("2") exit function end if if dt1(0)>2999 or dt1(0)<1900 then debugit("3") exit function end if for i=1 to ubound(dt1) if isnumeric(dt1(i))=false then debugit("4") exit function end if if dt1(i)<-99 or dt1(i)>99 then debugit("5") exit function end if next date1=dateserial(dt1(0),dt1(1),dt1(2)) tidydate=year(date1)&":"&right("0"&month(date1),2)&":"&right("0"&day(date1),2) if ubound(dt1)=4 then time1=timeserial(dt1(3),dt1(4),0) tidydate=tidydate&":"&right("0"&hour(time1),2)&":"&right("0"&minute(time1),2) end if end function function no_find_member(referstr) temp=Member_update("The Member '"+referstr+"' has not been found in the Live database.") end function function get_formdata() tmpformdatastr="" dstr="&"+get_arg("") for i=1 to 20 sstr="&e"&cstr(i) xpos=instr(dstr,sstr+"c=") if xpos>0 then dstr=replace(dstr,sstr+"c=",sstr+"=") dstr=replace(dstr,sstr+"b=",":") dstr=replace(dstr,sstr+"a=",":") dstr=replace(dstr,sstr+"d=",":") dstr=replace(dstr,sstr+"e=",":") else xpos=instr(dstr,sstr+"=") if instr(dstr,sstr+"=")<1 then exit for end if end if ypos=instr(xpos+1,dstr,"&e") if ypos<1 then ypos=instr(xpos+1,dstr,"&But") end if if ypos<1 then tmpformdatastr=tmpformdatastr+mid(dstr,xpos+len(sstr+"="),len(dstr))+"|" exit for else tmpformdatastr=tmpformdatastr+mid(dstr,xpos+len(sstr+"="),ypos-xpos-len(sstr+"="))+"|" end if next get_formdata=tmpformdatastr end function function poparray(filestr,recstr) tmp=copytolive("head",filestr,"") redim formdataary(ub) for i = 0 to ub if len(recstr)-fieldsize(i)<=0 then formdataary(i)=trim(recstr) recstr="" else formdataary(i)=trim(left(recstr,fieldsize(i))) recstr=mid(recstr,fieldsize(i)+1,len(recstr)) end if next poparray=formdataary end function function gint(int1) if isnumeric(int1) then gint=int(int1) else gint=0 end if end function function filterhex(form1) ipos=1 while instr(ipos,form1,"+")>0 ipos=instr(ipos,form1,"+") form1=left(form1,ipos-1)+" "+mid(form1,ipos+1,len(form1)) wend ipos=1 while instr(ipos,form1,"%")>0 ipos=instr(ipos,form1,"%")+1 if len(form1)-ipos>=1 then hn=hexn(mid(form1,ipos,1))*16+hexn(mid(form1,ipos+1,1)) if hn>=0 then if (hn<32) and (hn<>13) then form1=left(form1,ipos-2)+mid(form1,ipos+2,len(form1)) ipos=ipos-1 else form1=left(form1,ipos-2)+chr(hn)+mid(form1,ipos+2,len(form1)) end if end if end if wend form1=Replace(form1,chr(13) ,"~") filterhex=form1 end function function UpdateDetails(updatestr,filestr) formdatastr=filterhex(get_formdata()) ipos=1 updateary=split(formdatastr,"|",99) temp=copytolive("head",filestr,"") redim preserve updateary(ub) newflag=0 select case updatestr case "Member" updateary(ub)=updateary(ub-8) updateary(ub-8)=chr(5) updateary(ub-6)=nowstr() updateary(ub-7)=certuserstr if instr(certstr,"mp")>0 then updateary(ub-1)="Y" updateary(ub-4)=nowstr() updateary(ub-5)=certuserstr else updateary(ub-1)="N" updateary(ub-4)=chr(5) updateary(ub-5)=chr(5) end if updateary(ub-2)=chr(5) updateary(ub-3)=chr(5) if updateary(0)="" then temp=member_options_page("A Username must be provided in order to change a member's details. New usernames can be set up using the Administrator's pages.") temp=member_update_page(updateary,"Newly input",0) exit function end if criteriastr="Username`EQU`" + trim(updateary(0)) if getrecno(memberfilestr,criteriastr)<1 then if getrecno(passwordfilestr,criteriastr)<1 then temp=member_options_page("An unrecognised Username '"+updateary(0)+"' has been used. Please ask your Administrator to create a Username or try another Username.") temp=member_update_page(updateary,"Newly input",0) exit function end if if getrecno(memberarchivefilestr,criteriastr)>0 then temp=member_options_page("The Member details for '"+updateary(0)+"' have previously been transferred to the Members Archive and so can not be edited. A new Username must be set up for the Member by the Administrator in order to edit the details. ") temp=member_update_page(updateary,"Newly input",0) exit function end if newflag=1 end if case "Event" rem strip out ":" in SubGroup updateary(2)=replace(updateary(2),":","") updateary(ub)=updateary(ub-5) updateary(ub-4)=nowstr() updateary(ub-5)=certuserstr if instr(certstr,"ep")>0 then updateary(ub-1)="Y" updateary(ub-2)=nowstr() updateary(ub-3)=certuserstr else updateary(ub-1)="N" updateary(ub-2)=chr(5) updateary(ub-3)=chr(5) end if if instr(certstr,"ht")>0 then criteriastr="Event_reference`EQ6`" + trim(updateary(0)) if getrecno(eventfilestr,criteriastr)>0 then updateary(0)=left(recorddata,12) end if end if criteriastr="Event_reference`EQU`" + trim(updateary(0)) if updateary(0)="" then rem Generate a new event code and check it does not already exist updateary(0)=Gencode() criteriastr="Event_reference`EQU`" + trim(updateary(0)) while (getrecno(eventfilestr,criteriastr)<>-1) and (getrecno(eventarchivefilestr,criteriastr)<>-1) updateary(0)=Gencode() criteriastr="Event_reference`EQU`" + trim(updateary(0)) wend newflag=1 else if getrecno(eventfilestr,criteriastr)=-1 then rem event code was provided but does not exit if (len(trim(updateary(0)))=6 and instr(certstr,"ht")=0) then temp=host_options_page("You do not have sufficient access rights to update an event without the Event Security Code. You must either add the Event Security Code or logon as a different user.") else temp=host_options_page("An event with Event Reference '"+updateary(0)+"' has not been found in the Live Database. Try a Event Reference or leave the Event Reference blank to create a new event.") end if temp=Event_update_page(updateary,"Newly input") exit function end if end if end select recordline="" for i=0 to ub if (i=ub-1) then if newflag=0 then rem Approved if mid(recorddata,len(recordline)+1,1)="U" then Rem unapproved if updatestr="Member" then temp=member_options_page("The Member details have been 'Unapproved' and so can not be changed. Please contact your Administrator to Approved the details.") temp=member_update_page(updateary,"Unchanged",0) exit function else temp=host_options_page("The Event details have been 'Unapproved' and so can not be changed. Please contact your Administrator to Approved the details.") temp=Event_update_page(updateary,"Unchanged") exit function end if end if end if end if if updateary(i)=chr(5) then updateary(i)="." if recorddata<>"" and newflag=0 then updateary(i)=mid(recorddata,len(recordline)+1,fieldsize(i)) end if else if fieldtype(i)="D" then if i>=ub-6 then updateary(i)=tidydate(updateary(i),0) else updateary(i)=tidydate(updateary(i),1) end if end if end if if (fieldsize(i)-len(updateary(i)))<=0 then recordline=recordline+left(updateary(i),fieldsize(i)) else if i=ub then if updateary(i)="" then updateary(i)="." end if recordline=recordline+trim(updateary(i)) else recordline=recordline+updateary(i)+space(fieldsize(i)-len(updateary(i))) end if end if next if newflag=0 then temp=getrecords("delete",fstr+"001",filestr,criteriastr,1,-1) recorddata=recordline temp=copytolive("rec","",fstr+"001") temp=copytolive("copy",fstr+"001",filestr) else recorddata=recordline if (updatestr="Event" and instr(certstr,"ep")>0) or (updatestr="Member" and instr(certstr,"mp")>0) then temp=putrecorddata("Approve","Y") temp=putrecorddata("Approve_by",certuserstr) temp=putrecorddata("Approve_when",nowstr()) end if temp=copytolive("rec","",filestr) end if select case updatestr case "Member" temp=member_update("Details have been updated.") case "Event" if newflag=1 then temp=host_update("A new event has been added to the Live Event Database. You will need the following 12 character Event Reference to edit the details '"+updateary(0)+"'") else temp=host_update("The event details have been updated in the Live Event Database.") end if end select end function function putrecorddata(fieldnamestr,datastr) tn=fieldnum(fieldnamestr) if tn=ub then recorddata=left(recorddata,fieldstart(tn))+trim(datastr) else if fieldsize(tn)-len(trim(datastr))<=0 then newdatastr=left(datastr,fieldsize(tn)) else newdatastr=trim(datastr)+space(fieldsize(tn)-len(trim(datastr))) end if recorddata=left(recorddata,fieldstart(tn))+newdatastr+mid(recorddata,fieldsize(tn)+fieldstart(tn)+1,9999) end if end function function getrecorddata(fieldnamestr) tn=fieldnum(fieldnamestr) getrecorddata=trim(mid(recorddata,fieldstart(tn)+1,fieldsize(tn))) end function function validstr(tstr) validstr=0 if len(tstr)<5 then exit function end if if len(tstr)>10 then exit function end if for i= 1 to len(tstr) astr=mid(tstr,i,1) if (astr<"0" or astr>"9") and (astr<"a" or astr>"z") and (astr<"A" or astr>"Z") then exit function end if next validstr=1 end function function debugit(debugstr) Set fsd = CreateObject("Scripting.FileSystemObject") Set fsr = CreateObject("Scripting.FileSystemObject") set debugfilein = fsr.OpenTextFile(debugfilestr) debstr="" while (debugfilein.AtEndOfStream=FALSE) debstr=debstr+debugfilein.read(1) wend debugfilein.close set debugfile = fsd.CreateTextFile(debugfilestr,TRUE) debugfile.writeline debstr debugfile.writeline debugstr debugfile.close end function function copytolive(cmdstr,fromfilestr,tofilestr) if tofilestr<>"" then if (instr("copy head",cmdstr)<>0) then Set fsr = CreateObject("Scripting.FileSystemObject") Set tofile = fsr.CreateTextFile(tofilestr,True) else Set fsr = CreateObject("Scripting.FileSystemObject") Set tofile = fsr.OpenTextFile(tofilestr,8) end if end if if fromfilestr<>"" then Set fsl = CreateObject("Scripting.FileSystemObject") Set fromfile = fsl.OpenTextFile(fromfilestr) end if select case cmdstr case "add" temp=fromfile.readline temp=fromfile.readline temp=fromfile.readline while (fromfile.AtEndOfStream=FALSE) tofile.writeline(fromfile.readline) wend case "rec" tofile.writeline recorddata case "copy" while (fromfile.AtEndOfStream=FALSE) tofile.writeline(fromfile.readline) wend case "firstl" temp=fromfile.readline temp=fromfile.readline temp=fromfile.readline copytolive=fromfile.readline case "head" fieldsizerec=fromfile.readline fieldnamesrec=fromfile.readline fieldtyperec=fromfile.readline if tofilestr<>"" then tofile.writeline fieldsizerec tofile.writeline fieldnamesrec tofile.writeline fieldtyperec end if fieldsize=split(fieldsizerec,",",-1) fieldnames=split(fieldnamesrec,",",-1) fieldtype=split(fieldtyperec,",",-1) redim fieldstart(ubound(fieldsize)) fieldnum.removeall totalsize=0 ub=Ubound(fieldsize) for i=0 to ub fieldstart(i)=totalsize totalsize=totalsize+fieldsize(i) fieldnum.add fieldnames(i),i next end select if fromfilestr<>"" then fromfile.close end if if tofilestr<>"" then tofile.close end if if cmdstr="copy" then tmp=killit(fromfilestr) end if end function function getfield(fnum) totalsize=1 i=0 while i"" then tofile.writeline(recorddata) end if recorddata=fromfile.readline reccount=reccount+1 wend end if if (reccount=recno) or (recno=-1) then fieldn1=fieldnum(fieldnamestr) if fieldn1=ub then insertstr=rtrim(cstr(newvaluestr)) else insertstr=left(cstr(newvaluestr)+string(fieldsize(fieldn1)," "),fieldsize(fieldn1)) end if recorddata=left(recorddata,fieldstart(fieldn1))+insertstr+mid(recorddata,fieldstart(fieldn1)+fieldsize(fieldn1)+1) tofile.writeline(rtrim(recorddata)) while (fromfile.AtEndOfStream=FALSE) tofile.writeline(fromfile.readline) wend end if tofile.close fromfile.close temp=copytolive("copy",tofilestr,fromfilestr) end function function getrecords(actionn,outputfilestr,filestr,criteriastr,firstn,lastn) Dim criterialist Dim criteriafield,criteriaoperator,criteriavalue,criteriasort getrecords="" if lastn=-1 then lastn=99999 end if Set fs = CreateObject("Scripting.FileSystemObject") Set datafile = fs.OpenTextFile(filestr) fieldsizerec=datafile.readline fieldsize=split(fieldsizerec,",",-1) fieldnamesrec=datafile.readline fieldnames=split(fieldnamesrec,",",-1) fieldtyperec=datafile.readline fieldtype=split(fieldtyperec,",",-1) if outputfilestr<>"" then dim outputfile Set outputfile = fs.CreateTextFile(outputfilestr,TRUE) outputfile.writeline(fieldsizerec) outputfile.writeline(fieldnamesrec) outputfile.writeline(fieldtyperec) end if redim fieldstart(ubound(fieldsize)) totalsize=0 fieldnum.removeall for i=0 to ubound(fieldsize) fieldstart(i)=totalsize totalsize=totalsize+fieldsize(i) fieldnum.add fieldnames(i),i next criterialist=split(criteriastr,"¬",-1) listn=(ubound(criterialist)) Redim criteriafield(listn),criteriaoperator(listn),criteriavalue(listn),criteriasort(listn) sortflag=0 for i=0 to listn f1=instr(criterialist(i),"`") f2=instr(f1+1,criterialist(i),"`") f3=instr(f2+1,criterialist(i)&"`","`") criteriafield(i)=trim(left(criterialist(i),f1-1)) criteriaoperator(i)=mid(criterialist(i),f1+1,3) criteriavalue(i)=trim(mid(criterialist(i),f2+1,f3-f2-1)) criteriasort(i)=trim(mid(criterialist(i)&"`N",f3+1,1)) if criteriasort(i)<>"N" then if actionn<>"delete" then sortflag=1 end if end if fieldn=fieldnum(criteriafield(i)) c1=criteriavalue(i) if fieldtype(fieldn)="D" and c1<>"CER" then if isdate(c1) then if hour(c1)=0 and minute(c1)=0 then criteriavalue(i)="D"&left(tidydate(cstr(year(c1))&":"&cstr(month(c1))&":"&cstr(day(c1))&":00:00",0),10) else criteriavalue(i)=tidydate(cstr(year(c1))&":"&cstr(month(c1))&":"&cstr(day(c1))&":"&cstr(hour(c1))&":"&cstr(minute(c1)),10) end if else if ucase(left(c1,1))="H" then criteriavalue(i)="H"&mid(tidydate("1900:01:01:"&mid(c1,2,99),0),12,99) else if ubound(split(c1,":"))=2 then criteriavalue(i)="D"&left(tidydate(c1&":00:00",0),10) else criteriavalue(i)=tidydate(c1,0) if ("2099:01:01:00:00"=criteriavalue(i)) and (criteriaoperator(i)="NOT") then criteriavalue(i)="2099:01:02:00:00" end if end if end if end if end if next recordcount=0 outputcount=0 if sortflag=1 then sortstr="" sortastr="" sortbstr="" end if while (datafile.AtEndOfStream=FALSE) and (outputcountcdbl(textstr) then matchn=FALSE exit for end if else if critval<>textstr then matchn=FALSE exit for end if end if Case "EQ6" if critval<>trim(left(textstr,6)) then matchn=FALSE exit for end if Case "LTE" if isn then if cdbl(critval)cdbl(textstr) then matchn=FALSE exit for end if else if critval>textstr then matchn=FALSE exit for end if end if Case "MTO" if isn then if cdbl(critval)>=cdbl(textstr) then matchn=FALSE exit for end if else if critval>=textstr then matchn=FALSE exit for end if end if Case "NOT" if isn then if cdbl(critval)=cdbl(textstr) then matchn=FALSE exit for end if else if critval=textstr then matchn=FALSE exit for end if end if Case "CON" if instr(lcase(textstr),lcase(critval))=0 then matchn=FALSE exit for end if Case "NIN" if instr(lcase(textstr),lcase(critval))<>0 then matchn=FALSE exit for end if Case "STW" if instr(textstr,critval)<>1 then matchn=FALSE exit for end if Case "ENW" if len(textstr)critval then matchn=FALSE exit for end if case else matchn=FALSE exit for end select if criteriasort(i)<>"N" then x1=fieldsize(fieldn) sortstr=sortstr&left(textstr&space(x1),x1) end if next if (matchn=TRUE) then recordcount=recordcount+1 end if testl = (matchn=TRUE) and (recordcount>=firstn) if ((testl=TRUE) and (actionn<>"delete")) or ((testl=FALSE) and (actionn="delete")) then if outputfilestr<>"" then if actionn="approve" then temp=putrecorddata("Approve","Y") temp=putrecorddata("Approve_by",certuserstr) temp=putrecorddata("Approve_when",nowstr()) end if if (sortflag=0) then outputfile.writeline(recorddata) else sortastr=sortastr&ucase(sortstr)&left(cstr(outputcount)&space(6),6)&"`" sortbstr=sortbstr&recorddata&"`" sortstr="" end if end if outputcount=outputcount+1 end if wend datafile.Close if outputfilestr<>"" then if sortflag=1 then aind=split(sortastr&"`*","`") adata=split(sortbstr,"`") ui=ubound(aind)-2 sf=1 while sf=1 sf=0 i=0 while i<=ui if aind(i)>aind(i+1) then j=i+1 a1=aind(i) while (j<=ui) and (a1>aind(j+1)) j=j+1 wend aind(i)=aind(j) aind(j)=a1 sf=1 end if i=i+1 wend wend for i=0 to ui+1 if trim(aind(i))<>"" then j=cint(trim(right(aind(i),6))) outputfile.writeline(adata(j)) end if next end if outputfile.close end if getrecords=outputcount end function function conprofile(profstr) select case profstr case "C" wstr="Member" case "O" wstr="Event Organiser" case "A" wstr="Event Approver" case "E" wstr="Event Editor" case "M" wstr="Member Approver" case "N" wstr="Member Updater" case "X" wstr="Member Checker" case "R" wstr="Member Renewer" case "S" wstr="Member Editor" case "U" wstr="Administrator" case "Z" wstr="Director" end select conprofile=wstr end function function getrecno(filestr,criteriastr) Set fs = CreateObject("Scripting.FileSystemObject") Set datafile = fs.OpenTextFile(filestr) fieldsizerec=datafile.readline fieldsize=split(fieldsizerec,",",-1) fieldnamesrec=datafile.readline fieldnames=split(fieldnamesrec,",",-1) fieldtyperec=datafile.readline redim fieldstart(ubound(fieldsize)) totalsize=0 fieldnum.removeall for i=0 to ubound(fieldsize) fieldstart(i)=totalsize totalsize=totalsize+fieldsize(i) fieldnum.add fieldnames(i),i next f1=instr(criteriastr,"`") f2=instr(f1+1,criteriastr,"`") criteriafield=trim(left(criteriastr,f1-1)) criteriaoperator=mid(criteriastr,f1+1,3) criteriavalue=trim(mid(criteriastr,f2+1,999)) fieldn=fieldnum(criteriafield) if criteriaoperator="EQ6" then fieldw=6 else fieldw=fieldsize(fieldn) end if fields=fieldstart(fieldn)+1 while (datafile.AtEndOfStream=FALSE) recorddata=datafile.readline if criteriavalue=trim(mid(recorddata,fields,fieldw)) then getrecno=datafile.line-4 datafile.close exit function end if wend datafile.Close getrecno=-1 end function function header()%> NLGL System V2.2 <%end function function Userinformation(messagestr) if messagestr<>"" then%>
User Information
<%=messagestr%>
   
<% end if end function%> <% function logon_page()%>
">
User Logon
Enter your User Account Details
Username
Password

Change your password
New Password
New Password (Repeat)
 
<% end function function Admin_options_page(msgstr) temp=Userinformation(msgstr)%>
Administrators Options
Logged on Username: ' <%=certuserstr%>' Profile: ' <%=conprofile(certlevel)%>'
<%end function%> <% function Update_user_page() %>
Create or update a User Account
Enter the User's Account Details
New or existing Username
User's profile
Enable details of an existing Username to be updated  
 
<%end function%> <% function Diary_dates_page(fd) %>
Event Diary publication date
Enter the Event Diary publication date
  (dd-mm-yyyy)
Event diary cut off date ">-">-">
Reference of diary to be visible before the cut off date
Reference of diary to be visible on and after the cut off date
 
<%end function%> <% function Update_Homepage_page() %>
Update Homepage HTML
Enter HTML for homepage.
Enter the HTML text for your Homepage.

Or, enter the URL of your homepage preceded by "*" e.g.

*http://www.the-ace-group.co.uk/default.htm

Or, entre the relative URL of your homepage if hosted by Onesite, e.g.

*../../home/the-ace-group/default.htm

 
<% end function function host_options_page(msgstr) userinformation(msgstr)%>
Event Host Options
Logged on Username: ' <%=certuserstr%>' Profile: ' <%=conprofile(certlevel)%>'
<%end function function etd(tval,vval) etd="" if (vval=tval) OR (tval="A" and vval<"A" and vval>"Z") then etd=" Selected " end if end function function Event_update_page(fd,dbasestr) %>
Add or amend an event
Enter the details of the event.
Event Reference

Find

How should this appear?
Event Diary Reference Section Sub-Section
" type="text" name="e3c" size="1" style="font-family: Arial; font-size: 10pt" maxlength="1"> " type="text" name="e3b" size="1" style="font-family: Arial; font-size: 10pt" maxlength="1"> " type="text" name="e3a" size="1" style="font-family: Arial; font-size: 10pt" maxlength="1">
Event title
Description
. Date (dd-mm-yyyy) Time 24Hr (hh:mm)
When does the event start?

" style="font-family: Arial; font-size: 10pt" maxlength="2">-" maxlength="2">-" style="font-family: Arial; font-size: 10pt" maxlength="4">

" style="font-family: Arial; font-size: 10pt" maxlength="2">:" maxlength="2">

When does the event end?

" style="font-family: Arial; font-size: 10pt" maxlength="2">-" maxlength="2">-" style="font-family: Arial; font-size: 10pt" maxlength="4">

" style="font-family: Arial; font-size: 10pt" maxlength="2">:" maxlength="2">

Location
Host's name
Host's daytime tel.
Host's evening tel. (if different from daytime)
Host's mobile tel.
Host's email.
Host's reference code
Web page for more details
Any special booking instructions
Last date for bookings?

" style="font-family: Arial; font-size: 10pt" maxlength="2">-" maxlength="2">-" style="font-family: Arial; font-size: 10pt" maxlength="4">

" style="font-family: Arial; font-size: 10pt" maxlength="2">:" maxlength="2">

Who edited this event last?

<%=dtx(fd(19))%>

<%=fd(18)%>.

Who approved this?

<%=dtx(fd(21))%>

<%=fd(20)%>.

Approved   <%=fd(22)%>.
Source of the event  <%=dbasestr%> .
   
<% end function%> <%function dtx(dt1) dtx=cstr(dt(dt1,"d"))&"-"&cstr(dt(dt1,"m"))&"-"&cstr(dt(dt1,"y"))&" "&cstr(dt(dt1,"h"))&":"&cstr(dt(dt1,"min")) end function function Event_options_page(msgstr)%>
Event Options
Logged on Username: ' <%=certuserstr%>' Profile: ' <%=conprofile(certlevel)%>'
<%end function%> <% function search_for_page(titlestr,optionfieldtext,reportliststr,databasestr,actstr) %>
<%t=searchline1(optionfieldtext,0,0) t=searchline2() t=searchline1(optionfieldtext,1,4) t=searchline2() t=searchline1(optionfieldtext,1,8) t=searchline3(reportliststr,databasestr) t=searchline4() end function function searchline1(optionfieldtext,selectint,off1)%> <%end function function searchline3(reportoptionstr,databaseoptionstr)%> <%roptary=split(reportoptionstr,",") doptary=split(databaseoptionstr,",")%> <%end function function searchline4()%>
Search for <%=titlestr%>

Enter the criteria for your search
Valid dates: 2-Jul-2001, 2 Jul 2001, 2/7/2001, 2001:7:1, H14:00 (i.e. 2pm), 2001:7:1:14:00

And

First line:
No. of lines:


Report Format:
Database to search:


<% end function%> <%function event_00_report_h()%>
<%end function%> <%function event_00E_report() eventcodenum=left(trim(rec("Event_reference")),6) %>
Committee Meeting Minutes Search Results
<%=rec("Serial")%>.  <%=rec("Event_title")%>.
<%=eventcodenum%>

Meeting date:  <%=rec("Starttime")%>.

See Details
  <%=rd(rec("Description"))%>.
<%end function%> <%function event_00_report_f()%>
End of search
<%end function%> <%function event_01_report_h()%>
<%end function%> <%function event_01_report() eventcodenum=left(trim(rec("Event_reference")),6) %>
Event Search Results
<%=rec("Serial")%>.  <%=rec("Event_title")%>.
<%=eventcodenum%>

.

 <%=rd(rec("Description"))%>.

Start date
<%=rec("Starttime")%> .

Book by
<%=rec("Booktime")%> .
Host
<%=rec("Host_name")%> .
See Details
<%end function%> <%function event_01_report_f()%>
End of search
<%end function%> <%function event_02_report_h()%>
<%end function%> <%function fb(istr) if istr="" then istr="." end if fb=istr end function function event_02A_report() eventcodenum=left(trim(rec("Event_reference")),6) %> <%end function%> <%function event_02B_report() eventcodenum=left(trim(rec("Event_reference")),6) %> <%end function%> <%function event_02C_report() eventcodenum=left(trim(rec("Event_reference")),6) %> <%end function%> <%function event_02D_report() eventcodenum=left(trim(rec("Event_reference")),6) %> <%end function%> <%function event_02_report_f()%>
Event Search Results
<%=condatestr(rec("Starttime"))%>

<%=contimestr(rec("Starttime"),rec("Endtime"))%>.

<%=fb(ucase(rec("Event_title")))%> <%if trim(rec("Host_name"))<>"" then response.write trim(rec("Host_name")) response.write "
" end if if trim(rec("Host_email"))<>"" then response.write ""&rec("Host_email")&"" response.write "
" end if if trim(rec("Host_daytime_tel"))<>"" then if trim(rec("Host_evening_tel"))<>"" then response.write "Daytime: "&rec("Host_daytime_tel") response.write "
" else response.write "Tel: "&rec("Host_daytime_tel") response.write "
" end if end if if trim(rec("Host_evening_tel"))<>"" then response.write "Evening: "&rec("Host_evening_tel") response.write "
" end if if trim(rec("Host_mobile_tel"))<>"" then response.write "Mobile: "&rec("Host_evening_tel") response.write "
" end if if trim(rec("Location"))<>"" then response.write rec("Location") response.write "
" end if %>
 
<%response.write fb(rd1(rec("Description"))) if trim(rec("How_to_book"))<>"" then response.write "

" response.write "Please Note: "&rec("How_to_book") end if%>
<%=ucase(rec("Event_title"))%>  
<%=rd1(rec("Description"))%>
<%=ucase(rec("Event_title"))%> Diary
Reference

"
<%=left(rec("Subgroup"),1)%>"
<%=rd1(rec("Description"))%>
<%=ucase(rec("Event_title"))%>  
<%=rd1(rec("Description"))%>
End of search
<%end function%> <%function member_01_report_h()%>
<%end function%> <%function member_01_report() membercodenum=trim(rec("Username")) %> <%end function%> <%function member_01_report_f()%>
Member Search Results
<%=rec("Serial")%>.  <%=rec("Event_title")%>.
  <%=rd(rec("Description"))%>.

Date
<%=rec("Starttime")%> .

Book by
<%=rec("Booktime")%> .
Host
<%=rec("Host_name")%> .
End of search
<%end function%> <%function log_01_report_h()%>
<%end function%> <%function log_01_report() serialnum=rec("Serial") %>
Log Search Results
<%=serialnum%>.  <%=rec("Event_title")%> .
  <%=rd(rec("Description"))%>.

Date
<%=rec("Starttime")%> .

Book by
<%=rec("Booktime")%> .
Host
<%=rec("Host_name")%> .
 
<%end function%> <%function log_01_report_f()%>
End of search
<%end function%> <%function Member_options_page(msgstr) temp=userinformation(msgstr)%>
Members Database Options
Update name, address and other details
Logged on Username: ' <%=certuserstr%>' Profile: ' <%=conprofile(certlevel)%>'
<%end function%> <% function Member_update_page(fd,dbasestr,isrenewal) %>
<%if isrenewal=1 then response.write "<\form>"%>

Add or amend Members details

Enter Member details.

Username

Salutation - Firstname - Middle Initials - Surname
---

House Number
Street address
Town/ City
County
Postcode
Daytime telephone
Mobile phone
Email
How did you learn of us?
Bulletin method
Membership Renewal Date

<%=dt(fd(21),"d")%>-<%=dt(fd(21),"m")%>-<%=dt(fd(21),"y")%>

Membership type

<%=fd(22)%>.

Who edited this last?

<%=dt(fd(18),"d")%>-<%=dt(fd(18),"m")%>-<%=dt(fd(18),"y")%>   <%=dt(fd(18),"h")%>:<%=dt(fd(18),"min")%>

<%=fd(17)%>
Who approved this?

<%=dt(fd(20),"d")%>-<%=dt(fd(20),"m")%>-<%=dt(fd(20),"y")%>   <%=dt(fd(20),"h")%>:<%=dt(fd(20),"min")%>

<%=fd(19)%>
Approved <%=fd(23)%>
Source of member's details  <%=dbasestr%>.
   
<%end function%> <% function Member_Update_Renewal_Page(fd,dbasestr) %>
Update membership renewal
Enter membership renewal details.
  Date (dd-mm-yyyy)
Membership Renewal Date

" style="font-family: Arial; font-size: 10pt">-">-" style="font-family: Arial; font-size: 10pt">

Membership type

Calculate Renewal:

12 months

<%temp=member_update_page(fd,dbasestr,1) end function%>
<%function flat_report_h(titlestr,reportdatastr1) reportdatastr=reportdatastr1 reportdataary=split(reportdatastr,",") %>
<%for i=0 to ubound(reportdataary)%> <%next%> <%end function function flat_report() reportdataary=split(reportdatastr,",") if rec("Serial")=int(rec("Serial")/2)*2 then cols1="bgcolor='#AFC8AF'" else cols1="bgcolor='#AFC8C8'" end if%> <%for i=0 to ubound(reportdataary)%> <%next%> <%end function%> <%function flat_report_f()%>
 <%=titlestr%> search results
 ¬Serial ¬<%=reportdataary(i)%>
nowrap> ¬<%=rec("Serial")%> nowrap> ¬<%=rec(reportdataary(i))%>
bgcolor="#C8C8AF" style="border-right: medium none">End of search
<%end function function footer()%>
<%end function%>