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

/modificautente.php

https://bitbucket.org/amorello/changeover
PHP | 56 lines | 35 code | 11 blank | 10 comment | 5 complexity | 85c70d5f92cba8f18d613bc40ebacde1 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. $ID = $_POST['ID'];
  15. $query = "SELECT cognome, nome FROM utenti WHERE ID=$ID";
  16. $result = mysql_query($query);
  17. if (!$result) die ("Database access failed: " . mysql_error());
  18. $row = mysql_fetch_row($result);
  19. $cognome = $row[0];
  20. $nome = $row[1];
  21. if(isset($_POST['salva']))
  22. {
  23. $query = "UPDATE utenti SET cognome =\"$cognome\", nome =\"$nome\" WHERE id = \"$ID\"";
  24. $result2 = mysql_query($query);
  25. if (!$result2) die ("Database access failed: " . mysql_error());
  26. echo "UTENTE MODIFICATO CON SUCCESSO!";
  27. }
  28. echo <<<_END
  29. <form action="modificautente.php" method="post"><pre>
  30. <input type="hidden" name="ID" value="$ID">
  31. COGNOME:<input type="text" name="cognome" value="$cognome" size ="50"/>
  32. NOME:<input type="text" name="nome" value="$nome" size ="50"/>
  33. <br><a href="resetpwd.php?ID=$ID" >reset password</a><br>
  34. <input type="submit" name="salva" value="SALVA" />
  35. </pre></form>
  36. _END;
  37. /*
  38. }else
  39. {
  40. echo "protezione pagina - no diritti di amministrazine";
  41. }
  42. */
  43. }
  44. include 'CSS/templateEnd.html';
  45. ?>