<%@ LANGUAGE="VBSCRIPT" %> SmartLocator

<% 'On Error Resume Next '---- CursorTypeEnum Values ---- Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 '---- LockTypeEnum Values ---- Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 Const adLockBatchOptimistic = 4 Dim dropDown ' load companies found in listbox Dim strCount ' used to count companies found from search dropDown= "" strCount = Null %> <% Set conn = Server.CreateObject("ADODB.Connection") ' Set objRec= Server.CreateObject ("ADODB.Recordset") conn.Open "DSN=zipsearch" ' conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Data\islamicbase.mdb" ' objRec.Open "companies", conn, 1, 1, 2 'while Not objRec.EOF 'Response.Write objRec ("company") & "," 'objRec.MoveNext 'Wend ' verify login user id and pass adminSQL = "SELECT * FROM AdminInfo;" Set adminQuery = Conn.Execute(adminSQL) ' If ((qLogin = adminQuery("Login")) AND (qPassword = adminQuery("Password"))) Then If NOT (Session("verified")) then 'failed the session verify %>
Username: Please enter a login and password to gain access to the administration system.
Password:
 
<% ELSE 'Login correct Select Case Request("op") Case "delete" remSQL = "SELECT * FROM Companies WHERE CompanyNumber = " & Request("CompanyNumber") & ";" Set remQuery = Conn.Execute(remSQL) If Not(remQuery.EOF) Then remStr = remQuery("Company") dSQL = "DELETE * FROM Companies WHERE CompanyNumber = " & Request("CompanyNumber") & ";" Set dQuery = Conn.Execute(dSQL) strCount = -3 End If Case "options" strCount = -5 If Trim(Request("map")) = "" Then strMap = " False " Else strMap = "True " End If optionsSQL = "UPDATE AdminInfo SET AdminInfo.Login = '" & Request("Login") & "', AdminInfo.Password = '" & Request("Password") & "', AdminInfo.User1Name = '" & Request("User1Name") & "', AdminInfo.User2Name = '" & Request("User2Name") & "', AdminInfo.User3Name = '" & Request("User3Name") & "', AdminInfo.map =" & strMap & ", AdminInfo.color ='" & Request("color") & "' ;" Set optionsQuery = Conn.Execute(optionsSQL) Case "update" strCount = -2 CurrentTime = Date() instSQL = "UPDATE Companies SET " Call BuildSQL("Company", instSQL, "Text") Call BuildSQL("Street", instSQL, "Text") Call BuildSQL("Street2", instSQL, "Text") Call BuildSQL("City", instSQL, "Text") Call BuildSQL("State", instSQL, "Text") Call BuildSQL("Zip", instSQL, "Text") Call BuildSQL("Country", instSQL, "Text") Call BuildSQL("Phone", instSQL, "Text") Call BuildSQL("Fax", instSQL, "Text") Call BuildSQL("EMail", instSQL, "Text") Call BuildSQL("URL", instSQL, "Text") Call BuildSQL("ContactName", instSQL, "Text") Call BuildSQL("ContactPosition", instSQL, "Text") Call BuildSQL("User1", instSQL, "Text") Call BuildSQL("User2", instSQL, "Text") Call BuildSQL("User3", instSQL, "Text") Call BuildSQL("Approved", instSQL, "Bool") Call BuildSQL("Login", instSQL, "Text") Call BuildSQL("Password", instSQL, "Text") instSQL = instSQL & "DateEntered = " & CurrentTime & " " instSQL = instSQL & "WHERE CompanyNumber = " & Request.Form("CompanyNumber") & ";" set instQuery = conn.execute(instSQL) Case "addnew" strCount= -4 Set rsInsert = Server.CreateObject("ADODB.RecordSet") rsInsert.Open "Companies" , Conn, 3, 3 rsInsert.AddNew rsInsert("Company") = CleanValue("Company", "Text") rsInsert("Street") = CleanValue("Street", "Text") rsInsert("Street2") = CleanValue("Street2", "Text") rsInsert("City") = CleanValue("City", "Text") rsInsert("State") = CleanValue("State", "Text") rsInsert("Zip") = CleanValue("Zip", "Text") rsInsert("Country") = CleanValue("Country", "Text") rsInsert("Phone") = CleanValue("Phone", "Text") rsInsert("Fax") = CleanValue("Fax", "Text") rsInsert("EMail") = CleanValue("EMail", "Text") rsInsert("URL") = CleanValue("URL", "Text") rsInsert("ContactName") = CleanValue("ContactName", "Text") rsInsert("ContactPosition") = CleanValue("ContactPosition", "Text") rsInsert("User1") = CleanValue("User1", "Text") rsInsert("User2") = CleanValue("User2", "Text") rsInsert("User3") = CleanValue("User3", "Text") rsInsert("Approved") = CleanValue("Approved", "Bool") rsInsert("Login") = CleanValue("Login", "Text") rsInsert("Password") = CleanValue("Password", "Text") rsInsert("DateEntered") = Date() rsInsert.Update rsInsert.Close Case "search" strCount = 0 If Request.Form("SearchName")<> "" Then strName = Request.Form("Searchname") strSQL = "SELECT * FROM Companies WHERE (Company LIKE '%" & strName & "%' ) Order By Company ;" Set rsQuery = Conn.Execute(strSQL) While NOT rsQuery.EOF AND strCount <100 dropDown = dropDown & "