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
https://forums.phpfreaks.com/topic/226075-using-cookies-in-my-php-script/
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.

Archived

This topic is now archived and is closed to further replies.

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