100% found this document useful (1 vote)
389 views1 page

User Login and Logout Notifications

This document contains code to log information when a user logs in or out of a WiFi hotspot. It retrieves user details like IP address, MAC address, login method, package, and quota used. This information is sent in a Telegram message along with the current date and time. It also counts the number of active users. On logout, it sends a message with the user name and IP address to notify of the logout.

Uploaded by

Ubay Dillah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
389 views1 page

User Login and Logout Notifications

This document contains code to log information when a user logs in or out of a WiFi hotspot. It retrieves user details like IP address, MAC address, login method, package, and quota used. This information is sent in a Telegram message along with the current date and time. It also counts the number of active users. On logout, it sends a message with the user name and IP address to notify of the logout.

Uploaded by

Ubay Dillah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

ON LOG-IN

=========
:local mac $"mac-address";
:set mac [:ip dhcp-server lease get [:ip dhcp-server lease find mac-address="$mac"]
host];
:local nama "$user";
:local ips [/ip hotspot active get [find user="$nama"] address];
:local exp [/ip hotspot user get [find name="$nama"] comment];
:local profile [/ip hotspot user get [find name="$nama"] profile];
:local datetime "$[/system clock get date] $[/system clock get time]";
:local mac [/ip hotspot active get [find user="$nama"] mac-address];
:local host [/ip dhcp-server lease get [find address="$ips"] host-name];
:local lby [/ip hotspot active get [find user="$nama"] login-by];
:local limit [/ip hotspot active get [find user="$nama"] limit-bytes-total];
:local totq [(($limit)/1048576)];
:local useraktif [/ip hotspot active print count-only];
:tool fetch
url="https://api.telegram.org/bot1411695224:AAGk6dW9AeichhQlWShMvFbJs8iwYjGaqb8/sen
dMessage?chat_id=420259182&text===>>INFO LOG-IN<<==%0A- Kode Voucher : $nama%0A- IP
Address : $ips %0A- Mac Address : $mac%0A- Menggunakan : $host%0A- Metode Login :
$lby%0A- Kuota : $totq Mb%0A- Expired Voucher : $exp%0A- Waktu Login : $datetime
%0A- Paket : $profile%0A- User Online : $useraktif user" mode=http keep-result=no;

ON LOG-OUT
==========
:tool fetch
url="https://api.telegram.org/bot1411695224:AAGk6dW9AeichhQlWShMvFbJs8iwYjGaqb8/sen
dMessage?chat_id=420259182&text=<<==INFO LOG-OUT==>>%0A- Kode Voucher : $user%0A-
IP Addres : $address" keep-result=no;

You might also like