Images Hijacked by Photobucket?

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Wed Jul 26, 2017 6:43 pm

OK I have tidied up the extension to redirect to the locally hosted copies of external images, as saved by the scripts above.

It is mostly based on code that has been in use and tested for about a year, but some parts have been recently rewritten for the new purpose. It is currently running happily on one of my live forums.

The extension can be found at: https://github.com/v12mike/imageredirect

For the purposes of this topic, you only need to enable the extension in the ACP and then in the extensions tab find 'IMAGE REDIRECT'->'Local Image Store Settings' and select 'Enabled' then click the 'Save Local Image Store Settings' button.

Let me know if it works (or not)

Havym
Registered User
Posts: 48
Joined: Sun Jan 29, 2017 3:50 pm
Location: Netherlands
Name: Marco

Re: Images Hijacked by Photobucket?

Post by Havym » Thu Jul 27, 2017 9:09 pm

I'm trying to use the script above but i get these errors. Am i doing something wrong?
Warning: include(../common.php): failed to open stream: No such file or directory in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 15

Warning: include(): Failed opening '../common.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 15

Warning: include(../includes/functions_display.php): failed to open stream: No such file or directory in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 16

Warning: include(): Failed opening '../includes/functions_display.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 16

Warning: include(../includes/functions_posting.php): failed to open stream: No such file or directory in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 17

Warning: include(): Failed opening '../includes/functions_posting.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 17

Warning: include(../phpbb/db/tools/tools_interface.php): failed to open stream: No such file or directory in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 18

Warning: include(): Failed opening '../phpbb/db/tools/tools_interface.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 18

Notice: Undefined variable: table_prefix in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 20

Notice: Undefined variable: table_prefix in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 21

Notice: Undefined variable: db in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 37

Fatal error: Call to a member function sql_query() on null in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 37

mainevette
Registered User
Posts: 67
Joined: Thu Jul 30, 2009 1:30 am
Location: East Waterboro, Maine
Contact:

Re: Images Hijacked by Photobucket?

Post by mainevette » Fri Jul 28, 2017 1:48 am

Hello,

I've also installed the extension and adjusted the settings per the readme file. I've tried running it both with and without the proxy server enabled.

With the extension enabled the stock photobucket "speedometer" image is replaced with a simple icon only, it doesn't display the actual image. A screenshot is provided below. When I click the image link I'm redirected to photobucket's website where it displays the "speedometer" image.

Image
Here's a link to a thread on my forum that had a good number of photos if it helps. I have the extension running but with the proxy server disabled. http://www.forum.corvette-restoration.c ... &start=540

As a last-ditch effort I purged my cache but that didn't work (figured it wouldn't anyhow). Any thoughts?

paul_f
Registered User
Posts: 8
Joined: Thu Jun 18, 2015 7:22 pm
Name: Paul
Contact:

Re: Images Hijacked by Photobucket?

Post by paul_f » Fri Jul 28, 2017 5:18 am

mainevette wrote:
Fri Jul 28, 2017 1:48 am
I've also installed the extension and adjusted the settings per the readme file. I've tried running it both with and without the proxy server enabled. Any thoughts?
Have you extracted the links and downloaded the images that Mike has very kindly supplied?

The extension needs to have the images downloaded onto the server first

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Fri Jul 28, 2017 5:22 am

Havym wrote:
Thu Jul 27, 2017 9:09 pm
I'm trying to use the script above but i get these errors. Am i doing something wrong?
Warning: include(../common.php): failed to open stream: No such file or directory in C:\xampp\htdocs\volvo40forum\forum\extract_external_links.php on line 15
...
The script is not able to open some of the phpBB library files it need in order to run.

It looks like you have not put the script in the correct directory, so you need to move it, or alter the paths in the script.

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Fri Jul 28, 2017 5:33 am

mainevette wrote:
Fri Jul 28, 2017 1:48 am
Hello,

I've also installed the extension and adjusted the settings per the readme file. I've tried running it both with and without the proxy server enabled.

With the extension enabled the stock photobucket "speedometer" image is replaced with a simple icon only, it doesn't display the actual image. A screenshot is provided below. When I click the image link I'm redirected to photobucket's website where it displays the "speedometer" image.

Image
Here's a link to a thread on my forum that had a good number of photos if it helps. I have the extension running but with the proxy server disabled. http://www.forum.corvette-restoration.c ... &start=540

As a last-ditch effort I purged my cache but that didn't work (figured it wouldn't anyhow). Any thoughts?
Do not enable the proxy function unless you have a secure site (using https://) and have a known working secure image proxy server.

Looking at your forum page linked above with the inspect element function of my browser, it shows the new image link as:

Code: Select all

<img src="https://forum.corvette-restoration.com//744eb10dac795a078c9b85e340d669757a799ebc/687474703a2f2f6933342e70686f746f6275636b65742e636f6d2f616c62756d732f643133382f7669746f70617363616c652f436f6e736f6c652532306b69745f7a707365696e736f7768312e6a7067" class="postimage" alt="Image">
which is probably wrong, as it is looking for the image files in your domain root directory. In fact that looks like a camo link, which indicates that you have wrongly enabled the proxy function and that you have either not downloaded the images from photobucket (using the scripts I supplied earlier, or you have not configured the Local Image Path correctly. What is your 'Local Image Store Path' set to in the extension ACP? What is the relative (to forum root) path to the directory where the image files have been saved?

On one of my boards, a link modified by the extension now looks like:

Code: Select all

<img src="https://frenchcarforum.co.uk/forum/images/ext/d389166a50329df89686874142f3c83d" class="postimage" alt="Image">
, and if you take the url part

Code: Select all

https://frenchcarforum.co.uk/forum/images/ext/d389166a50329df89686874142f3c83d
and paste it into a browser, you should see the original image.

Havym
Registered User
Posts: 48
Joined: Sun Jan 29, 2017 3:50 pm
Location: Netherlands
Name: Marco

Re: Images Hijacked by Photobucket?

Post by Havym » Fri Jul 28, 2017 11:17 am

v12mike wrote:
Fri Jul 28, 2017 5:22 am
The script is not able to open some of the phpBB library files it need in order to run.

It looks like you have not put the script in the correct directory, so you need to move it, or alter the paths in the script.
Thanks, the files were in the wrong folder indeed, maybe i missed it where to putt those files.
Now it runs but stops after 150 seconds.
Fatal error: Maximum execution time of 150 seconds exceeded in C:\xampp\htdocs\volvo40forum\forum\scripts\download_external_images.php on line 165
Where can i change the execution time?

Im not a hero with php scripting as you can see :oops:

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Fri Jul 28, 2017 12:02 pm

Havym wrote:
Fri Jul 28, 2017 11:17 am
Thanks, the files were in the wrong folder indeed, maybe i missed it where to putt those files.
Now it runs but stops after 150 seconds.
Fatal error: Maximum execution time of 150 seconds exceeded in C:\xampp\htdocs\volvo40forum\forum\scripts\download_external_images.php on line 165
Where can i change the execution time?

Im not a hero with php scripting as you can see :oops:
I don't know much about php on windows. On linux, I think you can change the timeout by setting an environment variable in the shell where you run the script.

Alternatively, near the top of the script is a definition:
$interval = 20000;

Reduce that number (try 1000), and the script will download images in smaller batches, and you will need to run the script many times, but it will get there...

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4108
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Images Hijacked by Photobucket?

Post by HiFiKabin » Fri Jul 28, 2017 12:37 pm

v12mike wrote:
Fri Jul 07, 2017 6:18 am
I have uploaded my scripts to extract and download photobucket-hosted in-line images at: https://github.com/v12mike/fetch-external-images
<snip>
I have just tried to run this and got the following error:-

screenshot_1.png

Code: Select all


[28-Jul-2017 07:28:08 CST6CDT] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/mronionm/public_html/_hifikabin/scripts/extract_external_links.php:72) in /home/mronionm/public_html/_hifikabin/includes/functions.php on line 1949
Any ideas?

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Fri Jul 28, 2017 2:23 pm

Most likely you have found an image with a vveerryy long url...
At the beginning of the script we set the database field to length 500:

Code: Select all

$sql = 'CREATE TABLE IF NOT EXISTS ' . EXTERNAL_IMAGES_TABLE . ' (
		ext_image_id INTEGER PRIMARY KEY AUTO_INCREMENT,
		status INT(10),
		size INT(10),
		url VARCHAR(500),
		host VARCHAR(100),
		file VARCHAR(100),
		ext VARCHAR(10)
		)';
Maybe you need more, or maybe we should skip images with excessively long urls?

paul_f
Registered User
Posts: 8
Joined: Thu Jun 18, 2015 7:22 pm
Name: Paul
Contact:

Re: Images Hijacked by Photobucket?

Post by paul_f » Fri Jul 28, 2017 3:28 pm

I had the same error for one image. I started the script again and it skipped over it

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4108
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Images Hijacked by Photobucket?

Post by HiFiKabin » Fri Jul 28, 2017 3:53 pm

v12mike wrote:
Fri Jul 28, 2017 2:23 pm
Most likely you have found an image with a vveerryy long url...
At the beginning of the script we set the database field to length 500:

Code: Select all

$sql = 'CREATE TABLE IF NOT EXISTS ' . EXTERNAL_IMAGES_TABLE . ' (
		ext_image_id INTEGER PRIMARY KEY AUTO_INCREMENT,
		status INT(10),
		size INT(10),
		url VARCHAR(500),
		host VARCHAR(100),
		file VARCHAR(100),
		ext VARCHAR(10)
		)';
Maybe you need more, or maybe we should skip images with excessively long urls?
I would say skip. 500 characters is a long url in anyones language

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Fri Jul 28, 2017 6:10 pm

HiFiKabin wrote:
Fri Jul 28, 2017 3:53 pm
I would say skip. 500 characters is a long url in anyones language
I have checked in a small change to the extract external links script so that long urls (more than 500 characters) are skipped

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4108
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Images Hijacked by Photobucket?

Post by HiFiKabin » Sat Jul 29, 2017 8:53 am

Just tired it and ...
General Error
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MAX_URL_LEN), host VARCHAR(100), file VARCHAR(100), ext VARCHAR(10) ' at line 5 [1064]

An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.

v12mike
Registered User
Posts: 402
Joined: Thu Jul 09, 2015 5:03 pm

Re: Images Hijacked by Photobucket?

Post by v12mike » Sat Jul 29, 2017 9:50 am

Sorry about that. I tested one version, then uploaded another. Now fixed.

Post Reply

Return to “General Discussion”