Good morning,
I have a script that I grabbed that displays the users login name for a form I have. Now it's stopped working. Does anyone maybe have a better way or can tell me why it's only picking up the machine name. Thanks
<?
//get logon id of person
exec("nbtstat -A ".$REMOTE_ADDR,$retour);
for($i = 0 ; $i <= sizeOf($retour); $i++){
if (strchr($retour[$i],"<03>")){
$tab = explode(" ",$retour[$i]);
for ($j=0;$j<= sizeof($tab);$j++){
if ($tab[$j] != ""){
$Mot[] = $tab[$j];
break; }else{
continue; }
}
}
}
$hote = gethostbyaddr($REMOTE_ADDR);
echo $hote;
$NomMachine = explode(".",$hote);
for ($i=0; $i <= sizeOf($Mot); $i++){
if (strtolower($Mot[$i]) != strtolower($NomMachine[0])){
$Final[] = $Mot[$i];
}
}
$result = array_unique ($Final);
echo $result[1];
?>