PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/nuovoutente.php

https://bitbucket.org/amorello/changeover
PHP | 78 lines | 50 code | 18 blank | 10 comment | 7 complexity | f941c7521e6d86bf88b8e8e80e5ff320 MD5 | raw file
  1. <?php
  2. session_start();
  3. include 'CSS/templateTop.html';
  4. require_once 'login.php';
  5. if(!isset($_SESSION['changeover_IDutente'])){
  6. header("location: index.php");
  7. } else
  8. {
  9. /*
  10. if($_SESSION['nonconf_DBA']=='Y')
  11. {
  12. */
  13. include 'barramenu.php';
  14. $cognome = "";
  15. $nome = "";
  16. if(isset($_POST['salva']))
  17. {
  18. $cognome = $_POST['cognome'];
  19. $nome = $_POST['nome'];
  20. $nuovapwd1 = (isset($_POST['nuovapwd1'])) ? $_POST['nuovapwd1'] : '';
  21. $nuovapwd2 = (isset($_POST['nuovapwd2'])) ? $_POST['nuovapwd2'] : '';
  22. if ($nuovapwd1 == $nuovapwd2)
  23. {
  24. if($nuovapwd1==""){
  25. echo"LA PASSWORD DEVE CONTENERE ALMENO UN CARATTERE";
  26. }
  27. else{
  28. $criptata = crypt($nuovapwd1);
  29. $query = "INSERT INTO utenti SET cognome =\"$cognome\", nome =\"$nome\",pwd=\"$criptata\" ";
  30. $result2 = mysql_query($query);
  31. if (!$result2) die ("Database access failed: " . mysql_error());
  32. echo "UTENTE CREATO CON SUCCESSO!";
  33. $cognome = "";
  34. $nome = "";
  35. }
  36. }
  37. else
  38. {
  39. echo "LE PASSWORD NON COINCIDONO";
  40. }
  41. }
  42. echo <<<_END
  43. <form action="nuovoutente.php" method="post"><pre>
  44. NUOVO UTENTE:
  45. COGNOME:<input type="text" name="cognome" value="$cognome" size ="50"/>
  46. NOME:<input type="text" name="nome" value="$nome" size ="50"/>
  47. Password: <input type="password" name="nuovapwd1" />
  48. Conferma password:<input type="password" name="nuovapwd2" />
  49. <input type="submit" name="salva" value="SALVA" />
  50. </pre></form>
  51. _END;
  52. /*
  53. }else
  54. {
  55. echo "protezione pagina - no diritti di amministrazine";
  56. }
  57. */
  58. }
  59. include 'CSS/templateEnd.html';
  60. ?>