<?
class auditrail{
	var $pkey;
	//var $fullName;
	var $username;
	var $userDesc;
	var $Computer;
	var $logDate;
	var $logon;
	var $logout;
	var $lastModule;

	//setter methods
	function setPkey($value){
		$this->pkey = $value;
	}
	/*function setFullName($value){
		$this->fullname=$value;
	}*/
	function setUserName($value){
		$this->username=$value;
	}
	function setUserDesc($value){
		$this->userdesc=$value;
	}
	function setComputer($value){
		$this->computer=$value;
	}
	function setLogDate($value){
		$this->logdate=$value;
	}
	function setLogon($value){
		$this->logon=$value;
	}
	function setLogout($value){
		$this->logout=$value;
	}
	function setLastModule($value){
		$this->lastModule=$value;
	}

	//getter methods
	function getPkey(){
		return $this->pkey;
	}
	/*function getFullName(){
		return $this->fullname;
	}*/
	function getUserName(){
		return $this->username;
	}
	function getUserDesc(){
		return $this->userdesc;
	}
	function getComputer(){
		return $this->computer;
	}
	function getLogDate(){
		return $this->logdate;
	}
	function getLogon(){
		return $this->logon;
	}
	function getLogout(){
		return $this->logout;
	}
	function getLastModule(){
		return $this->lastModule;
	}


	function search($field){
		$sel = "SELECT ".$field." FROM auditrail ";
		//echo $sel;
		$rs = mysql_query($sel);
		return $rs;
	}

	function setAuditrail($key){
		global $auditrail;
		$result = $auditrail->search('*', "WHERE pkey = ".$key);
		$rs = mysql_fetch_assoc($result);
		$auditrail->setPkey($rs['pkey']);
		$auditrail->setFullName($rs['fullname']);
		$auditrail->setUserName($rs['username']);
		$auditrail->setUserDesc($rs['usedesc']);
		$auditrail->setComputer($rs['computer']);
		$auditrail->setLogDate($rs['logdate']);
		$auditrail->setLogon($rs['logon']);
		$auditrail->setLogout($rs['logout']);
		mysql_free_result($result);
	}

	function remove($key){
		global $auditrail;
		$delete = "DELETE FROM auditrail WHERE logdate < $key";
		//echo $delete;
		$rs = mysql_query($delete);
	}
}
?>