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

2003-09-17 Thread Steve Jackson
nged explorer. Steve Jackson Web Development and Marketing Manager Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 > -Original Message- > From: Steve Jackson [mailto:[EMAIL PROTECTED] > Sent: 17. syyskuuta 2003 13:53 > To: 'PHP

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

Re: [PHP] Getting part of a string

2002-09-27 Thread Justin French
Assuming that it will always be in this format (/something/what you want/...), explode() the string by '/' into an array, and get the right element back. Enjoy Justin French on 28/09/02 1:23 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > > I've got a situation where I need to pull a s

RE: [PHP] Getting part of a string

2002-09-27 Thread Ford, Mike [LSS]
-Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] I've got a situation where I need to pull a string from a variable but I can't seem to get it figured out. I.e. value of $a = /realtor/Remax/Ed/files/ I need to get the string between the second and third / (slash) What

Re: [PHP] Getting part of a string

2002-09-27 Thread debbie_dyer
I'm not an expert on regex but this seems to work:- ereg("^/[^/]*/([^/]*)/.*$", "/realtor/Remax/Ed/files/", $regs); if (isset($regs[1])) { print $regs[1]; } Debbie - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 4:23 PM Su

Re: [PHP] Getting part of a string

2002-09-27 Thread Marek Kilimajer
reg_match('^/[^/]*/([^/]*)/',$a, $match) $match[1] should contain what you need [EMAIL PROTECTED] wrote: >I've got a situation where I need to pull a string from a variable but I >can't seem to get it figured out. > >I.e. > >value of $a = /realtor/Remax/Ed/files/ > >I need to get the string be

Re: [PHP] Getting part of a string

2001-01-20 Thread Website4S
In a message dated 21/01/2001 03:43:19 GMT Standard Time, [EMAIL PROTECTED] writes: << if( eregi( "^([^@]+)@([^@]+)$", $email, $match)) { $email_user = $match[1]; $email_domain = strtolower( $match[2]); echo "$email_user at $email_doma

Re: [PHP] Getting part of a string

2001-01-20 Thread Markus Fischer
On Sat, Jan 20, 2001 at 09:10:45PM -0500, [EMAIL PROTECTED] wrote : > I have a form which users enter their email address, once submitted I need a > way to chop it up and put it in lowercase. So that if a user submits > [EMAIL PROTECTED] I want PHP to throw out Website4S and then make the rest