registry->db->prepare($sql); $stmt->bindValue(':service_name',$serviceName, PDO::PARAM_STR); $stmt->bindValue(':username',\Helper::getSessionVar('username'), PDO::PARAM_STR); $stmt->execute(); return true; } catch (PDOException $e) { $this->registry->log->error('Action : Insert data LogAcccess/saveLog :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } catch (\ErrorException $e) { $this->registry->log->error('Action : Insert data LogAcccess/saveLog :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } } public function viewLogByServiceName($serviceName) { try { $sql = 'select `service_name`,`username`,`timestamp` from app_log where `service_name`=:service_name'; $stmt = $this->registry->db->prepare($sql); $stmt->bindValue(':service_name',$serviceName, PDO::PARAM_STR); $stmt->execute(); $rs=$stmt->fetchAll(PDO::FETCH_ASSOC); return $rs; } catch (PDOException $e) { $this->registry->log->error('LogAcccess/viewLogByServiceName :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } catch (\ErrorException $e) { $this->registry->log->error('LogAcccess/viewLogByServiceName :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } } public function viewLogByUsername($username) { try { $sql = 'select `service_name`,`username`,`timestamp` from app_log where `username`=:username'; $stmt = $this->registry->db->prepare($sql); $stmt->bindValue(':username',$username, PDO::PARAM_STR); $stmt->execute(); $rs=$stmt->fetchAll(PDO::FETCH_ASSOC); return $rs; } catch (PDOException $e) { $this->registry->log->error('LogAcccess/viewLogByServiceUsername :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } catch (ErrorException $e) { $this->registry->log->error('LogAcccess/viewLogByServiceUsername :'.$e->getMessage().', user: '.\Helper::getSessionVar('username')); return false; } } }