function insertLog($operate,$description){
$sql="INSERT INTO operate(op,operate,description,createtime)VALUES('".$_SESSION['name']."','".$operate."','".$description."',unix_timestamp())" ;
//echo $sql;
return mysql_query($sql);
数据库结构
DROP TABLE IF EXISTS `operate`;
CREATE TABLE `operate` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`op` varchar(16) NOT NULL,
`operate` varchar(512) NOT NULL,
`description` varchar(512) NOT NULL,
`createtime` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5064 DEFAULT CHARSET=utf8;
写到文本文档中
function addlog($content="",$user="admin")
{
//echo PATH."/log/admin.log";
file_put_contents(PATH."/log/admin.log",$content." ".$user." ".time()." ".date("Y-m-d h:i:s",time())."
",FILE_APPEND);
}