php - sanitizing a string before serializing and inserting to db -
php - sanitizing a string before serializing and inserting to db -
i'm facing odd problem....
$string
user input
$log = serialize(array('string' => $string);
example: "test" be
"string";s:4:"test";
however problems arise when user submits quotes , other characters ; of course of study escape string first, serialized info cannot unserialized.
htmlentities
before submitting db wouldn't work either since ;
messes data...
any suggestions?
please don't tell me create db fields , not utilize serialize()
i not sure if best practice quick hack using : http://php.net/manual/en/function.base64-encode.php , http://www.php.net/manual/en/function.base64-decode.php encrypt info when sending db , decrypting when retrieve it. if think there might security issues encrypting using base64 here link in improve way : best way utilize php encrypt , decrypt?
php
Comments
Post a Comment