Re: [PHP] URL Parsing...

2007-11-26 Thread Richard Heyes

Chris wrote:

Richard Heyes wrote:
well if you take a string (filename) and wish to change the end of it 
somone
then I don't think str_replace() is the correct function. what's to 
say a script

doesn't exist called 'my.cfm.php'?


How does this:

/\.cfm$/

take into account that?


$ in regex's means 'end of string' - so it will only match .cfm at the 
very end of the string.


Indeed, so how does the regex take into account .cfm.php? It doesn't. 
If it doesn't have a .cfm extension, it won't match.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] URL Parsing...

2007-11-26 Thread Jochem Maas
Richard Heyes wrote:
 Chris wrote:
 Richard Heyes wrote:
 well if you take a string (filename) and wish to change the end of
 it somone
 then I don't think str_replace() is the correct function. what's to
 say a script
 doesn't exist called 'my.cfm.php'?

 How does this:

 /\.cfm$/

 take into account that?

 $ in regex's means 'end of string' - so it will only match .cfm at the
 very end of the string.
 
 Indeed, so how does the regex take into account .cfm.php? It doesn't.
 If it doesn't have a .cfm extension, it won't match.

because the question was I want to replace the extension '.cfm' with 
'-meta.cfm',
which I assumed meant the OP didn't want 'my.cfm.php' to become 
'my-meta.cfm.php'
and a str_replace('.cfm', '-meta.cfm', $foo) would not be correct in that 
situation.

hopefully now the use of preg_replace() in my example makes sense.

oh and I forget to add delimeters to the regexps in my examples, which was a 
stupid
oversight.

 

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



Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes

one of these should give you something to go on:

echo preg_replace('\.cfm$', '-meta.cfm', parse_url($_SERVER['REQUEST_URI'], 
PHP_URL_PATH)), \n;
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), \n;
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']), \n;


Anything would be helpful.  :)


You don't need the overhead of PCRE, though it is the fastest to write, 
since it's already above for you...


Or parse_url(). basename(__FILE__) will get you the filename.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote:
 one of these should give you something to go on:

 echo preg_replace('\.cfm$', '-meta.cfm',
 parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), \n;
 echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']),
 \n;
 echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']),
 \n;

 Anything would be helpful.  :)
 
 You don't need the overhead of PCRE, though it is the fastest to write,
 since it's already above for you...

well if you take a string (filename) and wish to change the end of it somone
then I don't think str_replace() is the correct function. what's to say a script
doesn't exist called 'my.cfm.php'?

 
 Or parse_url(). basename(__FILE__) will get you the filename.

ah yes basename() - I forgot to put use that in the examples, good catch.

 

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



Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes

well if you take a string (filename) and wish to change the end of it somone
then I don't think str_replace() is the correct function. what's to say a script
doesn't exist called 'my.cfm.php'?


How does this:

/\.cfm$/

take into account that?

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote:
 well if you take a string (filename) and wish to change the end of it
 somone
 then I don't think str_replace() is the correct function. what's to
 say a script
 doesn't exist called 'my.cfm.php'?
 
 How does this:
 
 /\.cfm$/
 
 take into account that?

WTF

 

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



Re: [PHP] URL Parsing...

2007-11-25 Thread Chris

Richard Heyes wrote:
well if you take a string (filename) and wish to change the end of it 
somone
then I don't think str_replace() is the correct function. what's to 
say a script

doesn't exist called 'my.cfm.php'?


How does this:

/\.cfm$/

take into account that?


$ in regex's means 'end of string' - so it will only match .cfm at the 
very end of the string.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] URL Parsing...

2007-11-24 Thread Amanda Loucks
Hi,

I'm working on redesigning the backend of the website for work.  It was
originally done in ColdFusion, but I'm switching it over to PHP - probably
going to transfer the website from where it's currently hosted to something
a lot cheaper, too, hence the switching to PHP.  Anyway.

Because we are a manufacturing company, we have a few different lines of
products.  Currently, each different product line has it's own page (and own
meta tags).  The current set up has ColdFusion grabbing the current page
from the URL stripping off the '.cfm' extension and adding '-meta.cfm'
before including it in the header.

I'm sure there is a way to do this in PHP, but I'm out of shape enough with
using PHP that I can't remember, and I can't seem to find anything that will
work for me.  I just want to be able to pull whatever address is in the URL,
get the file name, and go from there.

Any ideas?

Anything would be helpful.  :)

Thanks,
Amanda


Re: [PHP] URL Parsing...

2007-11-24 Thread tedd

At 12:18 PM -0600 11/24/07, Amanda Loucks wrote:

Hi,

I'm working on redesigning the backend of the website for work.  It was
originally done in ColdFusion, but I'm switching it over to PHP - probably
going to transfer the website from where it's currently hosted to something
a lot cheaper, too, hence the switching to PHP.  Anyway.

Because we are a manufacturing company, we have a few different lines of
products.  Currently, each different product line has it's own page (and own
meta tags).  The current set up has ColdFusion grabbing the current page
from the URL stripping off the '.cfm' extension and adding '-meta.cfm'
before including it in the header.

I'm sure there is a way to do this in PHP, but I'm out of shape enough with
using PHP that I can't remember, and I can't seem to find anything that will
work for me.  I just want to be able to pull whatever address is in the URL,
get the file name, and go from there.

Any ideas?

Anything would be helpful.  :)

Thanks,
Amanda


From what I've read recently about meta tags, why?

Most SE's have dropped their dependance on meta tags because of their abuse.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] URL Parsing...

2007-11-24 Thread Jochem Maas
Amanda Loucks wrote:
 Hi,
 
 I'm working on redesigning the backend of the website for work.  It was
 originally done in ColdFusion, but I'm switching it over to PHP - probably
 going to transfer the website from where it's currently hosted to something
 a lot cheaper, too, hence the switching to PHP.  Anyway.
 
 Because we are a manufacturing company, we have a few different lines of
 products.  Currently, each different product line has it's own page (and own
 meta tags).  The current set up has ColdFusion grabbing the current page
 from the URL stripping off the '.cfm' extension and adding '-meta.cfm'
 before including it in the header.
 
 I'm sure there is a way to do this in PHP, but I'm out of shape enough with
 using PHP that I can't remember, and I can't seem to find anything that will
 work for me.  I just want to be able to pull whatever address is in the URL,
 get the file name, and go from there.
 
 Any ideas?

one of these should give you something to go on:

echo preg_replace('\.cfm$', '-meta.cfm', parse_url($_SERVER['REQUEST_URI'], 
PHP_URL_PATH)), \n;
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), \n;
echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']), \n;

 
 Anything would be helpful.  :)
 
 Thanks,
 Amanda
 

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



[PHP] URL parsing

2002-12-18 Thread Mako Shark
I've got a URL like this:

http://www.naturalist.com/~fungae/index.php

which is stored in $http_referer (as parse_url from
$HTTP_REFERER).

I'm trying to extract the username (~fungae). I've
read the docs on parse_url(), and have tried to get
$http_referer[user], but it comes up with zilch. I've
also tried to print_r $http_referer, but I only get
scheme, host, path, and query. Any ideas?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] URL parsing

2002-12-18 Thread Wico de Leeuw
http://www.php.net/manual/en/function.parse-url.php
At 06:39 18-12-02 -0800, Mako Shark wrote:

I've got a URL like this:

http://www.naturalist.com/~fungae/index.php

which is stored in $http_referer (as parse_url from
$HTTP_REFERER).

I'm trying to extract the username (~fungae). I've
read the docs on parse_url(), and have tried to get
$http_referer[user], but it comes up with zilch. I've
also tried to print_r $http_referer, but I only get
scheme, host, path, and query. Any ideas?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] URL parsing

2002-12-18 Thread Tim Ward
you could use a combination of the string functions 
(strstr(), substr(), strpos()) or you could work out 
something with regular expressions.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
- Original Message - 
From: Mako Shark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 18, 2002 2:39 PM
Subject: [PHP] URL parsing


 I've got a URL like this:
 
 http://www.naturalist.com/~fungae/index.php
 
 which is stored in $http_referer (as parse_url from
 $HTTP_REFERER).
 
 I'm trying to extract the username (~fungae). I've
 read the docs on parse_url(), and have tried to get
 $http_referer[user], but it comes up with zilch. I've
 also tried to print_r $http_referer, but I only get
 scheme, host, path, and query. Any ideas?
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com
 
 -- 
 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




Re: [PHP] URL parsing

2002-12-18 Thread 1LT John W. Holmes
 http://www.php.net/manual/en/function.parse-url.php

If you're going to help, at least read the question. The poster already said
they tried that and it's not even a solution, anyhow. The username it
refers to in parse_url() is for URLs in the format of
http://username:[EMAIL PROTECTED].

 http://www.naturalist.com/~fungae/index.php
 
 which is stored in $http_referer (as parse_url from
 $HTTP_REFERER).
 
 I'm trying to extract the username (~fungae). I've
 read the docs on parse_url(), and have tried to get
 $http_referer[user], but it comes up with zilch. I've
 also tried to print_r $http_referer, but I only get
 scheme, host, path, and query. Any ideas?

Assuming $url is what you have above:

$tilde = strpos($url,~);
$slash = strpos($url,/,$tilde);
$length = $slash - $tilde;

$username = substr($url,$tilde,$length);

Or you can use a regular expression, but the above is probably faster.

preg_match(!(~[^/]*)/!,$url,$match);
or
preg_match(!(~.*)/!U,$url,$match);

In my tests, the first solution (using strpos) was the fastest by 35%.

---John Holmes...


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




[PHP] URL Parsing Help

2002-01-29 Thread Shane Lambert

I am trying to write software that will allow me to pass variables to a php 
script like:

index.php/option=contact/step=view

When I do this, I get the varibal PATH_INFO which contains 
/option=contact/step=view. Now, what I want is to have the following:

$option = contact
$step = view

I tried using '$array = explode(/,$PATH_INFO);' which gives me the array:

$array[1] = option=contact
$array[2] = step=view

This of course is not what I want. I want:

$array[option] = contact
$array[step] = view

So that when I use the extract($array) command I get the variables:

$option = contact
$step = view

Like I want. If you aren't lost and you know the answer, PLEASE HELP!


-- 
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] URL Parsing Help

2002-01-29 Thread Christopher William Wesley

$myPairs = explode( /, $PATH_INFO );
while( list( $key, $val ) = each( $myPairs ) ){
if( !empty( $val ) ){
$myVar = explode( =, $val );
${$myVar[0]} = $myVar[1];
}
}

For you example URI, index.php/option=contact/step=view
you would then have $option and $step available, with the assigned values
of contact and view, respectively.

~Chris   /\
 \ / September 11, 2001
  X  We Are All New Yorkers
 / \ rm -rf /bin/laden

On Tue, 29 Jan 2002, Shane Lambert wrote:

 I am trying to write software that will allow me to pass variables to a php
 script like:

 index.php/option=contact/step=view

 When I do this, I get the varibal PATH_INFO which contains
 /option=contact/step=view. Now, what I want is to have the following:

 $option = contact
 $step = view

 I tried using '$array = explode(/,$PATH_INFO);' which gives me the array:

 $array[1] = option=contact
 $array[2] = step=view

 This of course is not what I want. I want:

 $array[option] = contact
 $array[step] = view

 So that when I use the extract($array) command I get the variables:

 $option = contact
 $step = view

 Like I want. If you aren't lost and you know the answer, PLEASE HELP!


 --
 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 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] URL Parsing Help

2002-01-29 Thread Shane Lambert

Actually, I found a simpler way:

$vars = str_replace(/,,$PATH_INFO);
parse_str($vars);

But thanks for your help...

Christopher William Wesley wrote:

 $myPairs = explode( /, $PATH_INFO );
 while( list( $key, $val ) = each( $myPairs ) ){
   if( !empty( $val ) ){
   $myVar = explode( =, $val );
   ${$myVar[0]} = $myVar[1];
   }
 }
 
 For you example URI, index.php/option=contact/step=view
 you would then have $option and $step available, with the assigned values
 of contact and view, respectively.
 
 ~Chris   /\
  \ / September 11, 2001
   X  We Are All New Yorkers
  / \ rm -rf /bin/laden
 
 On Tue, 29 Jan 2002, Shane Lambert wrote:
 
 
I am trying to write software that will allow me to pass variables to a php
script like:

index.php/option=contact/step=view

When I do this, I get the varibal PATH_INFO which contains
/option=contact/step=view. Now, what I want is to have the following:

$option = contact
$step = view

I tried using '$array = explode(/,$PATH_INFO);' which gives me the array:

$array[1] = option=contact
$array[2] = step=view

This of course is not what I want. I want:

$array[option] = contact
$array[step] = view

So that when I use the extract($array) command I get the variables:

$option = contact
$step = view

Like I want. If you aren't lost and you know the answer, PLEASE HELP!


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

2001-03-25 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Jaxon) wrote:

 Any way to combine both forms of url parsing?
 I want to use standard slash notation for navigation ,but also account for
 the occasional variable used within a single page.
 
 e.g. URL can be either:
 domain.com/index.php/main/index.html?ii=1
 
 or: 
 domain.com/index.php/main/index.html?ii=1

Umm, how are these different?

(If you're trying to extract info from a url, perhaps 
parse_url(),basename(), and/or dirname() are what you're seeking...?)

-- 
CC

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

2001-03-25 Thread Jaxon

oops :)

http://www.domain.com/index.php/main/index.html?ii=1
versus
http://www.domain.com/index.php/main/index.html

I want to get "index.html" and "main" into variables, as the two items will
always be present - if $ii is set, I want to strip it from the URI before
parsing the items out.

I suppose with parse_url() I could do something..but I really only want to
deal with the URI.

currently, this seems to work:

$path_array = explode('/', $REQUEST_URI);

if (isset($ii))   array_pop($path_array); // remove $ii
$page_name  = array_pop($path_array); //get page name from end of array
$tpl= array_pop($path_array); //get page type from next item

but is inelegant :)

regards,
jaxon

 In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Jaxon) wrote:
 
 Any way to combine both forms of url parsing?
 I want to use standard slash notation for navigation ,but also account for
 the occasional variable used within a single page.
 
 e.g. URL can be either:
 domain.com/index.php/main/index.html?ii=1
 
 or: 
 domain.com/index.php/main/index.html?ii=1
 
 Umm, how are these different?
 
 (If you're trying to extract info from a url, perhaps
 parse_url(),basename(), and/or dirname() are what you're seeking...?)


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

2001-03-25 Thread Philip Olson

Hi!

Check out these two related articles (and user comments) :

  Building Dynamic Pages With Search Engines in Mind :
  
* http://phpbuilder.com/columns/tim19990117.php3 
* http://phpbuilder.com/columns/tim2526.php3 

Also check phpinfo() for available predefined variables and plan
accordingly.

  Predefined Variables   :
  
* http://www.php.net/manual/en/language.variables.predefined.php

And for the brave, check out mod_rewrite :

  Mod-Rewrite:
  
* http://httpd.apache.org/docs/mod/mod_rewrite.html
* http://www.engelschall.com/pw/apache/rewriteguide/
* http://marc.theaimsgroup.com/?l=php-generals=mod_rewrite


Regards,

Philip Olson
http://www.cornado.com/


On Sun, 25 Mar 2001, Jaxon wrote:

 oops :)
 
 http://www.domain.com/index.php/main/index.html?ii=1
 versus
 http://www.domain.com/index.php/main/index.html
 
 I want to get "index.html" and "main" into variables, as the two items will
 always be present - if $ii is set, I want to strip it from the URI before
 parsing the items out.
 
 I suppose with parse_url() I could do something..but I really only want to
 deal with the URI.
 
 currently, this seems to work:
 
 $path_array = explode('/', $REQUEST_URI);
 
 if (isset($ii))   array_pop($path_array); // remove $ii
 $page_name  = array_pop($path_array); //get page name from end of array
 $tpl= array_pop($path_array); //get page type from next item
 
 but is inelegant :)
 
 regards,
 jaxon
 
  In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Jaxon) wrote:
  
  Any way to combine both forms of url parsing?
  I want to use standard slash notation for navigation ,but also account for
  the occasional variable used within a single page.
  
  e.g. URL can be either:
  domain.com/index.php/main/index.html?ii=1
  
  or: 
  domain.com/index.php/main/index.html?ii=1
  
  Umm, how are these different?
  
  (If you're trying to extract info from a url, perhaps
  parse_url(),basename(), and/or dirname() are what you're seeking...?)
 
 
 -- 
 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 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] URL parsing

2001-03-25 Thread Jaxon

K, read em all, and understood more than I thought I :)


I still don't see how you can 'sanitize' a URI, eg discard anything
including and after "//" or "??".  I think this is needed if you want to
discard a query string or irregular syntax from your URI.

ereg's don't work reliably, due to the possibility of special chars in the
URI.

regards,
jaxon

On 3/25/01 3:18 PM, "Philip Olson" [EMAIL PROTECTED] wrote:

 Hi!
 
 Check out these two related articles (and user comments) :
 
 Building Dynamic Pages With Search Engines in Mind :
 
   * http://phpbuilder.com/columns/tim19990117.php3
   * http://phpbuilder.com/columns/tim2526.php3
 
 Also check phpinfo() for available predefined variables and plan
 accordingly.
 
 Predefined Variables   :
 
   * http://www.php.net/manual/en/language.variables.predefined.php
 
 And for the brave, check out mod_rewrite :
 
 Mod-Rewrite:
 
   * http://httpd.apache.org/docs/mod/mod_rewrite.html
   * http://www.engelschall.com/pw/apache/rewriteguide/
   * http://marc.theaimsgroup.com/?l=php-generals=mod_rewrite
 
 
 Regards,
 
 Philip Olson
 http://www.cornado.com/
 
 


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

2001-03-25 Thread Aaron Tuller

why can't you str_replace the $QUERY_STRING frm the $REQUEST_URI?

give an example of what you are trying to do?  (I'm sorry if you did 
and I missed it)

-aaron

At 9:06 PM -0500 3/25/01, Jaxon wrote:
K, read em all, and understood more than I thought I :)


I still don't see how you can 'sanitize' a URI, eg discard anything
including and after "//" or "??".  I think this is needed if you want to
discard a query string or irregular syntax from your URI.

ereg's don't work reliably, due to the possibility of special chars in the
URI.

regards,
jaxon

On 3/25/01 3:18 PM, "Philip Olson" [EMAIL PROTECTED] wrote:

  Hi!

  Check out these two related articles (and user comments) :

  Building Dynamic Pages With Search Engines in Mind :
  
* http://phpbuilder.com/columns/tim19990117.php3
* http://phpbuilder.com/columns/tim2526.php3

  Also check phpinfo() for available predefined variables and plan
  accordingly.

  Predefined Variables   :
  
* http://www.php.net/manual/en/language.variables.predefined.php

  And for the brave, check out mod_rewrite :

  Mod-Rewrite:
  
* http://httpd.apache.org/docs/mod/mod_rewrite.html
* http://www.engelschall.com/pw/apache/rewriteguide/
* http://marc.theaimsgroup.com/?l=php-generals=mod_rewrite


  Regards,

  Philip Olson
  http://www.cornado.com/




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

2001-03-25 Thread Jaxon

whups, sorry - here is the example:

I want to turn URI's like:

/script.php/main/index.html?junk=junk
/script.php/main/index.html//
/script.php/main/index.html??

all into:

/script.php/main/index.html

best regards,
jaxon

On 3/25/01 9:25 PM, "Aaron Tuller" [EMAIL PROTECTED] wrote:

 why can't you str_replace the $QUERY_STRING frm the $REQUEST_URI?
 
 give an example of what you are trying to do?  (I'm sorry if you did
 and I missed it)
 
 -aaron
 
 At 9:06 PM -0500 3/25/01, Jaxon wrote:
 K, read em all, and understood more than I thought I :)
 
 
 I still don't see how you can 'sanitize' a URI, eg discard anything
 including and after "//" or "??".  I think this is needed if you want to
 discard a query string or irregular syntax from your URI.
 
 ereg's don't work reliably, due to the possibility of special chars in the
 URI.
 
 regards,
 jaxon
 
 On 3/25/01 3:18 PM, "Philip Olson" [EMAIL PROTECTED] wrote:
 
  Hi!
 
  Check out these two related articles (and user comments) :
 
  Building Dynamic Pages With Search Engines in Mind :
  
* http://phpbuilder.com/columns/tim19990117.php3
* http://phpbuilder.com/columns/tim2526.php3
 
  Also check phpinfo() for available predefined variables and plan
  accordingly.
 
  Predefined Variables   :
  
* http://www.php.net/manual/en/language.variables.predefined.php
 
  And for the brave, check out mod_rewrite :
 
  Mod-Rewrite:
  
* http://httpd.apache.org/docs/mod/mod_rewrite.html
* http://www.engelschall.com/pw/apache/rewriteguide/
* http://marc.theaimsgroup.com/?l=php-generals=mod_rewrite
 
 
  Regards,
 
  Philip Olson
  http://www.cornado.com/
 
 
 
 
 --
 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 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] URL parsing

2001-03-23 Thread Richard Lynch

I think you can change the separator in php.ini, and for sure you could do
it by hand using $PATH_INFO or something.

Personally, my first question would be if the new "standard" is actually
being used or supported by anybody else...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Dave Smith [EMAIL PROTECTED]
Newsgroups: php.general
Sent: Saturday, March 17, 2001 10:55 AM
Subject: [PHP] URL parsing


 I have heard that the new standard for URLS is ...test.php?op=3;op2=6...
 using the semi colon as a seperator. Is this currently supported by php
4.0.3?

 Cheers

 Dave Smith

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

2001-03-23 Thread Jaxon


how about parsing a url from passing variables like :
test.php/op/3/op2/6/pagename.html

cannot this be parsed, to let search engines spider past the "?" properly?

regards,
jaxon

On 3/23/01 7:46 PM, "Richard Lynch" [EMAIL PROTECTED] wrote:

 I think you can change the separator in php.ini, and for sure you could do
 it by hand using $PATH_INFO or something.
 
 Personally, my first question would be if the new "standard" is actually
 being used or supported by anybody else...
 
 --
 Visit the Zend Store at http://www.zend.com/store/
 Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
 Volunteer a little time: http://chatmusic.com/volunteer.htm
 - Original Message -
 From: Dave Smith [EMAIL PROTECTED]
 Newsgroups: php.general
 Sent: Saturday, March 17, 2001 10:55 AM
 Subject: [PHP] URL parsing
 
 
 I have heard that the new standard for URLS is ...test.php?op=3;op2=6...
 using the semi colon as a seperator. Is this currently supported by php
 4.0.3?
 
 Cheers
 
 Dave Smith
 
 --
 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 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] URL parsing

2001-03-23 Thread Jaxon


Well assuming that this:   index.php/tpl/main/ii/1/pagename/name.html
is representative of this: index.php?tpl=mainii=1$pagename=name.html

then:
   
$path_array = explode('/', $REQUEST_URI);
$numPathElements = count($path_array);

gives me:

$path_array[0] = tpl
$path_array[1] = main
$path_array[2] = ii
$path_array[3] = 1
$path_array[4] = pagename
$path_array[5] = name.html

But can I make that:

$path_array[tpl] = main
$path_array[ii] = 1
$path_array[pagename] = name.html

Instead?

I'm going to have to do this for every page, so I want to avoid much that
would slow the page down - what do folks think?

regards,
jaxon




On 3/23/01 9:09 PM, "Aaron Tuller" [EMAIL PROTECTED] wrote:

 super easy.
 
 $path_array = explode('/', $REQUEST_URI);
 $numPathElements = count($path_array);
 
 then loop through the elements and do what you need, you might need
 to use strtok() if you're expecting slashes in your arguments.
 
 -aaron
 
 At 8:58 PM -0500 3/23/01, Jaxon wrote:
 how about parsing a url from passing variables like :
 test.php/op/3/op2/6/pagename.html
 
 cannot this be parsed, to let search engines spider past the "?" properly?
 
 regards,
 jaxon
 
 On 3/23/01 7:46 PM, "Richard Lynch" [EMAIL PROTECTED] wrote:
 
  I think you can change the separator in php.ini, and for sure you could do
  it by hand using $PATH_INFO or something.
 
  Personally, my first question would be if the new "standard" is actually
  being used or supported by anybody else...
 
  --
  Visit the Zend Store at http://www.zend.com/store/
  Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
  Volunteer a little time: http://chatmusic.com/volunteer.htm
  - Original Message -
  From: Dave Smith [EMAIL PROTECTED]
  Newsgroups: php.general
  Sent: Saturday, March 17, 2001 10:55 AM
  Subject: [PHP] URL parsing
 
 
  I have heard that the new standard for URLS is ...test.php?op=3;op2=6...
  using the semi colon as a seperator. Is this currently supported by php
  4.0.3?
 
  Cheers
 
  Dave Smith



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

2001-03-23 Thread Jaxon

Oh wait, just do this in my page :

URL - index.php/main/1/pagename.html

$path_array = explode('/', $REQUEST_URI);
   
$tpl  =  $path_array[0];
$ii   =  $path_array[1];
$pagename =  $path_array[2];

that works - sorry for being obtuse.

regards,
jaxon


On 3/23/01 9:30 PM, "Jaxon" [EMAIL PROTECTED] wrote:

 
 Well assuming that this:   index.php/tpl/main/ii/1/pagename/name.html
 is representative of this: index.php?tpl=mainii=1$pagename=name.html
   
 then:
  
 $path_array = explode('/', $REQUEST_URI);
 $numPathElements = count($path_array);
 
 gives me:
 
 $path_array[0] = tpl
 $path_array[1] = main
 $path_array[2] = ii
 $path_array[3] = 1
 $path_array[4] = pagename
 $path_array[5] = name.html
 
 But can I make that:
 
 $path_array[tpl] = main
 $path_array[ii] = 1
 $path_array[pagename] = name.html
 
 Instead?
 
 I'm going to have to do this for every page, so I want to avoid much that
 would slow the page down - what do folks think?
 
 regards,
 jaxon
 
 
 
 
 On 3/23/01 9:09 PM, "Aaron Tuller" [EMAIL PROTECTED] wrote:
 
 super easy.
 
 $path_array = explode('/', $REQUEST_URI);
 $numPathElements = count($path_array);
 
 then loop through the elements and do what you need, you might need
 to use strtok() if you're expecting slashes in your arguments.
 
 -aaron
 
 At 8:58 PM -0500 3/23/01, Jaxon wrote:
 how about parsing a url from passing variables like :
 test.php/op/3/op2/6/pagename.html
 
 cannot this be parsed, to let search engines spider past the "?" properly?
 
 regards,
 jaxon
 
 On 3/23/01 7:46 PM, "Richard Lynch" [EMAIL PROTECTED] wrote:
 
  I think you can change the separator in php.ini, and for sure you could do
  it by hand using $PATH_INFO or something.
 
  Personally, my first question would be if the new "standard" is actually
  being used or supported by anybody else...
 
  --
  Visit the Zend Store at http://www.zend.com/store/
  Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
  Volunteer a little time: http://chatmusic.com/volunteer.htm
  - Original Message -
  From: Dave Smith [EMAIL PROTECTED]
  Newsgroups: php.general
  Sent: Saturday, March 17, 2001 10:55 AM
  Subject: [PHP] URL parsing
 
 
  I have heard that the new standard for URLS is ...test.php?op=3;op2=6...
  using the semi colon as a seperator. Is this currently supported by php
  4.0.3?
 
  Cheers
 
  Dave Smith
 
 


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

2001-03-17 Thread Dave Smith

I have heard that the new standard for URLS is ...test.php?op=3;op2=6... 
using the semi colon as a seperator. Is this currently supported by php 4.0.3?

Cheers

Dave Smith

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