Trinh @ Bath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

getinfo [2016/05/09 10:34]
getinfo [2016/05/09 10:34] (current)
Line 1: Line 1:
 +Attempting to get info
 +
 +<php>
 + 
 +if(function_exists('posix_geteuid')){
 +    // use posix to get current uid and gid
 +    $uid   = posix_geteuid();
 +    $usr   = posix_getpwuid($uid);
 +    $user  = $usr['name'];
 +    $gid   = posix_getegid();
 +    $grp   = posix_getgrgid($gid);
 +    $group = $grp['name'];
 +}else{
 +    // try to create a file and read it's ids
 +    $tmp = tempnam ('/tmp', 'check');
 +    $uid = fileowner($tmp);
 +    $gid = filegroup($tmp);
 + 
 +    // try to run ls on it
 +    $out = `ls -l $tmp`;
 +    $lst = explode(' ',$out);
 +    $user  = $lst[2];
 +    $group = $lst[3];
 +    unlink($tmp);
 +}
 + 
 +echo "Your PHP process seems to run with the UID $uid ($user) and the GID $gid ($group)\n"; 
 +</php>
 +
 +<php>
 +phpinfo();
 +</php>
 +
 +<html>
 +This is some <span style="color:red;font-size:150%;">inline HTML</span>
 +</html>
 +<HTML>
 +<p style="border:2px dashed red;">And this is some block HTML</p>
 +</HTML>
 +