accessing files

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

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

accessing files

Post by psychotomus »

how can I access files that are below a directory?

like

main folder -> second folder -> third folder

how could i access files in the second and main folder if theres a script in third folder?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

../
moves back/up one directory level.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

feyd wrote:

Code: Select all

../
moves back/up one directory level.
what about 2 directorys back?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

../../
aso,aso,aso
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

How can I block someone from accessing back directorys?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make sure their permissions don't allow it. This can be done through .htaccess in the apache supported systems.. or through the ACL in Windows machines.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

could you give me an example? should permissions be set on folder?

how could I use htaccess. also, if htaccess is used. is there a way to set the htaccess file so it can't be accessed from the folder?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://httpd.apache.org/docs/howto/htaccess.html

have a read. Should also be able to do it through CHMOD.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

what should I CHMOD the directory to? 750? 600?
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

Post by thegreatone2176 »

chmod will work or if you have some thing setup such as site.com/viewpage.php?page=

you can just str_replace . and / and they wont be able to go back directorys
Post Reply