[PHP] Re: PHP and Intranets

2003-12-03 Thread Luke
im from australia too :)

more information on server variables is available from
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server

heres and example of usage, and it only allows those 3 computer to view the
page (this authentication isnt very good, as all someone would have to do is
change their computers name to view the page)

(the getIP function was taken from a users comment in the PHP manual, very
handy, thanks! (to fund it search the manual for getIP)

\n";
echo "Your host name is: " . $_SERVER['HTTP_HOST'];
echo "Your browser is:" . $_SERVER['HTTP_USER_AGENT'];
echo "Your IP(s) Are: " . getIP();

function GetIP()
{
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"),
"unknown"))
$ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR") &&
strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
$ip = getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"),
"unknown"))
$ip = getenv("REMOTE_ADDR");
else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']
&& strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
$ip = $_SERVER['REMOTE_ADDR'];
else
$ip = "unknown";
return($ip);
}//---GetIP()---//
?>

-- 
Luke

"Seung Hwan Kang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> Colin Eldridge wrote:
>
> > Hi, my name is Colin Eldridge, teacher from Australia.
>
> Hello Colin,
>
> Australia! I'm here in Wollongong Uni.
>
> > I am relatively new to PHP.
> > I have set up a small intranet for my students to build and use
interactive webpages.
> > The intranet:  A server(P4, XP) running Apache, MYSQL and PHP (from
Janet Valade's text with CD-ROM)
> > and 3 hosts running P2, Win98 and using IE or
Mozilla as intranet browsers.
> >
> > Students use a browser on the 3 hosts to access PHP scripts from the
server, which then deliver HTML forms back to the originating host.
> > Hosts 'post' completed forms to server, and PHP scripts connect to the
MYSQL server to update a database.
> >
> > Question:  Is there a simple way for PHP to identify which host a form
has come from?  The network names of the 3 hosts are stu1, stu2 & stu3.
Some type of unique host Id is needed  by the PHP scripts to contruct
database records. For this exercise, we are not using PHP sessions, and the
students do not have usernames and passwords for access to the database.
Access is automatic after each host is logged onto the intranet.
>
> Yes, there is .!
> use env. variables.
>
> $_SERVER["SERVER_NAME"]
> $_SERVER["REMOTE_ADDRESS"] // i think this is what u r looking for
>
> if u would lke to find out more...
>
> // test.php
> 
> echo phpinfo();
>
> ?>
>
> :)
>
> >
> > Thanks very much for your time.
> > Regards
> > Colin Eldridge
> >
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP and Intranets

2003-12-03 Thread Seung Hwan Kang


Colin Eldridge wrote:

Hi, my name is Colin Eldridge, teacher from Australia.
Hello Colin,

Australia! I'm here in Wollongong Uni.

I am relatively new to PHP.
I have set up a small intranet for my students to build and use interactive webpages. 
The intranet:  A server(P4, XP) running Apache, MYSQL and PHP (from Janet Valade's text with CD-ROM)
and 3 hosts running P2, Win98 and using IE or Mozilla as intranet browsers.

Students use a browser on the 3 hosts to access PHP scripts from the server, which 
then deliver HTML forms back to the originating host.
Hosts 'post' completed forms to server, and PHP scripts connect to the MYSQL server to 
update a database.
Question:  Is there a simple way for PHP to identify which host a form has come from?  The network names of the 3 hosts are stu1, stu2 & stu3.  Some type of unique host Id is needed  by the PHP scripts to contruct database records. For this exercise, we are not using PHP sessions, and the students do not have usernames and passwords for access to the database.  Access is automatic after each host is logged onto the intranet.
Yes, there is .!
use env. variables.
$_SERVER["SERVER_NAME"]
$_SERVER["REMOTE_ADDRESS"] // i think this is what u r looking for
if u would lke to find out more...

// test.php

echo phpinfo();

?>

:)

Thanks very much for your time.
Regards
Colin Eldridge
   


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php