Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("../../../config/config.php");
- // Recupero la password criptata dal form di inserimento.
- $nome = $_POST['nome'];
- $cognome = $_POST['cognome'];
- $user = $_POST['user'];
- $password = $_POST['password'];
- // Crea una chiave casuale
- $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
- // Crea una password usando la chiave appena creata.
- $password = hash('sha512', $password.$random_salt);
- // Inserisci a questo punto il codice SQL per eseguire la INSERT nel tuo database
- // Assicurati di usare statement SQL 'prepared'.
- $query="INSERT INTO utenti (nome, cognome, user, password, salt) VALUES ('$nome', '$cognome', '$user', '$password', '$random_salt')";
- if (!$result = mysql_query($query)) {
- exit(mysql_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement