|
From: Leif W <war...@us...> - 2003-09-29 20:54:43
|
Cool, that's what I started to figure after thinking about it. I'm looking
at other PHP app sources (like phpMyAdmin, the popular MySQL admin utility),
to see how they handle it.
From the main index.php, one possible way to handle this is as follows (the
example is trying to get the HTTP_HOST environment variable):
// Gets the host name
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
if (empty($HTTP_HOST)) {
if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) {
$HTTP_HOST = $_ENV['HTTP_HOST'];
}
else if (!empty($HTTP_ENV_VARS) && isset($HTTP_ENV_VARS['HTTP_HOST'])) {
$HTTP_HOST = $HTTP_ENV_VARS['HTTP_HOST'];
}
else if (@getenv('HTTP_HOST')) {
$HTTP_HOST = getenv('HTTP_HOST');
}
else {
$HTTP_HOST = '';
}
}
But just before this, in the same file index.php, there's a require line:
require('./libraries/grab_globals.lib.php');
And in this file there's a function definition which appears to look for
variables in the various locations and stick them into $GLOBALS.
/**
* This library grabs the names and values of the variables sent or posted
to a
* script in the '$HTTP_*_VARS' / $_* arrays and sets simple globals
variables
* from them. It does the same work for the $PHP_SELF variable.
*
* loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
*/
I may just have to lift (i.e. borrow or use) this code, and modify it for
use in ioelmsrv.php. Both projects are GPL, so shouldn't be a problem.
I'll just leave a credit in the source. I'll have to think if there's any
more generalized ways of handling the version problem before implementing
anything.
Leif
----- Original Message -----
From: "Kevin" <ke...@ke...>
To: <dyn...@li...>
Sent: Monday, September 29, 2003 1:14 PM
Subject: Re: [Dynapi-Dev] example dynapi.util.ioelement-post.html asp / php
> Hi,
>
> I was using php version 4.0.6 (for a Windows test with IIS) that didn't
have
> the $_GET / $_POST variables.
>
> -
> Kevin
>
> "Leif W" <war...@us...> wrote:
>
>
> > Sorry, still behind on messages. Just sort of picking messages at
random to
> > reply to. :D
> >
> > I'll compare this PHP code to what's in CVS and play with it. AFAIK,
the
> > PHP version was working for GET and POST, at least for the simple
example
> > page. But I remember there was a lot of robustness testing (i.e. for
all
> > the various data types) that needed to be done, so maybe something was
> > indeed broken. I don't have any access to a ASP (JScript/VBScript)
> > environment, so I can't test that.
> >
> > Leif
> >
> > ----- Original Message -----
> > From: "Kevin" <ke...@ke...>
> > To: "Dynapi-Dev" <Dyn...@li...>
> > Sent: Tuesday, September 23, 2003 2:42 PM
> > Subject: [Dynapi-Dev] example dynapi.util.ioelement-post.html asp / php
> >
> >
> > > Hi,
> > >
> > > dynapi.util.ioelement-post.html
> > >
> > > I posted before that the get option of the above asp example doesn't
work.
> > >
> > > I had a look at the php version and neither get or post worked. I had
a
> > look
> > > and attached a fix. I'm not familiar with vb so could someone help
with
> > the
> > > asp implementation.
> > >
> > > Sorry I'm not up on patching or write access to cvs hence the
attachment.
> > >
> > > -
> > > Kevin
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Dynapi-Dev mailing list
> > Dyn...@li...
> > http://www.mail-archive.com/dyn...@li.../
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
> http://www.mail-archive.com/dyn...@li.../
>
>
|