PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Tue Dec 20, 2005 9:36 am
Can you use unlink() to delete the file it was called in or will this file be open read only?
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Tue Dec 20, 2005 9:42 am
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Tue Dec 20, 2005 9:43 am
I take it that you cant on linux. My server is running linux.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Tue Dec 20, 2005 9:47 am
php3ch0 wrote: I take it that you cant on linux. My server is running linux.
I get a permission denied error on Linux. I take it you're writing an install script?
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Tue Dec 20, 2005 9:50 am
Yes I need it to delete itseslf after installing.
Corvin Gröning
Forum Newbie
Posts: 16 Joined: Tue May 03, 2005 1:02 pm
Post
by Corvin Gröning » Tue Dec 20, 2005 10:10 am
Why you don't do it like in other install scripts? Simply display a message that the actual file should be deleted because of security issues...
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Tue Dec 20, 2005 1:35 pm
What Ive seen other scripts do is check for the existance of the install files prior to allowing the execution of any code.
Code: Select all
if (file_exists('/installation/install.php')) {
die ('Please delete the .... because.. security.. blah');
}
php3ch0
Forum Contributor
Posts: 212 Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK
Post
by php3ch0 » Wed Dec 21, 2005 3:12 am
That will definately work. I was hoping to do it automatically to save any extra work for the user.
Thanks people