Re: [PHP] Unlink question more or less

2002-06-12 Thread Tom Ray

Any word on when glob() will be in the production version?

thanks for the help Miquel.


- Original Message -
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "Tom Ray" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 2:01 AM
Subject: Re: [PHP] Unlink question more or less


> On Tue, 11 Jun 2002, Tom Ray wrote:
> > I want to use unlink() to delete a wildcard, but at the moment I keep
> > getting parse errors. Here's what happening:
> >
> > I'm mucking around with some login stuff, when a user logs in it writes
> > a flat file that collects some information about them, the flat file is
> > created with the name username.dateyeartime Now each time they log in I
> > want to delete that file and replace it with the new file that has the
> > latest dateyeartime ending on it. I've tried unlink (username.*); but
> > that returns an error. Is there a way for unlink() to recongize
> > wildcards? If not how would I do this?
>
> Once glob() makes it into the production version,
>
>   foreach(glob('*') as $f) unlink($f);
>
> Until then, use system('rm *'); or a readdir loop.
>
> unlink() is not the rm command. It's a system call that deletes a specific
> named file.
>
> miguel
>
>


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




Re: [PHP] Unlink question more or less

2002-06-11 Thread Miguel Cruz

On Tue, 11 Jun 2002, Tom Ray wrote:
> I want to use unlink() to delete a wildcard, but at the moment I keep 
> getting parse errors. Here's what happening:
> 
> I'm mucking around with some login stuff, when a user logs in it writes 
> a flat file that collects some information about them, the flat file is 
> created with the name username.dateyeartime Now each time they log in I 
> want to delete that file and replace it with the new file that has the 
> latest dateyeartime ending on it. I've tried unlink (username.*); but 
> that returns an error. Is there a way for unlink() to recongize 
> wildcards? If not how would I do this?

Once glob() makes it into the production version,

  foreach(glob('*') as $f) unlink($f);

Until then, use system('rm *'); or a readdir loop.

unlink() is not the rm command. It's a system call that deletes a specific 
named file. 

miguel


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




RE: [PHP] Unlink question more or less

2002-06-11 Thread John Holmes

Just be aware that if the name is based on the username, it'll be easy
for other people to guess the names of files on your computer and
possibly inject code into it. Just something to be aware of. 

---John Holmes...

> -Original Message-
> From: Tom Ray [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 11, 2002 11:17 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Unlink question more or less
> 
> Yeah they are,  actaully I switched it to a static name and then added
> the time stamp as part of the information I'm gathering. Now I just
> re-write the file on each log in.
> 
> John Holmes wrote:
> 
> >You can't use wildcards. Use a system() or exec() call to do it.
> >
> >Why use the datetime part at all? The usernames are unique, right?
> >
> >---John Holmes...
> >
> >
> >
> >>-Original Message-
> >>From: Tom Ray [mailto:[EMAIL PROTECTED]]
> >>Sent: Tuesday, June 11, 2002 11:06 PM
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP] Unlink question more or less
> >>
> >>I want to use unlink() to delete a wildcard, but at the moment I
keep
> >>getting parse errors. Here's what happening:
> >>
> >>I'm mucking around with some login stuff, when a user logs in it
> >>
> >>
> >writes
> >
> >
> >>a flat file that collects some information about them, the flat file
> >>
> >>
> >is
> >
> >
> >>created with the name username.dateyeartime Now each time they log
in
> >>
> >>
> >I
> >
> >
> >>want to delete that file and replace it with the new file that has
the
> >>latest dateyeartime ending on it. I've tried unlink (username.*);
but
> >>that returns an error. Is there a way for unlink() to recongize
> >>wildcards? If not how would I do this?
> >>
> >>
> >>--
> >>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] Unlink question more or less

2002-06-11 Thread Tom Ray

Yeah they are,  actaully I switched it to a static name and then added 
the time stamp as part of the information I'm gathering. Now I just 
re-write the file on each log in.

John Holmes wrote:

>You can't use wildcards. Use a system() or exec() call to do it.
>
>Why use the datetime part at all? The usernames are unique, right?
>
>---John Holmes...
>
>  
>
>>-Original Message-
>>From: Tom Ray [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, June 11, 2002 11:06 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Unlink question more or less
>>
>>I want to use unlink() to delete a wildcard, but at the moment I keep
>>getting parse errors. Here's what happening:
>>
>>I'm mucking around with some login stuff, when a user logs in it
>>
>>
>writes
>  
>
>>a flat file that collects some information about them, the flat file
>>
>>
>is
>  
>
>>created with the name username.dateyeartime Now each time they log in
>>
>>
>I
>  
>
>>want to delete that file and replace it with the new file that has the
>>latest dateyeartime ending on it. I've tried unlink (username.*); but
>>that returns an error. Is there a way for unlink() to recongize
>>wildcards? If not how would I do this?
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>.
>
>  
>




RE: [PHP] Unlink question more or less

2002-06-11 Thread John Holmes

You can't use wildcards. Use a system() or exec() call to do it.

Why use the datetime part at all? The usernames are unique, right?

---John Holmes...

> -Original Message-
> From: Tom Ray [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 11, 2002 11:06 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Unlink question more or less
> 
> I want to use unlink() to delete a wildcard, but at the moment I keep
> getting parse errors. Here's what happening:
> 
> I'm mucking around with some login stuff, when a user logs in it
writes
> a flat file that collects some information about them, the flat file
is
> created with the name username.dateyeartime Now each time they log in
I
> want to delete that file and replace it with the new file that has the
> latest dateyeartime ending on it. I've tried unlink (username.*); but
> that returns an error. Is there a way for unlink() to recongize
> wildcards? If not how would I do this?
> 
> 
> --
> 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




[PHP] Unlink question more or less

2002-06-11 Thread Tom Ray

I want to use unlink() to delete a wildcard, but at the moment I keep 
getting parse errors. Here's what happening:

I'm mucking around with some login stuff, when a user logs in it writes 
a flat file that collects some information about them, the flat file is 
created with the name username.dateyeartime Now each time they log in I 
want to delete that file and replace it with the new file that has the 
latest dateyeartime ending on it. I've tried unlink (username.*); but 
that returns an error. Is there a way for unlink() to recongize 
wildcards? If not how would I do this?


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