//customize code
function ncrpt($plaintext)
{
$crptK=hash('sha256','4b75ba58da406b');
$cipher = "aes-128-ctr";
if (in_array($cipher, openssl_get_cipher_methods()))
{
$iv = substr(hash('sha256', '123456'),0,16);
//customize code
$ciphertext = openssl_encrypt($plaintext, $cipher, $crptK, 0, $iv);
return $ciphertext;
}
}
$email=ncrpt($email);
mysqli_query($conn, "INSERT INTO tbl_prova_user
(nome, email)
VALUES
('".$nome."','".$email."');
");
//customize code
function dcrpt($ciphertext)
{
$crptK=hash('sha256','4b75ba58da406b');
$cipher = "aes-128-ctr";
if (in_array($cipher, openssl_get_cipher_methods()))
{
$iv = substr(hash('sha256', '123456'), 0, 16);
//customize code
$plaintext = openssl_decrypt($ciphertext, $cipher, $crptK, 0, $iv);
return $plaintext;
}
}
$query = mysqli_query($conn,"
SELECT *
FROM tbl_prova_user;
");
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC))
{
$email=dcrpt($row["email"]);
echo "
" . $row["nome"] . " | " . $email . " | " . $row["password"] . " |
";
}