% if (isNull(request.cookies("ckyUserID"))) or (request.cookies("ckyUserID")="") then response.redirect "index.asp" end if %> <% rowCount = 0 if getUserType(Request.Cookies("ckyUserID"))<>47 then response.redirect "home.asp" end if if Request.querystring("btnSave") = "Save" then UserID = Request.QueryString("UserID") strUserName = fixquote(Request.QueryString("strUserName")) uType = Request.QueryString("uType") strPW = fixquote(request.QueryString("strPW")) strEmail = fixquote(request.QueryString("strEmail")) strSignature = fixquote(request.QueryString("strSignature")) if UserID>0 then s = "SELECT * From tblUser WHERE strUserName = '" & strUserName & "' AND UserID <> " & UserID set rst = cn.execute(s) if not rst.eof then Response.Write "" lngID = UserID else if uType = 1 then lngType = 47 else lngType = 33 end if if lngType = 33 then s = "SELECT count(*) as theCount From tblUser WHERE lngType=47 AND UserID <> " & UserID set rst1 = cn.execute(s) if not rst1.eof then if rst1("theCount") = 0 then lngType=47 response.Write "" end if end if rst1.close end if if strPW = "***************" then s = "Update tblUser Set strUserName = '" & strUserName & "', strEmail='" & strEmail & "', lngType=" & lngType & ", strSignature='" & strSignature & "' WHERE UserID = " & UserID else s = "Update tblUser Set strUserName = '" & strUserName & "', strEmail='" & strEmail & "', strPW='" & md5(strPW) & "', lngType=" & lngType & ", strSignature='" & strSignature & "' WHERE UserID = " & UserID end if set rst1 = cn.execute(s) end if rst.close else s = "SELECT * From tblUser WHERE strUserName = '" & strUserName & "'" set rst = cn.execute(s) if not rst.eof then btnAdd = "Add" response.Write "" else if uType=1 then lngType=47 else lngType=33 end if s = "Insert Into tblUser (strUserName, strPW, strEmail, lngType, strSignature) values ('" & strUserName & "', '" & md5(strPW) & "', '" & strEmail & "', " & lngType & ", '" & strSignature & "')" set rst2 = cn.execute(s) end if rst.close end if elseif request.QueryString("btnDelete") = "Delete" then myUID = getUserID(request.Cookies("ckyUserID")) arrID = split(Request.QueryString("arrID"),",") intNotDeleted=0 intQueryCount=0 for z = 0 to ubound(arrID) if myUID <> arrID(z) then s = "Select * From tblQuery WHERE refUserID = " & arrID(z) set rst = cn.execute(s) if not rst.eof then ' intQueryCount = intQueryCount + 1 s = "Delete From tblQuery WHERE refUserID = " & arrID(z) set rst2 = cn.execute(s) s = "Delete From tblUser WHERE UserID = " & arrID(z) set rst2 = cn.execute(s) response.Write "" else s = "Delete From tblUser WHERE UserID = " & arrID(z) set rst2 = cn.execute(s) end if rst.close else intNotDeleted = intNotDeleted + 1 end if next if intNotDeleted > 0 then response.Write "" end if if intQueryCount > 0 then response.Write "" end if end if %>