Forum Moderators: coopster

Message Too Old, No Replies

Script giving out server info and not user info.

         

Jesse_Smith

1:57 am on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you do to make the script give out the user info and not the server info? If your at the URL of the script, it gives out the correct info....

MY IP ADDRESS - Mozilla/4.73C-CCK-MCD {C-UDP; EBM-APPLE} (Macintosh; U; PPC) - cgi-local/google.cgi - 02/24/03 17:46:38 PST

But the visitors at the site give out the server info.

SERVER IP ADDRESS - PHP/4.0.6 - /cgi-local/google.cgi - 02/24/03 17:46:39 PST

This is from a perl script using an include in a php page.

<?php
include "http://www.domain.com/cgi-local/google.cgi";
?>

Xuefer

3:16 am on Feb 25, 2003 (gmt 0)

10+ Year Member



by including a http url, php open it by a http get request
cause it's the server open the file, it's another request(by server ip), different from the user request(by user ip)

try virtual()
i've not yet used it.

Jesse_Smith

3:49 am on Feb 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do you do virtual()?

If I do

<?php
include "/path_to_site/web/cgi-local/google.cgi";
?>

then it shows the whole script content.

And

include 'http://www.domain.com/cgi-local/google.cgi';

also doesn't work.

Xuefer

3:11 pm on Feb 28, 2003 (gmt 0)

10+ Year Member



do you ever read phpmanual?

Description
int virtual ( string filename)

it's a bit like include

hakre

3:37 pm on Feb 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi Jesse_Smith,

wether include nor virtual won't help at all. because in your scenario php would retrieve the file (via the fopen wrapper which is able to handle http) and therefore the cgi script will return your server info.

you've to write a script like the cgi yourself and make a function out of it which will return the line you desire. here is how:

make a php file and put the command phpinfo() [php.net] into it. then uplad the file and request it. it will return tons of information about the php setup on your webserver. locate the PHP Variables sections and pick out the vars interesting for you.

_SERVER["REMOTE_ADDR"] might be interesting for you.

then

echo($_SERVER["REMOTE_ADDR"]);
might do the job for you.