Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. include("../../../config/config.php");
  4.  
  5.  
  6.  
  7. // Recupero la password criptata dal form di inserimento.
  8. $nome = $_POST['nome'];
  9. $cognome = $_POST['cognome'];
  10. $user = $_POST['user'];
  11. $password = $_POST['password'];
  12. // Crea una chiave casuale
  13. $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
  14. // Crea una password usando la chiave appena creata.
  15. $password = hash('sha512', $password.$random_salt);
  16. // Inserisci a questo punto il codice SQL per eseguire la INSERT nel tuo database
  17. // Assicurati di usare statement SQL 'prepared'.
  18. $query="INSERT INTO utenti (nome, cognome, user, password, salt) VALUES ('$nome', '$cognome', '$user', '$password', '$random_salt')";
  19. if (!$result = mysql_query($query)) {
  20. exit(mysql_error());
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement