<?php
$key = 'Is this the potato farm?'
$s = 'The account balance is $2000';
$alg = MCRYPT_BLOWFISH;
$mode = MCRYPT_MODE_CBC;
$iv = mcrypt_create_iv(mcrypt_get_iv_size($alg,$mode),
MCRYPT_DEV_URANDOM);
$ciphertext = mcrypt_encrypt($alg, $key, $s, $mode, $iv);
$quoted_iv = mysql_real_escape_string($iv);
$quoted_ct = mysql_real_escape_string($ciphertext);
mysql_query("INSERT INTO secrets (iv, ciphertext) VALUES ('$quoted_iv','$quoted_ct')");
?>