Regarding the location of php.ini, read this:

  http://www.php.net/faq.installation.php#faq.installation.findphpini

Next, learn about using external variables in PHP:

  http://www.php.net/variables.external

Now, regarding your example of: file.php?action=3 You'll notice 
that you can use either:

  a) $_GET['action']
  b) $HTTP_GET_VARS['action']
  c) $_REQUEST['action'];
  d) import_request_variables()...
  e) $action if register_globals = on
  f) Note: it's NOT POST, it's GET.

Regarding "using in a sql query", this is a simple string
related question and has nothing to do with register_globals
or SQL.  You can do this:

  // GOOD
  $str = "An array: {$_GET['action']} inside a string";

While the following results in an error and will NOT work:

  // BAD!!!
  $str = "An array: $_GET['action'] inside a string";

This is further explained here:

  http://www.php.net/types.string

Regards,
Philip


On Wed, 26 Mar 2003, Joe Kupiszewski wrote:

> I didn't do the installation, but the phpinfo() shows the following:
> 
> version - 4.2.3
> 
> ./configure' '--with-apxs=/usr/local/sbin/apxs'
> '--with-config-file-path=/usr/local/etc' '--enable-versioning'
> '--with-regex=system' '--without-gd' '--without-mysql' '--with-zlib'
> '--with-mysql=/usr/local' '--prefix=/usr/local' 'i386-portbld-freebsd4.7'
> 
> and the php path info is listed as
> /usr/local/etc
> 
> I do have root access as this is not a production machine, but for the life
> of me cannot seem to get it to read the php.ini file.  I believe php and
> apache are interacting properly, or I wouldn't get the phpinfo() to work.
> 
> The root of my real problem is that in trying to pass variable values from
> php scripts to reinvocations of the same script using
> http://pathtofile.php?action=3
> 
> I realize that this is a register_globals thing and that I can access it by
> one of two ways:
> 
> 1)  Turning register_globals on (which many tell me is a security risk)
> 2)  Using $_REQUEST["action"]
> 3)  $HTTP_POST_VARS and $HTTP_GET_VARS -> with ["action"]
> 
> However, using the second (haven't tried the 3rd) method and trying to
> incorporate this variable value into an sql statement it bombs.  This may be
> more appropriate for an sql post, but thought I would throw it up here and
> see if anyone can shed some light as to how php is interpreting 2) and 3)
> 
> One workaround I have started with was just assigning the
> $_REQUEST["action"] value to a new local variable and just using that, but
> it seems like there would be an easier way and that this method is just a
> lot of wasted work.
> 
> Thanks for any thoughts and I am happy to post add'l script details.
> 
> Joe...
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to