PageRenderTime 91ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/EditNode.php

https://github.com/ninuxorg/wnmap
PHP | 254 lines | 227 code | 9 blank | 18 comment | 8 complexity | 7c5281bc1aa3a7eecd79e2c8f4430736 MD5 | raw file
  1. <?php
  2. /*
  3. WNMap
  4. Copyright (C) 2006 Eric Butler <eric@extremeboredom.net>
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. require ("config.php");
  18. require ("geocode_lib.php");
  19. ?>
  20. <html>
  21. <head>
  22. <style type="text/css">
  23. body {
  24. margin-left: auto;
  25. margin-right: auto;
  26. width: 400px;
  27. }
  28. body, body * {
  29. font-family: Bitstream Vera Sans, Verdana;
  30. }
  31. h1 {
  32. font-size: x-large;
  33. }
  34. p {
  35. font-size: small;
  36. }
  37. label,td, input,textarea {
  38. font-size: small;
  39. }
  40. .reallysmall {
  41. font-size: x-small;
  42. }
  43. hr {
  44. height: 1px !important;
  45. border: 0px !important;
  46. background-color: #666;
  47. }
  48. .buttonbox {
  49. text-align: right;
  50. padding: 0px;
  51. margin-top: 10px;
  52. }
  53. .alt {
  54. background-color: #eee;
  55. }
  56. h2 {
  57. margin: 0px;
  58. font-size: large;
  59. width: 100%;
  60. display: block;
  61. padding: 0px;
  62. }
  63. table {
  64. border: 1px solid #666;
  65. padding: 0px;
  66. width: 100%;
  67. }
  68. </style>
  69. <script type="text/javascript">
  70. function setJabberId ()
  71. {
  72. if (document.getElementById ('jid').value == '') {
  73. document.getElementById ('jid').value = document.getElementById('email').value;
  74. }
  75. }
  76. </script>
  77. </head>
  78. <body>
  79. <?php
  80. $connection = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS) or die ('Could not connect: ' . mysql_error());
  81. mysql_select_db (MYSQL_DB) or die ('Could not select database.');
  82. $hash = mysql_real_escape_string ($_GET["hash"]);
  83. if ($hash == '')
  84. die ("Hash must be specified!");
  85. $query = "SELECT * FROM " . MYSQL_NODES_TABLE . " WHERE adminHash='$hash' AND status <> '0'";
  86. $result = mysql_query ($query, $connection) or die (mysql_error());
  87. while ($row = mysql_fetch_assoc($result)) {
  88. $name = htmlspecialchars($row['nodeName']);
  89. $owner = htmlspecialchars($row['userRealName']);
  90. $website = htmlspecialchars($row['userWebsite']);
  91. $jabber = htmlspecialchars($row['userJabber']);
  92. $email = htmlspecialchars($row['userEmail']);
  93. $publish_email = htmlspecialchars($row['userEmailPublish']);
  94. $lat = htmlspecialchars($row['lat']);
  95. $lon = htmlspecialchars($row['lng']);
  96. $ele = htmlspecialchars($row['elevation']);
  97. $status = htmlspecialchars($row['status']);
  98. $addr = htmlspecialchars($row['streetAddress']);
  99. $ip = htmlspecialchars($row['nodeIP']);
  100. $desc = htmlspecialchars ($row['nodeDescription']);
  101. }
  102. $y = $lat;
  103. $x = $lon;
  104. ?>
  105. <h1><?php echo EDIT_NODE;?></h1>
  106. <form action="EditNodeSubmit.php" method="POST">
  107. <table border="0" cellspacing="0" cellpadding="5">
  108. <tr>
  109. <td colspan="2" style="border-bottom: 1px solid #eee">
  110. <h2><?php echo NODE_INFORMATION;?></h2>
  111. <input type="hidden" value="<?php echo $hash;?>" name="hash" />
  112. </td>
  113. </tr>
  114. <tr>
  115. <td>
  116. <?php echo LATITUDE_;?>
  117. </td>
  118. <td>
  119. <input type="text" readonly="true" value="<?php echo $lat;?>" name="lat" id="y"/>
  120. </td>
  121. </tr>
  122. <tr class="alt">
  123. <td>
  124. <?php echo LONGITUDE_;?>
  125. </td>
  126. <td>
  127. <input type="text" readonly="true" value="<?php echo $lon;?>" name="lon" id="y"/>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td>
  132. <?php echo ELEVATION_;?>
  133. </td>
  134. <td>
  135. <input type="text" value="<?php echo $ele;?>" name="ele" />
  136. </td>
  137. </tr>
  138. <tr class="alt">
  139. <td>
  140. <label for="nodename"><?php echo NODE_NAME_;?></label>
  141. <br/>
  142. <span class="reallysmall"><?php echo PICK_A_NAME;?></span>
  143. </td>
  144. <td>
  145. <input type="text" id="nodename" name="nodename" value="<?php echo $name;?>"/>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td>
  150. <label for="description"><?php echo DESCRIPTION_;?></label>
  151. <br/>
  152. <span class="reallysmall"><?php echo DESCRIPTION_DESC;?></span>
  153. </td>
  154. <td>
  155. <input type="text" name="description" id="description" value="<?php echo $desc;?>"/>
  156. </td>
  157. </tr>
  158. <tr class="alt">
  159. <td>
  160. <label for="nodeip"><?php echo NODE_IP_;?></label>
  161. <br/>
  162. <span class="reallysmall"><?php echo ENTER_IP;?></span>
  163. </td>
  164. <td>
  165. <input type="text" id="nodeip" name="nodeip" value="<?php echo $ip;?>"/>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td>
  170. <label for="nodeaddr"><?php echo NODE_STREET_ADDRESS_;?></label>
  171. <br/>
  172. <span class="reallysmall"><?php echo NODE_STREET_ADDRESS_DESC;?></span>
  173. </td>
  174. <td>
  175. <input type="text" id="nodeaddr" name="nodeaddr" value="<?php echo $addr;?>"/>
  176. </td>
  177. </tr>
  178. </table>
  179. <br/>
  180. <table>
  181. <tr>
  182. <td colspan="2" style="border-bottom: 1px solid #eee;">
  183. <h2><?php echo YOUR_INFORMATION_;?></h2>
  184. <span class="reallysmall"><?php echo SOMEBODY_NEARBY;?></span>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td>
  189. <label for="yourname"><?php echo YOUR_FULL_NAME_;?></label>
  190. </td>
  191. <td>
  192. <input type="text" id="yourname" name="yourname" value="<?php echo $owner;?>"/>
  193. </td>
  194. </tr>
  195. <tr class="alt">
  196. <td>
  197. <label for="email"><?php echo EMAIL_ADDRESS_;?></label>
  198. <br/>
  199. <span class="reallysmall"><?php echo EMAIL_ADDRESS_DESC;?></span>
  200. </td>
  201. <td>
  202. <input type="text" id="email" name="email" onChange="setJabberId();" value="<?php echo $email;?>"/>
  203. <br/>
  204. <?php
  205. if ($publish_email == 1) {
  206. ?>
  207. <input type="checkbox" id="publishEmail" name="publishEmail" checked="checked" />
  208. <?php } else { ?>
  209. <input type="checkbox" id="publishEmail" name="publishEmail" checked="unchecked" />
  210. <?php
  211. }
  212. ?>
  213. <label for="publishEmail"><?php echo PUBLISH_EMAIL_;?></label>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td>
  218. <label for="jid"><?php echo JABBER_ID_;?></label>
  219. <br/>
  220. <span class="reallysmall"><?php echo JABBER_ID_DESC;?></span>
  221. </td>
  222. <td>
  223. <input type="text" id="jid" name="jid" value="<?php echo $jabber;?>"/>
  224. </td>
  225. </tr>
  226. <tr class="alt">
  227. <td>
  228. <label for="website"><?php echo WEBSITE_URL;?></label>
  229. <br/>
  230. <span class="reallysmall"><?php echo WEBSITE_URL_DESC;?></span>
  231. </td>
  232. <td>
  233. <input type="text" id="website" name="website" value="<?php echo $website;?>"/>
  234. </td>
  235. </tr>
  236. </table>
  237. <div class="buttonbox">
  238. <input type="submit" value="Submit" />
  239. </div>
  240. </form>
  241. </body>
  242. </html>