PageRenderTime 24ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/ipplan/user/modifyipformmul.php

#
PHP | 152 lines | 97 code | 24 blank | 31 comment | 4 complexity | 56396ebfaa496cb3d296338b02d4ad88 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. // IPplan v4.92a
  3. // Aug 24, 2001
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 2 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. require_once("../ipplanlib.php");
  20. require_once("/usr/share/php/adodb/adodb.inc.php");
  21. require_once("../class.dbflib.php");
  22. require_once("../layout/class.layout");
  23. require_once("../auth.php");
  24. $auth = new SQLAuthenticator(REALM, REALMERROR);
  25. // And now perform the authentication
  26. $auth->authenticate();
  27. // set language
  28. isset($_COOKIE["ipplanLanguage"]) && myLanguage($_COOKIE['ipplanLanguage']);
  29. //setdefault("window",array("bgcolor"=>"white"));
  30. //setdefault("table",array("cellpadding"=>"0"));
  31. //setdefault("text",array("size"=>"2"));
  32. $title=my_("Modify IP address details (range)");
  33. newhtml($p);
  34. $w=myheading($p, $title, true);
  35. // explicitly cast variables as security measure against SQL injection
  36. list($baseindex, $block, $ip, $search, $expr, $ipplanParanoid) = myRegister("I:baseindex I:block A:ip S:search S:expr I:ipplanParanoid");
  37. //$ip=array($ip); // type array
  38. if (!$_POST) {
  39. myError($w,$p, my_("You cannot reload or bookmark this page!"));
  40. }
  41. // basic sequence is connect, search, interpret search
  42. // result, close connection
  43. $ds=new IPplanDbf() or myError($w,$p, my_("Could not connect to database"));
  44. // save md5str for check in displaysubnet.php to see if info has
  45. // been modified since start of edit
  46. $md5str=$ds->GetMD5($ip, $baseindex);
  47. insert($w,block("<h3>"));
  48. insert($w,text(my_("IP Addresses to modify: ")));
  49. foreach ($ip as $value)
  50. insert($w,text(inet_ntoa($value)." "));
  51. insert($w,block("<small>"));
  52. if (isset($_SERVER['HTTP_REFERER']) and stristr($_SERVER['HTTP_REFERER'], "displaysubnet.php")) {
  53. insert($w,anchor($_SERVER['HTTP_REFERER'], my_("Back to subnet")));
  54. }
  55. insert($w,block("</small>"));
  56. insert($w,block("</h3>"));
  57. // start form
  58. insert($w, $f = form(array("name"=>"MODIFY",
  59. "method"=>"post",
  60. "action"=>"displaysubnet.php")));
  61. myFocus($p, "MODIFY", "user");
  62. insert($f, $con=container("fieldset",array("class"=>"fieldset")));
  63. insert($con, $legend=container("legend",array("class"=>"legend")));
  64. insert($legend, text(my_("User information")));
  65. insert($con,textbr(my_("User")));
  66. insert($con,input_text(array("name"=>"user",
  67. "size"=>"80",
  68. "maxlength"=>"80")));
  69. insert($con,block(" <a href='#' onclick='MODIFY.user.value=\"".
  70. DHCPRESERVED."\";'>".my_("DHCP address")."</a>"));
  71. insert($con,textbrbr(my_("Location")));
  72. insert($con,input_text(array("name"=>"location",
  73. "size"=>"80",
  74. "maxlength"=>"80")));
  75. insert($con,textbrbr(my_("Device description")));
  76. insert($con,input_text(array("name"=>"descrip",
  77. "size"=>"80",
  78. "maxlength"=>"80")));
  79. insert($con,textbrbr(my_("Telephone number")));
  80. insert($con,input_text(array("name"=>"telno",
  81. "size"=>"15",
  82. "maxlength"=>"15")));
  83. insert($con,hidden(array("name"=>"baseindex",
  84. "value"=>$baseindex)));
  85. insert($con,hidden(array("name"=>"block",
  86. "value"=>$block)));
  87. insert($con,hidden(array("name"=>"search",
  88. "value"=>$search)));
  89. insert($con,hidden(array("name"=>"expr",
  90. "value"=>"$expr")));
  91. $cnt=0;
  92. foreach ($ip as $value) {
  93. insert($con,hidden(array("name"=>"ip[".$cnt++."]",
  94. "value"=>"$value")));
  95. }
  96. insert($con,hidden(array("name"=>"md5str",
  97. "value"=>"$md5str")));
  98. insert($f,submit(array("value"=>my_("Submit"))));
  99. insert($f,freset(array("value"=>my_("Clear"))));
  100. // start form for delete
  101. // all info will be blank, thus record will be deleted
  102. $settings=array("name"=>"DELETE",
  103. "method"=>"post",
  104. "action"=>"displaysubnet.php");
  105. if ($ipplanParanoid)
  106. $settings["onsubmit"]="return confirm('".my_("Are you sure?")."')";
  107. insert($w, $f = form($settings));
  108. insert($f,hidden(array("name"=>"baseindex",
  109. "value"=>"$baseindex")));
  110. insert($f,hidden(array("name"=>"block",
  111. "value"=>"$block")));
  112. insert($f,hidden(array("name"=>"search",
  113. "value"=>$search)));
  114. insert($con,hidden(array("name"=>"expr",
  115. "value"=>"$expr")));
  116. $cnt=0;
  117. foreach ($ip as $value) {
  118. insert($f,hidden(array("name"=>"ip[".$cnt++."]",
  119. "value"=>"$value")));
  120. }
  121. insert($f,hidden(array("name"=>"action",
  122. "value"=>"delete")));
  123. insert($f,hidden(array("name"=>"md5str",
  124. "value"=>"$md5str")));
  125. insert($f,submit(array("value"=>my_("Delete records"))));
  126. insert($f,textbr(my_("WARNING: Deleting an entry does not preserve the last modified information as the record is completely removed from the database to conserve space.")));
  127. printhtml($p);
  128. ?>