Looging Code Needed |
7/29/2006 11:01:20 PM |
PHPRunner General questions | |
D
dmyers author
I need to figure out how to add logging to the PHPRunner code. I have already highly customized the code for other features and really prefer not to have to "Build" it again. It took along time to get it the way I wanted it. |
|
![]() |
kujox 7/30/2006 |
David, |
J
|
Jane 7/31/2006 |
David, function BeforeDelete($where) { global $conn; $str = "select * from products where ".$where; $rs = db_query($str,$conn); $data = db_fetch_array($rs); $strinsert = "insert into LogTable (UserID, DeletedDate, IDAddress, LastName, FirstName) values ('".$_SESSION["UserID"].'",now(),'".$_SERVER["REMOTE_ADDR"]."',".$data["LastName"].",".$data["FirstName"].")"; db_exec($strinsert,$conn); return true; }
|
D
|
dmyers author 7/31/2006 |
David, Do you need to keep the record intact and just 'hide' the record as deleted, so you can place the record id in the logging table, I would do this as I could then see what the user had deleted. All you need to do then is add a field using phpmyadmin which is called deleted or active , you could even add the user, ip and timestamp to this table as well. PS, a bloke on there called jason agee, he looks a lot like harold shipman
David, sure you can do it using events. Here is a sample code: Put this code to the include/warrant_info_events.php file.
|
J
|
Jane 8/1/2006 |
David, function BeforeDelete($where)
|
D
|
dmyers author 8/25/2006 |
I get this message when I try it. I have looked all over the code and cant find what is wrong. Probably something real small. <?php
|
J
|
Jane 8/25/2006 |
David, function BeforeDelete($where) { global $conn; $str = "select * from warrant_info where ".$where; $rs = db_query($str,$conn); $data = db_fetch_array($rs); $strinsert = "insert into log_table (UserID, DeletedDate, IDAddress, WarrantNumber, AgencyOri, LastName, FirstName) values ('".$_SESSION["UserID"].'",now(),'".$_SERVER["REMOTE_ADDR"]."',".$data["WarrantNumber"].",".$data["AgencyOri"].",'".$data["LastName"]."','".$data["FirstName"]."')"; db_exec($strinsert,$conn); return true; } ?> |