Re: Patterns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/7/07, Steve Marquez <smarquez@xxxxxxxxxxxxxxxxxx> wrote:

 Thank you very much! That worked.

 --
 Steve M.


 on 6/7/07 11:31 AM Daniel Brown (parasane@xxxxxxxxx) wrote:


On 6/7/07, Steve Marquez <smarquez@xxxxxxxxxxxxxxxxxx> wrote:
 >
 >  Is the "installer.php" my form file?
 >
 >  --
 >  Steve M.
 >
 >  on 6/7/07 11:12 AM Daniel Brown (parasane@xxxxxxxxx) wrote:
 >
 >
 > On 6/7/07, Steve Marquez <smarquez@xxxxxxxxxxxxxxxxxx> wrote:
 >  > Greetings. I just want to say thanks for the help over the past couple
of
 >  > days.
 >  >
 >  > I am trying to get a form to delete a file.
 >  >
 >  > If the file ends in .php, then I want it to unlink from a certain
folder.
 >  > However, if the file ends in .html or .htm, I want it to unlink from
 > another
 >  > folder.
 >  >
 >  > Is there any way to do this?
 >  >
 >  > Thanks,
 >  >
 >  > --
 >  > Steve M.
 >  >
 >
 >  <?
 >  $extension =
 >
str_replace('.','',strtolower(strrchr('installer.php',".")));
 >
 >  if($extension == "php") {
 >      // Do your unlink() routine for PHP here.
 >  } elseif(strstr($extension,"htm")) {
 >      // Do your unlink() routine for .htm/.html files here.... will
 >  also do .phtml, etc.
 >  }
 >  ?>
 >
 >
 >

     It's the file for which you want to check the extension.  Sorry
 about that.... I typed the code into the email, then figured I should
 test it, and installer.php was the file I was currently writing in my
 Vim window, so I tested it on that.



   No problemo.  Just remember, only .php files will match the first
case, while anything containing `htm` will be included in the second
case (.htm, .html .phtml, .xhtml, et cetera).  So you may need to
modify it a bit if you have certain cases where you want to remove all
.html files, for example, but not .phtml (an archaic PHP file
extension).

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux