Jump to content

Not a question. Just some help regarding finding out which user runs your web...


jonsjava

Recommended Posts

....scripts:

This code will tell you who runs your web scripts. (more useful than most would think). I wrote it for an open-source app that I write, and I decided someone might find this to be of use.

<?php
$iam = exec("whoami");
if ($iam == ""){
print "you are on a windows machine!";
print "<br /> Try installing <a href='http://www.microsoft.com/downloads/details.aspx?familyid=3E89879D-6C0B-4F92-96C4-1016C187D429&displaylang=en'>Windows 2000 Resource Kit Tool: Whoami.exe</a>";
print "<br /> (hint) after downloading and installing, go to c:\\Program Files\\Resourcekit\\ and copy WHOAMI.EXE to c:\\Windows\\System32)";
exit();
}
else{
if (strstr($iam, "\\")){
$name_array = explode("\\", $iam);
$name = $name_array[1];
print "the domain that you are attached to: ".$name_array[0];
print "\n<br /> your username: $name";
exit();
}
else{
print "the user who handles all your web scripts is: ".$iam;
exit();
}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.