javascript - (Web application) How to restrict user from accessing certain folder through typing in the web address -


currently building web page allows user upload pictures server. user can upload pictures if login.

the pictures uploaded stored in server example: pictures/"userid"/some_pictures.jpg

my question how restrict other users accessing some_pictures.jpg or "userid" folder by typing url address. user login userid can access it's own folder or pictures.

for example: user has login $_session['userid'] = 1234. user can access directory > pictures/1234/some_pictures.jpg if user login 1235 userid, won't able access 1234/ directory

you create function checks if user logged in or not.if not logged in, redirect him login page.now if user logged in, check if user id equal user id in pictures/"userid"/some_pictures.jpg. if turns false, redirect him page such homepage.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -