Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About MacroCurse

  • Rank
  1. thank you , but i take it you know iam new to php . and nor can i make anything out of the code you did above nor can i find anything on the piece of code this is the main php side what about the fetcher side what do i change thier aside from removing the session and this is in the end not the main issue i want to know if there is any way i can protect my images folder from outsiders and only accessable from one php page or only from local(host server)
  2. this $imgs is done via preg_grep(which works as i want it to)
  3. Alright here is all the details you asked about if i missed something please let me know 1 - what is the URL to the mages : from the php file that echos images its like so ../images/(4 sub folders here) and the password protection should start from /images 2 - the script that would fetch the images and send them into page that prints images (from now i will call echo print in this thread) is located inside the /images folder 3 - code for fetcher php which sends the images back to the printing page ----------------------------------------- <?php //start session to check if user typed url session_start(); if (!isset($_SESSION['Confidental'])) { header("LOCATION: ../index.php?error=testnumber34"); exit(); }else{ $img = $_SESSION["Confidental2"]; $image = $_GET["image"]; $file = "subfolderinsideimagesfolder/" . $img; header('Content-Type: image/jpg'); header("Content-Length: " . filesize($file)); readfile($file); unset($file); } ?> -------------------------- 4 - the code for outputing(printing the images) ------------------------- foreach ($imgs as $img) { //placed here $_SESSION["Confidental2"] = $img; echo '<img class= "resimg" src="../lmages/fetcher.php/"> <br> <br>'; //placed here too } its inside a loop because i want to know how many images this user has and print all their images (no worries about this this part works as i want it to) however here is another issue the $_SESSION["Confidental2"] is how i tell the fethcer.php which image to print but for some reason it just out puts only one of them even tho i have tried UNSET function in the foreach loop (placed in the //coment areas and tested but no luck PS: 1 at a time not both together)
  4. Thank you for the replay yes i can . I have done the script to send images back to my pagethatechosimages.php However once in restrict access to the protected folder with htaccess it does not want to work. I have done same thing with the database connection php restrict all access to it and include_once which works fine. But for the script that sends images it does not work when i use htaccess on that folder but works fine other way. Another detail is the database conn php and the page which echos images are in same directory but the script that sends images is in diffrent directory . I have tested require and include but non works . And i have placed correct path too in require/include eg '../example/script.php' Edit. Well by it does not want to work it downloads the page the echos images lmao. Iam really new to this sorry
  5. Thank you for the replay. Newbie here going to ask again i thinkni should gove more details. Firstly i cant place those said files outside of public folder since for the time being iam on a free host. Second i have already filtered wether user is valid to get image after loging in. Both of above filters coming from sql database then after if user is valid insearch for all images that belong to the user which is thier login username-n.jpg and can echo the images fine . However i want to a. Redirect all access to the images except a refer from the php that echos out the images (not preferd) Or b. Password protect the folder and send out images with script back to the php file which echos the images(would love to do it this way) Now my question is can i send the image names back to fetcherscript.php soni dont do all that proccess over there or i have to. Thanks in advance
  6. Hello first time poster here . Soni have been in the proccess of designing a website that would give images to users . But only owner of an image will get thier own image . And some people may not access thier image whom are invalid untill i make them valid users. Si.my problem is i want to stop people from accessing these images by typing thier mysite.com/path and these files only be accessable via a php that is in my website . How do i go about doing that . Is it iam my new to this or there is not a convenient way to do this . Thanks in advance
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.