Web Hosting Talk







View Full Version : I Can Not Reterieve The $_server['http_user_agent']


azizny
05-23-2004, 01:32 PM
???

It was working ok with my IIS but when i used it on my server it is empty..

I tried to see if it even exists by using print_r($_SERVER) and the strange thing is THAT IT IS NOT EVEN THERE????

Please Help

gilbert
05-23-2004, 01:40 PM
maybe tryin a php info file may be a good place to start

azizny
05-23-2004, 02:04 PM
the problem is the file im trying to do it in is an include and thats why i think its not working..

i am trying to somehow save the variable before calling the include so it would have it ready..

any help is appreciated

thnx,

azizny
05-23-2004, 02:22 PM
Damn it...
I tried to include it as a variable ?s='sdfs' @@@ its not working??

i also tried the sessions and cookies it doenst???

azizny
05-23-2004, 02:24 PM
Warning: main(http://www.free-php-scripts.net/bannerman/counter.php?id=ffa30&b= MSIE 6.0&s= Windows NT 5.1)): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/freephp/public_html/header.php on line 309

Warning: main(): Failed opening 'http://www.free-php-scripts.net/bannerman/counter.php?id=ffa30&b= MSIE 6.0&s= Windows NT 5.1)' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/freephp/public_html/header.php on line 309

:S

azizny
05-23-2004, 02:45 PM
Spaces.... Dam them..

I got over it by replacing them with %20 :p

no wonder i seen them alot around

azizny
05-26-2004, 03:37 PM
Can I ask one more question:

Why was it when I included the file, the included file didnt have access to the $_SERVER variables?

Is it suppose to be like that?
Peace,

stormraven
05-26-2004, 07:33 PM
I usually have my include files declare a function, which I then use in my main script. That way, you can fairly simply control the data going to them by using the function arguments. You can also reuse the calls easier that way.

Good, bad or indifferent - it seems to work for me. ;)

Ex: banner.php

function printBanner ($bannerName)
{
// blah, blah, blah.. some stuff here
}


main.php:


require_once ("banner.php");
// blah, blah, blah

printBanner("My Banner");

Burhan
05-27-2004, 02:35 AM
No, $_SERVER and other variables ($_POST, $_REQUEST, $_GET, $_COOKIE, $_FILES, etc.) are globally available.