RE: [PHP] Getting part of a string...Was protecting a file via php

2003-09-17 Thread Steve Jackson
General'; 'Jon Haworth' > Subject: RE: [PHP] Getting part of a string...Was protecting > a file via php > > > Thanks to all so far. > However I am still having problems I have directory outside > the root with PDF's in it. The links to the PDF files ar

RE: [PHP] Getting part of a string...Was protecting a file via php

2003-09-17 Thread Steve Jackson
Thanks to all so far. However I am still having problems I have directory outside the root with PDF's in it. The links to the PDF files are called successfully by this function in a page I call getlinks.php function do_non_root_links() { define('FILEDIR', '/home/.sites/144/site281/downloads/'); /

Re: [PHP] Getting part of a string...Was protecting a file via php

2003-09-16 Thread Curt Zirzow
* Thus wrote Jon Haworth ([EMAIL PROTECTED]): > Hi Steve, > > > $pfile = str_replace('get.php?file=','','$file'); > > $p = explode('.', $pfile); > > // How do I say look at the extension and put it into the switch? > > $extension = $p; > > // end of the bit I'm stuck on. > > At this point $p is a

Re: [PHP] Getting part of a string...Was protecting a file via php

2003-09-16 Thread Jason Wong
On Tuesday 16 September 2003 21:24, Jon Haworth wrote: > At this point $p is an array rather than a variable, so you'll need to get > the last element of $p.Try something like this: > > $p = explode('.', $pfile); > $extension = $p[sizeof($p)-1]; Better still, use array_pop(). -- Jason Wong -> G

Re: [PHP] Getting part of a string...Was protecting a file via php

2003-09-16 Thread Jurgens du Toit
If you use pathinfo($pfile), you'll get an array with the dirname, basename and extension... Jrgns -- <>< [EMAIL PROTECTED] 083 511 7932 "For those who believe no evidence is necessary. For those who don't, no evidence would suffice." -- PHP General Mailing List (http://www.php.net/) To unsubscri

Re: [PHP] Getting part of a string...Was protecting a file via php

2003-09-16 Thread Jon Haworth
Hi Steve, > $pfile = str_replace('get.php?file=','','$file'); > $p = explode('.', $pfile); > // How do I say look at the extension and put it into the switch? > $extension = $p; > // end of the bit I'm stuck on. At this point $p is an array rather than a variable, so you'll need to get the last e

[PHP] Getting part of a string...Was protecting a file via php

2003-09-16 Thread Steve Jackson
OK, After much headbanging I figured out the first part of my problem. I want to retrieve a file from behind the webroot and to do this I need to send headers. This should be a simple case of finding out what the file is called (its extension) and sending the headers via a switch depending on what