In: Computer Science
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
Below is the myFirstPHP.php file which you can submit.
<?php
echo '<p>This is my first PHP
document</p>';
$myName = "Sam";
echo $myName;
$randomNumber = 53870 ;
echo $randomNumber;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
$useragent = "Windows";
echo $useragent;
} else {
$useragent = "other OS";
}
$browser = new BrowserDetection();
echo 'You are using ', $browser->getBrowser(), '
version ', $browser->getVersion();
// to get the client IP address
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
echo $ipaddress;
?>
Kindly revert for any queries
Thanks.