<%@ Language=VBScript %> <% ' policylist.asp hb/ec-logic Option Explicit Response.Buffer = false Response.Expires = -1 ' very important to prevent client from caching %> Car Policy - Policylist
<% '----------------------------------------------------------------- ' IsPolicyUnique checks a given name for uniqueness in policy table '----------------------------------------------------------------- Function IsPolicyUnique (strName) DIM nameConn, RS, strSearch if Len(Trim(strName)) = 0 then IsPolicyUnique = true else SET nameConn = Server.CreateObject("ADODB.Connection") SET RS = Server.CreateObject("ADODB.RecordSet") nameConn.Open "DSN=" & Session("database") & ";UID=" & Session("shopuser") & ";PWD=" & Session("shoppwd") strSearch = "SELECT * FROM policy where policyname='" & strName & "'" RS.Open strSearch, nameConn, adOpenStatic ' did we find a record for that login? IF not(RS.EOF AND RS.BOF) THEN IsPolicyUnique = false else IsPolicyUnique = true end if ' close recordset and connection RS.Close nameConn.Close end if end Function ' ############## main loop ################################# DIM strMsg, bUnique, bShow bUnique = true bShow = true if Len(Request.Form("go")) > 0 then bUnique = IsPolicyUnique(Request.Form("policyname")) ' validate if not bUnique then strMsg = "Der Policyname ist schon vergeben!" ' OK else strMsg = "Policy: " & Request.Form("policyname") & " wurde aufgenommen!" Session("policyname") = Request.Form("policyname") bShow = false %> <% if Len(strMsg) > 0 then %> <% end if %>

Neue Policy vergeben

<%=strMsg%>
Policyregeln hinzufügen
<% end if end if if bShow then %>
Zurück zur Policyliste

Neue Policy vergeben


Bitte geben Sie einen eindeutigen Namen für die neue Policy an.
<% if Len(strMsg) > 0 then %> <% end if %>
<%=strMsg%>
Policyname: ">
<% end if %>