728x90 AdSpace

Latest News
Thursday, October 31, 2013

Finding Environment Using PHP

Dear Readers..:)

The following php coding will display the environment in which you work, that is the browser and operating system you use.

Functions Used 

1. getenv - >GET ENVIRONMENT - which will  get the environment of the user (HTTP_USER_AGENT)

2. preg_match -> It is used to match the values of the browser and OS of user with the values in the code

Code

<html>
<head>
<title>Environment Identification</title>
</head>
<body>
<?php
   $environment=getenv("HTTP_USER_AGENT");
   if(preg_match("/Windows/i","$environment"))
   {
     $OS="Windows";
   }
   if(preg_match("/Mozilla/i","$environment"))
   {
     $browser="Mozilla";
   }
   print("The Operating System is $OS <br>");
   print("The browser is $browser")
?>
</body>
</html>



Usage :

It is used in Ethical-Hacking and in general in the domain of Network Security

Note :
In the above coding i have simply used only one browser and one operating system. You can expand this coding.


Regards

Praveen Kumar Rajendran M.E

Sathyabama University, Chennai
  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Item Reviewed: Finding Environment Using PHP Rating: 5 Reviewed By: Praveen Kumar Rajendran