Jump to content

Search the Community

Showing results for tags 'loging'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello Fellow PW fans. Tought i share a simple but usefull way of utilizing the $log system in PW to do simple loging on what IP visit the site and also the HOST. Its not fancy, and its very basic, see it as a boiler plate. You can get all kinds of fancy with it. Remember that the $log system automaticly records the URL from where it was called so we don´t need to supply that to our Entry. I just wanted a simple entry with IP and HOST, the date is also recorded with the entry automaticly. The beauty is that i can watch the logs from the ADMIN page almost in realtime. I am using the "markup regions" output method so i put the code in my _main.php file. You could just put it wherever like to be included with every page load in your site. I hardcoded my logfile to be named ip_log_site but you can use what you feel is better. Also made sure the loging do not happen if your logged in as admin (Super user). See this PW Doc for more info: https://processwire.com/api/ref/wire-log/save/ <?PHP function logIP($session, $log) { /* get IP info */ $ip_adress = $session->getIP(); $host_address = gethostbyaddr($ip_adress); /* log IP adress info NOTE: 'ip_log_site' is a hardcoded name of the logfile, change for your preference. */ $log->save("ip_log_site", "IP: {$ip_adress}, Host: {$host_address}"); } /* if Super User (Admin) do not log */ if(!$user->isSuperuser()) { logIP($session, $log); } ?> Hope anyone have use for it. /EyeDentify
×
×
  • Create New...