MAC Address Logging

I’m using a RouterBOARD 133 running Router OS 3.7 using license level 4.

I need to write a script that runs when the user clicks a button on a web page.

The script needs to be able to capture the MAC Address of the user that clicked the button on a web page, and record the date and time that the user clicked the button. Then I want that recorded information spit out into a database.

The script is for some wireless authentication management and statistics stuff we’re doing.

My questions are:
What do I need to write that script/can someone help me write it?
How can I trigger the script on the MicroTik to run on button click on a web page running on the MikroTik?

Thanks for the help,
-cvo

Just an update, I’m still not having any success figuring out how to accomplish this.

I can offer payment (up to a reasonable amount) for a working solution to this.

How do you think router will know what user is doing on his PC? You can capture and examine packets sent from users PC, probably it will help, but you can’t do it by writing a script in RouterOS.

Could I do something like when the user clicks a button it pushes up a specific value, then set the logs to log that value. The script could run every 10 min or so, scan the script for that specific log value and correlate the log value with that ip’s mac address and then push that data to a database?

if you’re using Hotspots, then i guess that you’re pushing pages at the clients regularly, with a button to click.

Best bet (if that is the case) might be to use a page on the router as the advert page, and make it redirect to somewhere ‘proper’ after substituting the user’s MAC address as part of the URL/POST, e.g. :-

(as in the docs page at http://www.mikrotik.com/testdocs/ros/2.9/ip/hotspot.php)

Any script you have on your webserver will then have the date/time, IP and MAC of the ‘Clicker’

example php/mysql page to collect it all …

<? $dbusername = "database user name"; $dbpassword = "password"; $hostname = "localhost, or wherever it's at"; $database = "stats or whatever"; $conn = mysql_connect($hostname, $dbusername, $dbpassword) or die("Whoops - Connecting to SQL Server failed"); mysql_select_db($database, $conn) or die("Whoops - Selecting $database failed"); $q="insert into stats (date, mac, username, ip) values (now(), '$mac', '$username', '$ip')"; mysql_query($q, $conn); ?>

Why not just use radius for the stats ?