<%@ Language=VBScript %> <%Response.Redirect "default.asp"%> Account Setup
<% response.write("

Welcome to The Website Manager

") response.write("

The Website Manager allows Parents to OVERRIDE in the Master Kidsnet database. Kidsnet has rated and revised websites that amount for 98 percent of all web traffic. Occasionally you may come accross a site that you cannot access or one you may wish to block. WebSite Manager allows you to do this.

""Add Url/Delete Url"" adds/deletes your settings in/from the Url List and does not save it in database. When you are done with all your settings click ""Submit"" to save the settings in the database.

") %> "> <% function TrimComma(strValue) Dim lenStr Dim retStr 'ret = InStr(1,strValue,",") lenStr = Len(strValue) 'for i = 1 to lenStr retStr = Left(strValue,1) while retStr = "," if retStr = "," then strValue = Right(strValue,lenStr - 1) end if retStr = Left(strValue,1) lenStr = Len(strValue) wend ' Here we have trimmed all leading , ' now trim all trailing 'for i = 1 to lenStr retStr = Right(strValue,1) while retStr = "," if retStr = "," then strValue = Left(strValue,lenStr - 1) end if retStr = Right(strValue,1) lenStr = Len(strValue) Wend end function if(Request.Form("btnSubmit")<> "Submit") then dim strparentID strparentID = Request.Form("btnHidden").Item strparentID = Request.QueryString("ID").Item Session("parentID") = strparentID else ' ' Update database 'allowedKidsArray = Session("aKidsArray") 'blockedKidsArray = Session("dKidsArray") 'urlArray = Session("uArray") 'Kids = Session("aKids") dim kid1 dim parentId parentId = Request.Form("btnHidden").Item ' Open database connection set cn = Server.CreateObject("ADODB.Connection") cn.ConnectionTimeout = 6000000 cn.CommandTimeout = 6000000 cn.Open "DSN=Kidsnet_Parent;uid=sa;pwd=sgmkj;APP=ASP Script;DATABASE=Exception" Set rs = Server.CreateObject("ADODB.Recordset") ' dim allowedKids, blockedKids for each kid1 in Request.Form("txtKidId") 'Kidid = parentId + "_" + kid1 sqlQuery = "delete from exceptionList where kidid = '" & kid1 & "'" rs.Open sqlQuery,cn next dim nCountKidList dim allowedStatus for each kid1 in Request.Form("txtKidId") nCountKidList = 1 for each Url in Request.Form("txtURL") allowedStatus = -1 allowedKids = Request.Form("txtAllowedKids").Item(nCountKidList) blockedKids = Request.Form("txtBlockedKids").Item(nCountKidList) nAllowedIndex = InStr(1, allowedKids, kid1, 0) nBlockedIndex = InStr(1, blockedKids, kid1, 0) if(nAllowedIndex <> 0) then allowedStatus = 1 else if(nBlockedIndex <> 0)then allowedStatus = 0 end if end if 'Kidid = parentId + "_" + kid1 if(allowedStatus <> -1) then Kidid = kid1 'INSERT INTO ExceptionList ([KidId], [URL], [Allowed]) VALUES ('n', 'nL', '1') sqlQuery = "INSERT INTO ExceptionList ([KidId],[URL], [Allowed]) VALUES ('" & KidId & "', '" & Url & "', '" & allowedStatus & "')" rs.Open sqlQuery, cn end if nCountKidList = nCountKidList + 1 next next end if '******************* ' Render page '******************* if(Request.Form("btnSubmit")<> "Submit") then else strparentID = Session("parentID") end if Dim urlArr(255),strAllowedKids(255),strBlockedKids(255),urlEnd(255) dim urlArray(255), allowedKidsArray(255), blockedKidsArray(255) Set cn = Server.CreateObject("ADODB.Connection") cn.Open "DSN=Kidsnet_Parent;uid=sa;pwd=sgmkj;APP=ASP Script;DATABASE=Exception" Set rsExc = Server.CreateObject("ADODB.Recordset") Set cn2 = Server.CreateObject("ADODB.Connection") cn2.ConnectionTimeout = 6000000 cn2.CommandTimeout = 6000000 cn2.Open "DSN=Kidsnet_Parent;uid=sa;pwd=sgmkj;APP=ASP Script;DATABASE=Kidsnet" Set rsKidsnet = Server.CreateObject("ADODB.Recordset") ' Get the Kid data for the Url. 'KidlstQuery = "select kidlist from Parent where parentid = '" & strparentID & "'" KidlstQuery = "select kidlist,KidCount from Parent where parentid = '" & strparentID & "'" rsKidsnet.Open KidlstQuery,cn2 dim nKidCount dim nKidCountfromDB if rsKidsnet.EOF <> true then KidList = rsKidsnet("kidlist") nKidCountfromDB = rsKidsnet("KidCount") if nKidCountfromDB = 0 then Response.Write("

There are no Kid accounts created for Parent = " & strparentID & ".

") else Kids = split(KidList,vbCrLf) 'Kids = split("sameer_kid1,sameer_kid2,nischal_kid1,nischal_kid2,nischal_kid3",",") ' For each kid get the Urls from the database. UrlQuery = "select * from ExceptionList" i = 0 for each kid in kids nKidCount = nKidCount + 1 kid = Trim(kid) 'RTrim(kid) rsExc.Open UrlQuery,cn 'Here we got the kid. while rsExc.EOF <> true if kid = rsExc("kidid") then urlArr(i) = rsExc("Url") if rsExc("Allowed") = true then strAllowedKids(i) = rsExc("kidid") strBlockedKids(i) = "" else strBlockedKids(i) = rsExc("kidid") strAllowedKids(i) = "" end if i = i + 1 end if rsExc.MoveNext WEnd rsExc.Close next 'urlArr(i) = "End" end if end if ' Here we got the Url List, Allowed and blocked kid list. i=0 k=0 while urlArr(i) <> empty url = urlArr(i) ' Check for this Url in Array j=0 while urlArr(j) <> empty if urlArr(j) = url and urlArr(j) <> "end" then AllowedKid = AllowedKid + strAllowedKids(j) & "," BlockedKid = BlockedKid + strBlockedKids(j) & "," urlArr(j) = "end" end if j = j+1 WEnd if url <> "end" and url <> empty then 'Here create new array urlArray(k) = url TrimComma AllowedKid TrimComma BlockedKid allowedKidsArray(k) = AllowedKid blockedKidsArray(k) = BlockedKid urlEnd(k) = url & "|" & AllowedKid & vbCrLf & BlockedKid AllowedKid = "" BlockedKid = "" k=k+1 end if i=i+1 Wend 'Session("aKidsArray") = allowedKidsArray 'Session("dKidsArray") = blockedKidsArray 'Session("uArray") = urlArray 'Session("aKids") = Kids '******************* if nKidCount = 0 then %>
Enter Url: 
For Example www.website.com or www.website.com/directory <% response.write("

") response.write("   Allow access to this website or page for ALL Kids
") response.write("") response.write("   Deny access to this website or page for ALL Kids") %> <%else%> Enter Url: 
For Example www.website.com or www.website.com/directory <% response.write("

") response.write("   Allow access to this website or page for ALL Kids
") response.write("") response.write("   Deny access to this website or page for ALL Kids") end if %> <% for i = 0 to nKidCount - 1 if Kids(i) <> "" then %> <% end if %> <%next%>
KidId Allow Block

                                                                                                                  

<% dim i i = 0 while urlArray(i) <> empty %> <%i = i + 1 WEnd%>
Urls Allowed Kids Blocked Kids Edit Delete

                                                                                                                   <%if nKidCount = 0 then %> <%else%> <%end if %>