php - Log all MySQL transactions on a per user basis -
i have php application uses single database multiple users. user log on, id stored in session, , use application retrieve or update data in database.
for security/archival purposes, log every sql transaction on per user basis. note "user" not mysql user uses 1 user. how do this?
i operating centos 5.8, php 5.3.18, , mysql 5.5.
thanks
$sql = "update table set col = ?" $db->prepare($sql); //some params etc... $filename = '/dir/logs/log-' . $_session['username'] . ''; $handle = fopen($filename, "wr"); $db->execute(); fwrite($handle, $sql);
it's simple example, how use query either execution , writing in file, named user. well, used way maybe content of $sql before execution, think got idea.
p.s.: thx edit :)
Comments
Post a Comment