Results 1 to 14 of 14

Thread: How to get MAC Address wtih PHP 5 ?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Question How to get MAC Address wtih PHP 5 ?

    Hai..
    I have a question....
    Is there a way to get MAC Address with PHP 5 (For Remote computer)...?
    Thank you.......

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to get MAC Address wtih PHP 5 ?

    You can get the remote IP, which is pretty standard, as far as I know you cannot get a MAC address by TCP/IP as it is a local network thing rather than for interweb usage

    PHP Code:
    $user_ip $_SERVER['REMOTE_ADDR']; 

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: How to get MAC Address wtih PHP 5 ?

    I only want to use it in my office.
    Is there any solutions to get MAC Address for remote computer ???
    Because i need it...

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: How to get MAC Address wtih PHP 5 ?

    Quote Originally Posted by Lightzero
    I only want to use it in my office.
    Is there any solutions to get MAC Address for remote computer ???
    Because i need it...
    Why would you need something like this in a web solution? You might want to re-think your design.

    What technology do you have at your disposal?

    Since your Mac address is not transmitted via TCP/IP, there is no possible way to get the Mac addresses of any client with only PHP.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: How to get MAC Address wtih PHP 5 ?

    OK. How about my local computer ??
    Is it possible if i get my MAC Address with PHP on my local computer... ?
    Thank you for your help...

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to get MAC Address wtih PHP 5 ?

    No, because PHP does not run on a local computer. PHP runs through a web server, whether its on the same computer or a remote computer it is always going to behave as if it is on a remote computer.

    Basically, there is no way to get a MAC address. What do you need it for?

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: How to get MAC Address wtih PHP 5 ?

    For security in my php project...(I think i can use IP and MAC Address for my security like login system)
    Thank You...

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to get MAC Address wtih PHP 5 ?

    If you can expand on "security" then I can help more. Security as in what? Authentication?

  9. #9

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: How to get MAC Address wtih PHP 5 ?

    yes, Authentication..

  10. #10
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to get MAC Address wtih PHP 5 ?

    Well, usually one just uses a username/password combo, you could combine that with an IP also if they are static (should work on a local network) ?

  11. #11
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: How to get MAC Address wtih PHP 5 ?

    The MAC address is datalink level address used by protocols such as Ethernet and PPP to determine where to send datagrams. An IP datagram may pass through several of these networks as it is routed through the Internet and each time it is, it is re-addressed with the MAC addresses of the devices it travels between.

    By the time you get the data to your web server the only MAC address it will have is that of router, switch or modem the web server is connected to. In other words it is impossible (unless you run an application on the client computer), to get the MAC address of the device sending the data.

    What level of security do you need? There are a number of measures you can take to prevent session hijack, including username and password authentication, timeout policies, Javascript hashing and encrpytion and the most secure of all which provides, encryption and verification of identity at both endpoints is SSL.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  12. #12

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    47

    Re: How to get MAC Address wtih PHP 5 ?

    I need a security like this :
    If someone insert or update data, i want to know WHO and WHERE is the user do that activity. Yes, I can use like username, password combo and IP.
    But I think, if i can get their MAC Address maybe it's better....

    Or, Is there any better sollution ???
    Thank you for the answer....
    Last edited by Lightzero; Apr 26th, 2006 at 07:40 PM.

  13. #13
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Re: How to get MAC Address wtih PHP 5 ?

    Please try this and let me know if there is an issue.

    PHP Code:
    function getMac(){
    exec("ipconfig /all"$output);
    foreach(
    $output as $line){
    if (
    preg_match("/(.*)Physical Address(.*)/"$line)){
    $mac $line;
    $mac str_replace("Physical Address. . . . . . . . . :","",$mac);
    }
    }
    return 
    $mac;
    }

    $mac getMac();
    $mac trim($mac); 

  14. #14
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to get MAC Address wtih PHP 5 ?

    1. This thread is over four years old.
    2. The original question was about getting the MAC address of the client. Your code will return the MAC address of the server, and only if it's running Windows.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width