PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/public/index.php

https://github.com/hugcoday/groupcotton_php
PHP | 58 lines | 37 code | 17 blank | 4 comment | 0 complexity | c501d14c1fee0a31782af2786890df8f MD5 | raw file
  1. <?php
  2. $clientip=$_SERVER['REMOTE_ADDR'];
  3. $clienthostname=$_SERVER['REMOTE_HOST'];
  4. $clienthostname2=gethostbyaddr($clientip);
  5. $originalip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  6. $clientbrowser=$_SERVER['HTTP_USER_AGENT'];
  7. $refererpage=$_SERVER['HTTP_REFERER'];
  8. $serversoftware=$_SERVER['SERVER_SOFTWARE'];
  9. $php_date=$_SERVER['REQUEST_TIME'];
  10. // seconds since 1970:
  11. $seconds=time();
  12. $t=gettimeofday(); // returns array of seconds since 1970, plus microseconds
  13. // $seconds=$t["sec"];
  14. $microseconds=$t["usec"];
  15. $human_date=date("r");
  16. $microsecondid=uniqid();
  17. $pid=getmypid();
  18. // execute a shell command
  19. // show what user the current process $$ is running as
  20. $output=shell_exec("ps -p $$ -o user,ruser");
  21. print "<table border=1 CELLPADDING=5 cellspacing=0 bgcolor=#eeeeee>\n";
  22. print "<tr> <td> Client IP address </td> <td> $clientip </td> </tr>\n";
  23. print "<tr> <td> Client hostname as environment variable (prob. not set up) </td> <td> $clienthostname </td> </tr>\n";
  24. print "<tr> <td> Client hostname (done manually) </td> <td> $clienthostname2 </td> </tr>\n";
  25. print "<tr> <td> Original IP address </td> <td> $originalip </td> </tr>\n";
  26. print "</table><p>\n";
  27. print "<table border=1 CELLPADDING=5 cellspacing=0 bgcolor=#eeeeee>\n";
  28. print "<tr> <td> Client browser </td> <td> $clientbrowser </td> </tr>\n";
  29. print "<tr> <td> Referring page </td> <td> <a href=$refererpage>$refererpage</a> </td> </tr>\n";
  30. print "<tr> <td> Result of shell command </td> <td> <pre> $output </pre> </td> </tr>\n";
  31. print "</table><p>\n";
  32. print "<table border=1 CELLPADDING=5 cellspacing=0 bgcolor=#eeeeee>\n";
  33. print "<tr> <td> Server software </td> <td> $serversoftware </td> </tr>\n";
  34. print "<tr> <td> PHP datestamp (needs PHP 5.1.0) </td> <td> $php_date </td> </tr>\n";
  35. print "<tr> <td> Seconds since 1 Jan 1970 </td> <td> $seconds </td> </tr>\n";
  36. print "<tr> <td> Time now - microsecond within the current second </td> <td> $microseconds </td> </tr>\n";
  37. print "<tr> <td> Unique id based on time in microseconds </td> <td> $microsecondid </td> </tr>\n";
  38. print "<tr> <td> Human-readable datestamp </td> <td> $human_date </td> </tr>\n";
  39. print "<tr> <td> Process ID </td> <td> $pid </td> </tr>\n";
  40. print "</table><p>\n";
  41. ?>