[PHP] How to pass variables to php functions from url's?

2001-09-07 Thread Martin Lindhe

I need to solve the following problem, but I can't figure out how:

Let's assume we have a server called www.test.com
When a user access http://www.test.com/path/username,
I want a php script to execute, as if the url entered was
http://www.test.com/path.php?value=username.

I'm running PHP 4.0.6 on Apache 1.3.20.
I've looked at both PHP and Apache documentation about this, but
i havent found any information or examples on how this could be solved,
so I'm asking the question here in hope for help.

Thanks!

/Martin Lindhe

-- 
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 pass variables to php functions from url's?

2001-09-07 Thread Krzysztof Kocjan

Try method=GET in Your form to submit if You want to url be like
url?var=value. Or php function header( 'Location: ' .rul . 'var=value' );
That's all You need I hope. Sorry but Your question is not good explained.

Krzysztof Kocjan

Martin Lindhe wrote:

 I need to solve the following problem, but I can't figure out how:

 Let's assume we have a server called www.test.com
 When a user access http://www.test.com/path/username,
 I want a php script to execute, as if the url entered was
 http://www.test.com/path.php?value=username.

 I'm running PHP 4.0.6 on Apache 1.3.20.
 I've looked at both PHP and Apache documentation about this, but
 i havent found any information or examples on how this could be solved,
 so I'm asking the question here in hope for help.

 Thanks!

 /Martin Lindhe

 --
 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]


---
KONKURS: Niedobre miejsca - 50 ksiazek W. Whartona do wygrania!
http://szkola.interia.pl/wharton/strona.html?co=13


-- 
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]




SV: [PHP] How to pass variables to php functions from url's?

2001-09-07 Thread Martin Lindhe

 Try method=GET in Your form to submit if You want to url be like
 url?var=value. Or php function header( 'Location: ' .rul . 
 'var=value' );

No, i'm not using a form, and i cant execute any php scripts whatsoever
if there are no php script specified to execute. 

 That's all You need I hope. Sorry but Your question is not 
 good explained.

Please read my mail again, I tried to described my problem as good
as possible.


 Martin Lindhe wrote:
 
  I need to solve the following problem, but I can't figure out how:
 
  Let's assume we have a server called www.test.com
  When a user access http://www.test.com/path/username,
  I want a php script to execute, as if the url entered was
  http://www.test.com/path.php?value=username.
 
  I'm running PHP 4.0.6 on Apache 1.3.20.
  I've looked at both PHP and Apache documentation about this, but
  i havent found any information or examples on how this 
 could be solved,
  so I'm asking the question here in hope for help.
 
  Thanks!
 
  /Martin Lindhe

-- 
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 pass variables to php functions from url's?

2001-09-07 Thread Doug Granzow

   Let's assume we have a server called www.test.com
   When a user access http://www.test.com/path/username,
   I want a php script to execute, as if the url entered was
   http://www.test.com/path.php?value=username.
  
   I'm running PHP 4.0.6 on Apache 1.3.20.

Step 1:  Rename path.php to path

Step 2:  Add this to your Apache conf file:

Location /path
ForceType application/x-httpd-php
/Location

This causes path to be executed as a PHP script even though it does not
have a .php extension.

Step 3:  Add this to your path php script:

// $PATH_INFO = the rest of the URI after dmb/

// remove anything other than letters, numbers, dots, underscores,
// and dashes, and put into an array

// for example trading/toptraders will be an array consisting
// of trading ($args[1]) and toptraders ($args[2]).  The / is
discarded.

ereg((^[-_.\/a-zA-Z0-9]*$), $PATH_INFO, $arg);
$args = split( /, $arg[1]);


Hope this helps.

Doug Granzow
[EMAIL PROTECTED]



-- 
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]