Download bug

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
hello I found a bug in the download if I copy a download link for a premium account I little run directly from another pc another ip without even his return to me why his page normally it will have refused Download
 

ysmods

New Member
Jan 29, 2013
860
1
0
UK
www.ysmods.com
The file edit is NOT guaranteed to work, however it did stop the immediate downloading of files without a token on my dev site.

Open /includes/class.file.php

Find:
Code:
// remove session
if (isset($_SESSION['showDownload']))
{
	$clearSession = true;

	// fixes android snag which requests files twice
	if (deviceIsAndroid())
	{
		if (!isset($_SESSION['showDownloadFirstRun']))
		{
			$_SESSION['showDownloadFirstRun'] = true;
			$clearSession                     = false;
		}
		else
		{
			$_SESSION['showDownloadFirstRun'] = null;
			unset($_SESSION['showDownloadFirstRun']);
		}
	}

	if ($clearSession == true)
	{
		// reset session variable for next time
		$_SESSION['showDownload'] = null;
		unset($_SESSION['showDownload']);
		session_write_close();
	}
}
REPLACE WITH:
Code:
// remove session
if (isset($_SESSION['showDownload']))
{
	$clearSession = true;

	// fixes android snag which requests files twice
	if (deviceIsAndroid())
	{
		if (!isset($_SESSION['showDownloadFirstRun']))
		{
			$_SESSION['showDownloadFirstRun'] = true;
			$clearSession                     = false;
		}
		else
		{
			$_SESSION['showDownloadFirstRun'] = null;
			unset($_SESSION['showDownloadFirstRun']);
		}
	}

	if ($clearSession == true)
	{
		// reset session variable for next time
		$_SESSION['showDownload'] = null;
		unset($_SESSION['showDownload']);
		session_write_close();
	}
}
if(!$downloadToken || empty($downloadToken))
{
	output404();
}
 

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
thank you can already corrected but I can copy the link to a page and download the same link type instead of sharing the link to the person see the pub
 

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
normally if not the same ip should return to the download page for the free use voi the pub otherwise unprofitable
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Morning all,

This has been patched to the latest release code and will be documented for the v4.0 release. To manually patch, open:

includes/class.file.php

Find: (around line 51)

Code:
if ($downloadToken != null)
Replace with:

Code:
if ($downloadToken !== null)
(note the extra equals)

As usual, drop me an email if you need any help :)

Thanks,
Adam.
 

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
ok look i can download
[removed]

Can I download directly to this thread without even going through the pub page on my website
Version 4 will fix this?
when it comes out because I think this major flaw since I found many site providing direct links
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
That's correct. It's a download token which is valid for 24 hours. So you can reuse it. If you search in includes/class.file.php for:

Code:
$tokenData =
You'll see the commented out line to restrict by IP. Feel free to use. We've had some issues as people often change their IPs while downloading a large file. Your other option it to reduce how long the tokens last.

There's no plans to change this for v4.
 

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
but the link good and yesterday when I put the post
[removed]

in the database if I click on the link it generates a token in the token download page and download tracker
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
This is a different issue. Can you raise a support ticket please and list in detail the problem.
 

dfdssfsfd3806

Member
YetiShare User
Apr 4, 2014
271
0
16
if I put her
Code:
<?php echo $file->generateDirectDownloadUrlForMedia(); ?>
is good but the free user download unlimited speed

if iput her
Code:
 '.$file->getFullShortUrl(true).'?df=1&dt='.$embedToken.'
limit its non-premium members, but it will keep the link active all the time so the problem I