I'm building a banner administrator with statistics. To get the banner on some page I'm using include "banner.php". In banner.php I have a script that makes a random selection an echoes the banner, it should keep information about the visitor (date and IP). However I'm using include, the script assumes that the REMOTE_ADDR is the Servers address. I can't find the way to pass the real visitors IP to the script.
Some idea? 😕
Do like this before you include the file:
$user_ip = getenv('REMOTE_ADDR');
Then use $user_ip instead of $REMOTE_ADDR in 'banner.php'.
-- lilleman
I don't know why, but I get empty $user_ip_. The variable doesn't pass to the script.
do this in the main script:
global $user_ip; $user_ip = getenv('REMOTE_ADDR');
then, in the include:
global $user_ip;
and $user_up should be populated 🙂
Magmus,
Post the line where you include() the file.
After 3 days trying everything it started to work. After them I re-tried previous attempts and they work all now. ?????? What happened??? I don't know but now it works. 😕