danielcopelandnz56
New Member
- Messages
- 9
- Reaction score
- 0
- Points
- 0
OK. The problem I have is this.
I have two main sections on my website so far: the public part, which anyone can access, and a password-protected directory.
The idea is that I'll put public pages in the public part, and admin pages in the protected directory. Admin pages will have functions for saving new files to the site.
Well, it's easy enough in PHP to save new files within the protected directory. You just give the new file name, e.g. "wibble.html", and you end up with a page like "www.mydomain.com/passwordplease/wibble.html".
And it's easy enough to put a script in the public part of the site which, when accessed, moves "passwordplease/wibble.html" to "wibble.html" -- that is, it moves it out of the protected directory.
But that's a serious security hole; if you knew about the page, you could move files out of the "passwordplease" directory without logging in.
And I can't figure out how to do either of the following:
EDIT: In case it's relevant and not clear: I made "passwordplease" a password directory using cPanel.
I have two main sections on my website so far: the public part, which anyone can access, and a password-protected directory.
The idea is that I'll put public pages in the public part, and admin pages in the protected directory. Admin pages will have functions for saving new files to the site.
Well, it's easy enough in PHP to save new files within the protected directory. You just give the new file name, e.g. "wibble.html", and you end up with a page like "www.mydomain.com/passwordplease/wibble.html".
And it's easy enough to put a script in the public part of the site which, when accessed, moves "passwordplease/wibble.html" to "wibble.html" -- that is, it moves it out of the protected directory.
But that's a serious security hole; if you knew about the page, you could move files out of the "passwordplease" directory without logging in.
And I can't figure out how to do either of the following:
- (my preferred option) -- put the mover script inside the "passwordplease" directory; it won't let you write to a URL beginning with "http://", and any partial URL you try and copy the new file to still will end up in "passwordplease"; or
- (if there's no easy way to do that) -- put a script in the public "movepage.php" script that checks whether you are logged in to "passwordplease" and won't move anything if you aren't; it doesn't appear in $_SESSION.
EDIT: In case it's relevant and not clear: I made "passwordplease" a password directory using cPanel.
Last edited: