home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / windowsxp / ftgateoffice / ftgateoffice.exe / Main / addresshttp.fts < prev    next >
Encoding:
Text File  |  2001-11-29  |  12.6 KB  |  387 lines

  1. <%
  2. #include </utility/security.fts>
  3. #include </utility/global.fts>
  4. #include </utility/theme.fts>
  5. #include </utility/ftgate.fts>
  6.  
  7. var w = new server.web
  8.  
  9. var id
  10.  
  11. session.system.error=0
  12.  
  13. if (form.config=="1")
  14. {
  15.     id = form.id
  16.  
  17.     w.id = id
  18.  
  19.     if (form.command=="1")
  20.     {
  21.         var entry=string(form.permit)
  22.         var index=entry.indexOf("[", 0)
  23.         var last=entry.indexOf("]", 0)
  24.         var address = entry.slice(0,index)
  25.         var mask = entry.slice((index+1),last)
  26.  
  27.         w.ip.permit.remove(address, mask)
  28.     }
  29.     else if (form.command=="2")
  30.     {
  31.         var entry=string(form.reject)
  32.         var index=entry.indexOf("[", 0)
  33.         var last=entry.indexOf("]", 0)
  34.         var address = entry.slice(0,index)
  35.         var mask = entry.slice((index+1),last)
  36.  
  37.         w.ip.reject.remove(address, mask)
  38.     }
  39.     else if (form.command=="3")
  40.         w.ip.permit.add(form.permitaddr, form.permitmask)
  41.     else if (form.command=="4")
  42.         w.ip.reject.add(form.rejectaddr, form.rejectmask)
  43.  
  44.     if (form.redirect!="")
  45.         output.redirect(form.redirect+"?id="+id)
  46. }
  47. else if (form.config=="2")
  48. {
  49.   if (form.redirect!="")
  50.         output.redirect(form.redirect+"?id="+form.id)
  51. }
  52. else
  53. {
  54.     id = request.id
  55.     w.id = id
  56. }
  57. %>
  58. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  59. <HTML>
  60. <HEAD>
  61. <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
  62. <META name="GENERATOR" content="Microsoft Developer Studio">
  63. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  64. <TITLE>Services -- Web Addresses</TITLE>
  65.  
  66. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  67. <!--
  68. var dir="<%=buttons%>";
  69. var pro=<%=build()==FTGATE_PRO%>;
  70.  
  71. if (!document.images) {}
  72. else {
  73.   create0 = new Image();
  74.   create0.src  = dir+"create.gif";
  75.   create1 = new Image();
  76.   create1.src = dir+"createon.gif";
  77.   delete0 = new Image();
  78.   delete0.src  = dir+"delete.gif";
  79.   delete1 = new Image();
  80.   delete1.src = dir+"deleteon.gif";
  81. }
  82.  
  83. <%
  84. if (netscape)
  85. {
  86.   %>
  87.   document.captureEvents(Event.KEYPRESS);
  88.   document.onkeypress = keypress;
  89.  
  90.   function keypress(event)
  91.   {
  92.     if (event.which==13)
  93.     {
  94.       if (document.activeElement==document.ftgate.permitaddr||
  95.           document.activeElement==document.ftgate.permitmask)
  96.         onAdd(document.ftgate.permitaddr, document.ftgate.permitmask, document.ftgate.permit, 'createA', 3)
  97.       else if (document.activeElement==document.ftgate.rejectaddr||
  98.           document.activeElement==document.ftgate.rejectmask)
  99.         onAdd(document.ftgate.rejectaddr, document.ftgate.rejectmask, document.ftgate.reject, 'createA', 4)
  100.       return false;
  101.     }
  102.  
  103.     return true;
  104.   }
  105.   <%
  106. }
  107. else
  108. {
  109.   %>
  110.   function keypress()
  111.   {
  112.     if (event.keyCode==13)
  113.     {
  114.       event.returnValue=null;
  115.       if (document.activeElement==document.ftgate.permitaddr||
  116.           document.activeElement==document.ftgate.permitmask)
  117.         onAdd(document.ftgate.permitaddr, document.ftgate.permitmask, document.ftgate.permit, 'createA', 3)
  118.       else if (document.activeElement==document.ftgate.rejectaddr||
  119.           document.activeElement==document.ftgate.rejectmask)
  120.         onAdd(document.ftgate.rejectaddr, document.ftgate.rejectmask, document.ftgate.reject, 'createA', 4)
  121.     }
  122.   }
  123.   <%
  124. }
  125. %>
  126.  
  127. function onLoad()
  128. {
  129.     setPage(5, "Web Service");
  130.   onSelect(document.ftgate.permitaddr, document.ftgate.permitmask, document.ftgate.permit)
  131.   onSelect(document.ftgate.rejectaddr, document.ftgate.rejectmask, document.ftgate.reject)
  132.  
  133.     <%
  134.     if (form.command=="4")
  135.         output.write("document.ftgate.rejectaddr.focus();")
  136.     else
  137.         output.write("document.ftgate.permitaddr.focus();")
  138.     %>
  139. }
  140.  
  141. function onAdd(addr, subnet, list, button, command)
  142. {
  143.   change(button, 'create', 0);
  144.  
  145.     if (!isAddr(addr.value))
  146.     {
  147.         alert(errIP);
  148.         addr.focus();
  149.         return;
  150.     }
  151.  
  152.     if (!isAddr(subnet.value))
  153.     {
  154.         alert(errSubnet);
  155.         subnet.focus();
  156.         return;
  157.     }
  158.  
  159.     document.ftgate.command.value=command;
  160.     document.ftgate.submit();
  161. }
  162.  
  163. function onDelete(list, button, command)
  164. {
  165.   change(button, 'delete', 0);
  166.  
  167.     if (list.selectedIndex!=-1)
  168.     {
  169.         document.ftgate.command.value=command;
  170.         document.ftgate.submit();
  171.     }
  172. }
  173.  
  174. function onSelect(part1, part2, list)
  175. {
  176.     var index = list.selectedIndex;
  177.  
  178.     if (index!=-1)
  179.     {
  180.         var str = list.options[index].text;
  181.         var start = str.indexOf("[");
  182.         var end = str.indexOf("]");
  183.  
  184.         part1.value = str.slice(0, start);
  185.         part2.value = str.slice(start+1,end);
  186.     }
  187. }
  188.  
  189. function isOK(form)
  190. {
  191.   return true;
  192. }
  193.  
  194. //-->
  195. </SCRIPT>
  196. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
  197. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
  198. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/time.js" TYPE="text/javascript"></SCRIPT>
  199. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/spin.js" TYPE="text/javascript"></SCRIPT>
  200. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/dialog.js" TYPE="text/javascript"></SCRIPT>
  201. </HEAD>
  202.  
  203. <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onkeypress="keypress()">
  204.  
  205. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="<%=bodywidth%>" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
  206.  
  207. <A HREF="index.fts"><SPAN ID="top">Services</SPAN></A><SPAN ID="top"> /</SPAN>
  208. <SPAN ID="topsel"><%=w.name%></SPAN>
  209.  
  210. <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="addresshttp.fts">
  211. <!-- hidden variables -->
  212. <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
  213. <INPUT TYPE="HIDDEN" NAME="command" VALUE="0">
  214. <INPUT TYPE="HIDDEN" NAME="id" VALUE="<%=id%>">
  215. <INPUT TYPE="HIDDEN" NAME="redirect" VALUE="">
  216.  
  217. <!-- start of the tabs -->
  218. <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
  219.   <TR>
  220.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  221.         <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('http.fts')" CLASS="navoff">General</A></TD>
  222.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  223.         <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('scripts.fts')" CLASS="navoff">Scripts</A></TD>
  224.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  225.         <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('virtuals.fts')" CLASS="navoff">Virtuals</A></TD>
  226.         <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
  227.         <TD CLASS="navon" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('addresshttp.fts')" CLASS="navon">Addresses</A></TD>
  228.         <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right-s.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
  229.         <TD WIDTH="<%=bodywidth-223%>" HEIGHT="18"> </TD>
  230.   </TR>
  231. </TABLE>
  232. <!-- end of the tabs -->
  233.  
  234. <!-- start of the tab body -->
  235. <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
  236. <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
  237. <!-- start of block -->
  238. <TR>
  239. <TD VALIGN="TOP">
  240.   <TABLE BORDER="0" WIDTH="100%">
  241.         <!-- sub table goes here -->
  242.     <TR>
  243.       <TD>
  244.               <TABLE CLASS="box" WIDTH="100%">
  245.           <TR>
  246.             <TD>
  247.               <TABLE BORDER="0" WIDTH="100%">
  248.                                 <TR>
  249.                                     <TH COLSPAN="4">Permit connections to the following addresses</TH>
  250.                                 </TR>
  251.                                 <TR>
  252.                   <TD ROWSPAN="2" WIDTH="1%" VALIGN="TOP">
  253.                              <A HREF="javascript:onDelete(document.ftgate.permit, 'deleteA', 1)"
  254.                             onMouseDown="change('deleteA', 'delete', 1)"
  255.                             onMouseOut="change('deleteA', 'delete', 0)"><IMG SRC="<%=buttons%>delete.gif" NAME="deleteA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Remove permitted domain"></A>
  256.                   </TD>
  257.                                     <TD ROWSPAN="2">
  258.                                         <SELECT NAME="permit" CLASS="SEL100" SIZE="5" 
  259.                                             onChange="onSelect(document.ftgate.permitaddr, document.ftgate.permitmask, document.ftgate.permit)">
  260.                                         <%
  261.                                         var first=true
  262.  
  263.                                         var ok=w.ip.permit.first()
  264.                                         while (ok)
  265.                                         {
  266.                                             var str = w.ip.permit.addr+"["+w.ip.permit.mask+"]"
  267.  
  268.                                             output.write("<OPTION ")
  269.                                             if (first)
  270.                                             {
  271.                                                 first=false
  272.                                                 output.write("SELECTED ")
  273.                                             }
  274.                                             output.writeln("VALUE="+str+">"+str+"</OPTION>")
  275.                                             ok=w.ip.permit.next()
  276.                                         }
  277.                                         %>
  278.                                         </SELECT>
  279.                                     </TD>
  280.                                     <TD WIDTH="1%" VALIGN="TOP">Address</TD>
  281.                                     <TD WIDTH="1%" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="permitaddr" VALUE="" onChange="setModified(true)"></TD>
  282.                   <TD WIDTH="1%" VALIGN="TOP" ROWSPAN="2">
  283.                              <A HREF="javascript:onAdd(document.ftgate.permitaddr, document.ftgate.permitmask, document.ftgate.permit, 'createA', 3)"
  284.                             onMouseDown="change('createA', 'create', 1)"
  285.                             onMouseOut="change('createA', 'create', 0)"><IMG SRC="<%=buttons%>create.gif" NAME="createA" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Add permitted domain"></A>
  286.                   </TD>
  287.                                 </TR>
  288.                                 <TR>
  289.                                     <TD WIDTH="1%" VALIGN="TOP">Subnet</TD>
  290.                                     <TD WIDTH="1%" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="permitmask" VALUE="" onChange="setModified(true)"></TD>
  291.                                 </TR>
  292.               </TABLE>
  293.                         </TD>
  294.                     </TR>
  295.         </TABLE>
  296.       </TD>
  297.     </TR>
  298.         <!-- sub table ends here -->
  299.         <!-- sub table starts here -->
  300.     <TR>
  301.       <TD>
  302.               <TABLE CLASS="box" WIDTH="100%">
  303.           <TR>
  304.             <TD>
  305.               <TABLE BORDER="0" WIDTH="100%">
  306.                                 <TR>
  307.                                     <TH COLSPAN="4">Refuse connections from the following addresses</TH>
  308.                                 </TR>
  309.                                 <TR>
  310.                   <TD ROWSPAN="2" WIDTH="1%" VALIGN="TOP">
  311.                              <A HREF="javascript:onDelete(document.ftgate.reject, 'deleteB', 2)"
  312.                             onMouseDown="change('deleteB', 'delete', 1)"
  313.                             onMouseOut="change('deleteB', 'delete', 0)"><IMG SRC="<%=buttons%>delete.gif" NAME="deleteB" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Remove rejected domain"></A>
  314.                   </TD>
  315.                                     <TD ROWSPAN="2">
  316.                                         <SELECT NAME="reject" CLASS="SEL100" SIZE="5"
  317.                                             onChange="onSelect(document.ftgate.rejectaddr, document.ftgate.rejectmask, document.ftgate.reject)">
  318.                                         <%
  319.                                         first=true
  320.  
  321.                                         ok=w.ip.reject.first()
  322.                                         while (ok)
  323.                                         {
  324.                                             var str = w.ip.reject.addr+"["+w.ip.reject.mask+"]"
  325.  
  326.                                             output.write("<OPTION ")
  327.                                             if (first)
  328.                                             {
  329.                                                 first=false
  330.                                                 output.write("SELECTED ")
  331.                                             }
  332.                                             output.writeln("VALUE="+str+">"+str+"</OPTION>")
  333.                                             ok=w.ip.reject.next()
  334.                                         }
  335.                                         %>
  336.                                         </SELECT>
  337.                                     </TD>
  338.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP">Address</TD>
  339.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP"><INPUT TYPE="TEXT" NAME="rejectaddr" VALUE="" onChange="setModified(true)"></TD>
  340.                   <TD WIDTH="1%" VALIGN="TOP" ROWSPAN="2">
  341.                              <A HREF="javascript:onAdd(document.ftgate.rejectaddr, document.ftgate.rejectmask, document.ftgate.reject, 'createB', 4)"
  342.                             onMouseDown="change('createB', 'create', 1)"
  343.                             onMouseOut="change('createB', 'create', 0)"><IMG SRC="<%=buttons%>create.gif" NAME="createB" BORDER="0" WIDTH="20" HEIGHT="20" ALT="Add rejected domain"></A>
  344.                   </TD>
  345.                                 </TR>
  346.                                 <TR>
  347.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP">Subnet</TD>
  348.                                     <TD WIDTH="1%" NOWRAP VALIGN="TOP"><INPUT TYPE="TEXT" NAME="rejectmask" VALUE="" onChange="setModified(true)"></TD>
  349.                                 </TR>
  350.               </TABLE>
  351.                         </TD>
  352.                     </TR>
  353.         </TABLE>
  354.       </TD>
  355.     </TR>
  356.         <!-- sub table ends here -->
  357.         <!-- table footer goes here -->
  358.         <TR>
  359.             <TD ALIGN="RIGHT">
  360.                 <A HREF="javascript:onClose()"
  361.                 onMouseDown="change('closeA', 'ok', 1)"
  362.                 onMouseOut="change('closeA', 'ok', 0)"><IMG SRC="<%=buttons%>ok.gif" NAME="closeA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Apply changes and close" HSPACE="5"></A>
  363.             </TD>
  364.         </TR>
  365.         <!-- table footer ends here -->
  366.   </TABLE>
  367. </TD>
  368. </TR>
  369. <!-- end of block -->
  370. </TABLE>
  371. <!-- end of the tab body -->
  372. </TD></TR></TABLE>
  373.  
  374. <!-- footer starts here -->
  375. <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
  376. <!--
  377.     var href="/services/addresshttp.fts?id=<%=id%>";
  378.     var bodywidth=<%=bodywidth%>;
  379. //-->
  380. </SCRIPT>
  381. <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/footer.js" TYPE="text/javascript"></SCRIPT>
  382. <!-- footer ends here -->
  383. </FORM>
  384. </TD><TD WIDTH="10"> </TD></TR></TABLE>
  385. </BODY>
  386. </HTML>
  387.