RhysAndrews Posted December 23, 2008 Share Posted December 23, 2008 Hey guys! I'm slowly tugging away at a system for a client - this is the first time I've used MySQL, and the first time I've really dived into PHP. I'm using a gallery called 'saurdo gallery' - google it for more information if you need. It finds photos within a directory, and resizes them to thumbnail views, then uses a nice smooth ajax shell to show them / allow the user to scroll through them and such (it uses lightbox). One of the variables that saurdo gallery uses is $gallery_address. Usually you just enter something like "/photos/" and it'll look for images within photos (and its subdirectories). However, I am creating directories for each client that can login, with their own photos in there. I use this code to set the directory: $gallery_address = "/../private/".$_SESSION['email']."/"; //Find the directory depending on who you're logged in as! This seems to work on saurdo-gallery's detection side - it finds all the images and their filenames. However, instead of showing thumbnails of the images, it shows 0x0 images (and so there is just a little square which is the border). When you click to see the full-size image, it takes me to the wrong directory. It takes me to: http://site.com/private/user/thephoto.jpg instead of http://site.com/../private/user/thephoto.jpg. I fear this is the reason why: All the client photo directories are stored in the root of the server - before public_Html, and in a 'private' folder. This stops people being able to see the photos without logging in. However, it is clearly also stopping the gallery from showing them on the webpage. Is this an easy fix? Somebody suggested using htaccess files and then just placing the directories after public_Html, however I do not know how to use htaccess files. Could somebody help me to resolve this issue? I really appreciate it! Regards Rhys Andrews Link to comment https://forums.phpfreaks.com/topic/138146-stuck-using-saurdo-gallery-and-sessions/ Share on other sites More sharing options...
ratcateme Posted December 23, 2008 Share Posted December 23, 2008 you cannot get to directories outside public_html http://site.com/../private/user/thephoto.jpg is a invalid URL. you need to find a new way properly with htaccess or a far more advanced script with a big user system that if you are a beginner would be hard to implement. Scott. Link to comment https://forums.phpfreaks.com/topic/138146-stuck-using-saurdo-gallery-and-sessions/#findComment-722121 Share on other sites More sharing options...
RhysAndrews Posted December 23, 2008 Author Share Posted December 23, 2008 Thanks for the clarification. Is there any simple method to protect directories from being accessed unless logged in? I am new to this but am very keen to know what the big companies do. -Rhys Link to comment https://forums.phpfreaks.com/topic/138146-stuck-using-saurdo-gallery-and-sessions/#findComment-722128 Share on other sites More sharing options...
ratcateme Posted December 23, 2008 Share Posted December 23, 2008 the big sites create a big application where it is all linked to a database and sessions. so every user has to be logged in and there login is check on every page. and so rather than having a separate directory for each user. you store all the images in a database and store a user ID with them. then when the user logs in you can get the us ID and store it with session then you get the images with that. and you have to create your own gallery. Scott. Link to comment https://forums.phpfreaks.com/topic/138146-stuck-using-saurdo-gallery-and-sessions/#findComment-722133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.