I am working on a project that requires logging the client's unique MAC address into a MySQL database. I will be using PHP to populate MySQL so if there is a script or function that allows me to gather a client's MAC, I'd appreciate any help.
I am working on a project that requires logging the client's unique MAC address into a MySQL database. I will be using PHP to populate MySQL so if there is a script or function that allows me to gather a client's MAC, I'd appreciate any help.
Ok, here is what I could gather so far: (Applying to Windows machines)
Is there a better function than strspn() to retrieve the MAC? I am using the ??:??:??:??:??:?? because I need ? wildcards in that format to find the MAC address string.<?php
/* Some code to establish connection to client */
$ipconfig = popen("ipconfig /all", "r");
$ipconfig_output = fflush($ipconfig);
$mac = strspn($ipconfig_output, '??:??:??:??:??:??');
/* Code to pass $mac into MySQL database */
?>
I am relatively new to PHP so please don't flame. I am truely trying to learn on my own but could not find much better in the php.net manual.
Hi!
I am not sure if I correctly understand what you need, but it seems to me that you are definitively going in the wrong direction. Do you need to log the MAC address of the site visitor to the DB or your NIC's address? You should always understand "ipconfig /all" gives you YOUR NIC's MAC, not the one of someone talking to you.
If you need the MAC by IP and you know that this IP belongs to someone currently talking to you it surely must be in the ARP cache of you box, so you need
1) Get the IP of the guy
2) Crawl the ARP cache by IP
So basically you need something like this:Code:zyv:# arp -a | grep "192.168.101.57" ? (192.168.101.57) at 00:05:5D:33:XX:FF [ether] PERM on br0
Hope that answers your questions.PHP Code:<?php
$dirty = `arp -a | grep "192.168.101.57"`;
// Returns: "? (192.168.101.57) at 00:05:5D:33:C8:FF [ether] PERM on br0"
ereg ("([0-9A-Fa-f]{2}(:?)){6}", $dirty, $reg);
$mac = $reg[0];
// Now go ahead with your DB stuff
// ([0-9A-Fa-f]{2}(:?)){6} basically that matches the MAC, we could me more accurate => secure, but I don't care, I trust ARP output.
?>
God is real, unless declared as integer
It's not practically possible to grab a MAC address by an IP address unless you do some client side edits, which defeats the point.
sounds good to me![]()
[font='Calibri','sans-serif']Hi friends, Thanks’ for your valuable post. I really forgot use of output buffering in PHP. I try to Your MAC address using JavaScript but it give me error i.e. automated server cannot create object.[/font]
I am doing programming for many years and PHP is my favorite programming language. Also, PHP has become the most popular Web programming language not only because it is free but it has many advantages in programming with PHP. Owing to the numerous benefits offered by PHP scripting language, it has gained a lot of popularity.
Do you have troubles about how to choose HID Kit? there are so many brands, and you can not distinguish which is the best HID Kit you need, here, i would like to recommend this VVME HID Kit, which is cheap, reliable, and almost identical to the factory HID on the tractors and they are not blue like other kits. for more info, please visit http://www.vvme.com.
You may also interested in:
Bi-Xenon HID Kit
HID Conversion Kit
Hi/Low HID Kit
I am not sure if I correctly understand what you need, but it seems to me that you are definitively going in the wrong direction. Do you need to log the MAC address of the site visitor to the DB or your NIC's address? You should always understand "ipconfig /all" gives you YOUR NIC's MAC, not the one of someone talking to you.
If you need the MAC by IP and you know that this IP belongs to someone currently talking to you it surely must be in the ARP cache of you box, so you need
1) Get the IP of the guy
2) Crawl the ARP cache by IP
_________________
One evening I drove my husband's car to the shopping mall.in Diablo 3 Accounts
On my return, I noticed that how dusty the outside of his car was and cleaned it up a bit.When I finally entered the house, I called out."The woman who loves you the most in the world Diablo 3 Items just cleaned your headlights and windshield."
My husband looked up and said, "Mom's here?"
Diablo 3 Gold
There are currently 1 users browsing this thread. (0 members and 1 guests)