I was planning to implement similar functionality, but decided for a different approach in the end.
What I can say from my tests: you can create an "intermediate" PHP file that receives the form input, proccesses it in the may you want (send to syslog, send to database, etc.), and then calls the actual CP login page, passing the necessary fileds for a login (user/password, voucher code, etc.). AFAIK, the PHP MySQL module on pfSense is disabled by default, but can be enabled via some shell commands. I was planning to send the data to a syslog-ng instance installed on the pfSense machine, which would have spared me the hassle of setting up a database, connecting to it, etc. .