Re: [PHP] Best way to get the remote IP address?

2002-01-21 Thread Ing. Daniel Manrique

 I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP
 documentation from January 2001, so you should probably best stick with
 either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use
 $REMOTE_ADDR in functions make sure you do a global on it first) - I
 personally use $REMOTE_ADDR, but you should read the docs for details...

That's because it's probably not so much a PHP thing. X-Forwarded-For is 
normally used when going through a proxy. Say my internal IP is 
192.168.1.15, and my proxy's official IP address is 132.248.10.2, then 
we'd have this:

REMOTE_ADDR=132.248.10.2
X_FORWARDED_FOR=192.168.1.15

That way, even when going through a proxy, there's information about who 
originally submitted the request.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Opening more than one database at a time?

2002-01-20 Thread Ing. Daniel Manrique

It;'s entirely possible. Most database-related functions can take an 
optional link identifier parameter. You didn't use it, and in that case, 
database operations default to the last opened database connection. You 
can however do something like:

$dblink1=mysql_connect($server1,$user1,$password1);
$dblink2=mysql_connect($server2,$user2,$password2);

mysql_select_db($database_1,$dblink1); //for link 1
mysql_select_db($dblink2,$dblink2); //for link 2

$result1=mysql_query(SELECT * from whatever,$dblink1);

while ($row=mysql_fetch_array($result1)){
$query2=insert into secondtable values . 
$row[id].,.$row[whatever];
$result2=mysql_query($query2,$dblink2); //insert on database 2
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] disable_functions on virtual hosts?

2002-01-18 Thread Ing. Daniel Manrique


I'd like to disable certain functions for a particular virtual host, and 
leave them as is for all the rest. 

The usual way to do this would be to include something like:

php_admin_value disable_functions system,exec

in the virtual host's configuration block. However, this doesn't work, and 
scripts are still able to use the disabled functions.

phpinfo() shows system,exec under local value for disable_functions, 
which would seem to indicate that the configuration is correct, even 
though it doesn't work.

I made a little experiment and added those functions to php.ini's 
disable_function directive, and in this case it works perfectly, and the 
specified functions are disabled.

I'm wondering if I'm missing something here, or is this a known problem 
with PHP? This is PHP 4.0.6 running on OpenBSD 2.9 with Apache 1.3.19.

I guess I can live without disabling those functions on one particular 
virtualhost, but I'd sleep better knowing they are disabled.

Thanks in advance!

- Daniel Manrique



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to send to URL on if statement?

2002-01-18 Thread Ing. Daniel Manrique

 Can anyone advise or direct me to the documentation that references how to
 send a user to a URL if an 'if' statement is satisfied?

Assuming you hadn't sent any output before:

if ($condition){
header(Location: http://wherever.com;);
exit;
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]