Jump to content

Using cookies in my PHP script.


feddonish

Recommended Posts

Im using a moodle platform, and ive noticed that if i open my profile picture, the link is like this:

http://randomwebsite.com/moodle/user/pix.php/12345/f1.jpg

 

Ive also noticed that if i change those numbers in the link, i get other peoples profile pictures., if they have uploaded one, else i get the default picture.

What i want to do is to create a script that goes through all those and saves them on my computer. ive tried creating with Java and one in PHP. but the problem is that i always end up with a load of default picture instead of the real ones, and ive come to the conclusion that it is because of the cookies not existing in those scripts and thus not having permissions to see them.

 

i could go manually through them in my browser tab where im logged in and save them, but i ask you if you know any way i can make my scripts work, or something else that could automatize this task.

 

i think ive included everything, thanks in advance!  :)

 

Link to comment
Share on other sites

forgot to add. the code i use for saving the files is:

<?php
header('Content-disposition: attachment; filename=f1.jpg');
header('Content-type: image/jpeg');
readfile('http://randomwebsite.com/moodle/user/pix.php/12345/f1.jpg');
?>

 

i have not included the loop yet, but that is irrelevant atm.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.