Bonjour,

Je suis entrain de développer une application extranet.

Pour renforcer la sécurité de l'application, il m'a été demandé de faire une vérification login/pass/mac du client avant qu'il se connecte.

Les adresses mac des clients sont stockées dans la base de données.

Le problème que j'ai est comment je peux récupérer leurs adresse mac pour faire la vérification avec celles stockées dans ma base de données.

En cherchant un petit peu dans le net, j'ai trouvé ce code mais il n'a pas l'air de bien marcher.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function returnMacAddress() {
    // This code is under the GNU Public Licence
    // Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com
    // Tested only on linux, please report bugs
 
    // WARNING: the commands 'which' and 'arp' should be executable
    // by the apache user; on most linux boxes the default configuration
    // should work fine
 
    // Get the arp executable path
    $location = `which arp`;
    // Execute the arp command and store the output in $arpTable
    $arpTable = `$location`;
    // Split the output so every line is an entry of the $arpSplitted array
    $arpSplitted = split("\n",$arpTable);
 
    // Get the remote ip address (the ip address of the client, the browser)
    $remoteIp = $_SERVER['REMOTE_ADDR'];
    // Cicle the array to find the match with the remote ip address
    foreach ($arpSplitted as $value) {
        // Split every arp line, this is done in case the format of the arp
        // command output is a bit different than expected
        $valueSplitted = split(" ",$value);
        foreach ($valueSplitted as $spLine) {
            if (preg_match("/$remoteIp/",$spLine)) {
                $ipFound = true;
 
            }
            // The ip address has been found, now rescan all the string
            // to get the mac address
            if ($ipFound) {
                // Rescan all the string, in case the mac address, in the string
                // returned by arp, comes before the ip address
                // (you know, Murphy's laws)
                reset($valueSplitted);
                foreach ($valueSplitted as $spLine) {
                    if (preg_match("/[0-9a-f][0-9a-f][:-]".
                    "[0-9a-f][0-9a-f][:-]".
                    "[0-9a-f][0-9a-f][:-]".
                    "[0-9a-f][0-9a-f][:-]".
                    "[0-9a-f][0-9a-f][:-]".
                    "[0-9a-f][0-9a-f]/i",$spLine)) {
                        return $spLine;
                    }
                }
            }
            $ipFound = false;
        }
    }
    return false;    
}

Si vous avez des suggestions je suis preneur.
Merci