PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/areariservata/insert_utenti.php

https://code.google.com/p/bilugcms/
PHP | 150 lines | 125 code | 3 blank | 22 comment | 3 complexity | c20147f9af7cfaea742e8a74ee426726 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception
  1. <? /* license
  2. BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
  3. Copyright (C) 2005-2008 Federico Villa and Alessio Loro Piana
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. For reference, contact bilugcms@vilnet.it
  14. license */ ?>
  15. <?
  16. $errore=$_GET["errore"];
  17. $tipoerr=$_GET["tipoerr"];
  18. if($errore=="si")
  19. {
  20. echo "<h1><img src=\"./img/alert.png\" class=\"ico\" />$tipoerr<img src=\"./img/alert.png\" class=\"ico\" /></h1>";
  21. }
  22. $id = $_GET['id'];
  23. if (!$id)
  24. {
  25. $parola=Inserisci;
  26. // se il valore di id ? vuoto, allora siamo in fase di inserimento
  27. $annulla = "<input type=\"button\"
  28. class=\"medio\" name=\"Annulla\" value=\"Annulla\" onclick=\"javascript:window.location='area.php?pag=elenco_utenti.php'\" />";
  29. $control[1]=$_GET["nome"];
  30. $control[2]=$_GET["cognome"];
  31. $control[3]=$_GET["email"];
  32. $control[9]=$_GET["citta"];
  33. $et=$_GET["eta"];
  34. $adm=$_GET["admin"];
  35. $sex=$_GET["sesso"];
  36. }
  37. else
  38. {
  39. $parola=Modifica;
  40. // se id ha un valore, allora siamo in fase di modifica
  41. $annulla ="<input type=\"button\"
  42. class=\"medio\" name=\"Annulla\" value=\"Annulla\" onclick=\"javascript:window.location='area.php?pag=elenco_utenti.php'\" />";
  43. $str=" SELECT * FROM anagrafica where ID='$id'";
  44. $risultato=mysql_query($str);
  45. if (mysql_num_rows($risultato)>0)
  46. {
  47. $control=mysql_fetch_row($risultato);
  48. $sex=$control[7];
  49. $et=$control[8];
  50. $adm=$control[5];
  51. // assegnamo alla var (array) $control[x] (che ci serve nella form per assegnare il value) i valori della query
  52. }
  53. }
  54. ?>
  55. <div class="contenitore">
  56. <form name="utenti" method="post" action="insert_utenti_query.php" enctype="multipart/form-data">
  57. <input type="hidden" name="id" value="<?=$id?>"/>
  58. <!-- il valore di id lo passiamo alla pagina di action con un campo nascosto -->
  59. <h3><?=$parola?> l'utente:</h3>
  60. <div class="azzerafloat"></div>
  61. <div class="float200">
  62. Nome: (*)
  63. </div>
  64. <div class="float500">
  65. <input type="text" name="nome" size="80" maxlength="50" tabindex="1" value="<?=$control[1]?>"/>
  66. </div>
  67. <div class="azzerafloat"></div>
  68. <div class="float200">
  69. Cognome:
  70. </div>
  71. <div class="float500">
  72. <input type="text" name="cognome" size="80" maxlength="50" tabindex="2" value="<?=$control[2]?>"/>
  73. </div>
  74. <div class="azzerafloat"></div>
  75. <div class="float200">
  76. Email: (*)
  77. </div>
  78. <div class="float500">
  79. <input type="text" name="NomeUtente" size="80" maxlength="50" tabindex="3" value="<?=$control[3]?>"/>
  80. </div>
  81. <div class="azzerafloat"></div>
  82. <div class="float200">
  83. Password: (*)
  84. </div>
  85. <div class="float500">
  86. <input type="hidden" name="pwdold" value="<?=$control[4]?>"/>
  87. <input type="password" name="Pass" size="80" maxlength="50" tabindex="4" value="<?=$control[4]?>"/>
  88. </div>
  89. <div class="azzerafloat"></div>
  90. <div class="float200">
  91. Ridigita Password: (*)
  92. </div>
  93. <div class="float500">
  94. <input type="password" name="pwd2" size="80" maxlength="50" tabindex="5" value="<?=$control[4]?>"/>
  95. </div>
  96. <div class="azzerafloat"></div>
  97. <div class="float200">
  98. Sesso:
  99. </div>
  100. <div class="float500">
  101. <input type="radio" class="little" name="sesso" value="M" <? if ($sex=="M") echo "checked "; ?> tabindex="6"/> Maschio
  102. <input type="radio" class="little" name="sesso" value="F" <? if ($sex=="F") echo "checked "; ?> tabindex="7"/> Femmina
  103. </div>
  104. <div class="azzerafloat"></div>
  105. <div class="float200">
  106. Et?:
  107. </div>
  108. <div class="float500">
  109. <select name="eta" size="1" tabindex="8">
  110. <option value="0">-----</option>
  111. <option value="1" <? if ($et==1) echo "selected"; ?>>0-18</option>
  112. <option value="2" <? if ($et==2) echo "selected"; ?>>19-40</option>
  113. <option value="3" <? if ($et==3) echo "selected"; ?>>41-60</option>
  114. <option value="4" <? if ($et==4) echo "selected"; ?>>Over 60</option>
  115. </select>
  116. </div>
  117. <div class="azzerafloat"></div>
  118. <div class="float200">
  119. Citt?:
  120. </div>
  121. <div class="float500">
  122. <input type="text" name="citta" size="80" maxlength="50" tabindex="9" value="<?=$control[9]?>"/>
  123. </div>
  124. <div class="azzerafloat"></div>
  125. <div class="float200">
  126. Admin:
  127. </div>
  128. <div class="float500">
  129. <? if ($typo == "A") { ?>
  130. <input type="radio" class="little" name="admin" value="A" <? if ($adm=="A") echo "checked "; ?> tabindex="10"/> Admin
  131. <?}?>
  132. <input type="radio" class="little" name="admin" value="S" <? if ($adm=="S") echo "checked "; ?> tabindex="11"/> SuperUser
  133. <input type="radio" class="little" name="admin" value="U" <? if ($adm=="U") echo "checked "; ?> tabindex="12"/> User
  134. </div>
  135. <div class="azzerafloat"></div>
  136. <h3>(*) = Campi obbligatori</h3>
  137. <input type="submit" class="medio" value="<?=$parola?>" tabindex="13"/>
  138. <?=$annulla?>
  139. </form>
  140. </div>