[help][php] custom 404 page not working

Status
Not open for further replies.

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
Well I'm basically trying to set something like
PHP:
$_SERVER['HTTP_USER_AGENT'];
as a variable.
but for some reason (don't ask me) it doesn't work.
This is all I'm doing:
PHP:
$ua = '$_SERVER['HTTP_USER_AGENT']'; //notice the accordingly abbreviated name?
but it doesn't work, any help?

Thanks!
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
As Xenous said you can just do that, but to save lines:

PHP:
<?php
echo $_SERVER["REMOTE_ADDR"];
?>

Also, if you ever wanted to view all the $_SERVER[] values:

PHP:
<?php
foreach ( $_SERVER as $k => $v )
{
    echo '$_SERVER[' . $k . '] = ' . $v . '<br />';
}
?>

That code can be used for almost everything, $_COOKIE, $_SESSION, $_POST, $_GET etc.
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
As Xenous said you can just do that, but to save lines:

PHP:
<?php
echo $_SERVER["REMOTE_ADDR"];
?>

Also, if you ever wanted to view all the $_SERVER[] values:

PHP:
<?php
foreach ( $_SERVER as $k => $v )
{
    echo '$_SERVER[' . $k . '] = ' . $v . '<br />';
}
?>

That code can be used for almost everything, $_COOKIE, $_SESSION, $_POST, $_GET etc.
thanks!
 
Status
Not open for further replies.

Users who are viewing this thread

Top