[PHP] delete and recreate

2011-11-09 Thread Kirk Bailey
So, I want to create a script to delete an old file and create a new 
one which is empty. The script receives a password via query string. 
The obvious methods give me back a very useless 500 error. Any 
suggestions on how to accomplish what I seek?


--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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



[PHP] Re: delete and recreate

2011-11-09 Thread Jim Giner
This really doesn't tell me what you are trying to do. 



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



Re: [PHP] delete and recreate

2011-11-09 Thread Stuart Dallas
On 9 Nov 2011, at 15:35, Kirk Bailey wrote:
 So, I want to create a script to delete an old file and create a new one 
 which is empty. The script receives a password via query string. The obvious 
 methods give me back a very useless 500 error. Any suggestions on how to 
 accomplish what I seek?


First of all you need to sort out your development environment. Getting a 500 
response from the server suggests that your server is set up to hide PHP error 
messages from you. Are you, perchance, using Windows? I don't know what you 
need to tweak to get it to show you PHP errors but others here may be able to 
help you with that.

As far as your task goes it seems pretty straightforward. Use unlink() to 
delete the existing file if file_exists() returns true, then use touch() to 
create the new, empty file. Simples.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] delete and recreate

2011-11-09 Thread Adam Richardson
On Wed, Nov 9, 2011 at 10:35 AM, Kirk Bailey kbai...@howlermonkey.netwrote:

 So, I want to create a script to delete an old file and create a new one
 which is empty. The script receives a password via query string. The
 obvious methods give me back a very useless 500 error. Any suggestions on
 how to accomplish what I seek?

 --
 end

 Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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


Make sure PHP has the permissions needed to delete and create files in the
directory.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] delete and recreate

2011-11-09 Thread Jim Giner
Is anyone concerned about the OP's original statement about receives a 
password via query string.  Perhaps that is his problem since he did 
mention it?  I didn't attempt to answer it because I didn't know what/why he 
was prompting for a password. 



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



Re: [PHP] delete and recreate

2011-11-09 Thread Jim Lucas
On 11/9/2011 7:35 AM, Kirk Bailey wrote:
 So, I want to create a script to delete an old file and create a new one which
 is empty. The script receives a password via query string. The obvious methods
 give me back a very useless 500 error. Any suggestions on how to accomplish 
 what
 I seek?
 

First, please include the at minimum the following information when asking a
question about a problem that you are having.

1) Operating System (Windows, Linux, etc...)
2) Web server type and version
3) PHP Version ( and how it is loaded in the web server )
3) Example code that you have tried.
   a) What the code is doing.
   b) What you expect the code to be doing.

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

H - (541) 323-4219
C - (541) 408-5189
O - (541) 323-9113

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