Question

Enthält archivierte Beiträge von Hotschi's Board zum Download MOD.
Posten ist hier nicht möglich, bitte das Supportforum dafür verwenden!
Gesperrt
Anonymous

Question

Beitrag von Anonymous »

I have a host for the forum and another host for the downloads.

Is it possible to have deductions for external downloads too? I can't put downloads into the same host of the forum :( :( :(
Hotschi

Beitrag von Hotschi »

it should be possible with some changes in load.php (and of course in the language- files etc. because of the descriptions...).

are you familiar with php?
Anonymous

Beitrag von Anonymous »

Hotschi hat geschrieben:it should be possible with some changes in load.php (and of course in the language- files etc. because of the descriptions...).

are you familiar with php?
I can modify language files, but I can modify "load.php" correctly :oops:

I have a host for the forum board and another for the download files (mp3s/images)

I'd like to protect my external files with the .htaccess file. If the .htaccess and the download files are on my "forum server" works correctly, but If I put this file on my other server ("download server") I can't download files from the page of the download mod on my "forum server" :( :(

Could you tell me how I can modify the code of the download page for "external" downloads with the protection of the htaccess file?

The bandwitch of my "download server" is limited and I only can allow downloads from my forum board.

Thanks a lot, your mod is great!
Hotschi

Beitrag von Hotschi »

to modify load.php, to have deductions for external downloads should be no problem, but i do not know if it is possible to download from another server, if the directory is .htaccess protected...
Anonymous

RE

Beitrag von Anonymous »

Hotschi hat geschrieben:to modify load.php, to have deductions for external downloads should be no problem
Could you modify it, please? I have tried to modify load.php to have deductions but my php is not very good :cry: :cry: :cry:
Hotschi

Beitrag von Hotschi »

30 secs :mrgreen:

Code: Alles auswählen

<?php 
$download_dir = "media"; 

define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_DOWNLOADS);
init_userprefs($userdata);
//
// End session management
//

$sql = "SELECT file_name, free, extern FROM " . DOWNLOADS_TABLE . " WHERE id = '$id'"; 
$result = mysql_query($sql);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) 

   { 
   $file_name = $row[file_name]; 
   $file_free = $row[free]; 
   $file_extern = $row[extern]; 
   } 

if ( $file_extern == "0") 
   { 
   $file_size = filesize($download_dir . $file_name); 
   } 

$user_id = $userdata['user_id'];

$sql = "SELECT user_traffic FROM " . USERS_TABLE . " WHERE user_id = '$user_id'"; 
$result = mysql_query($sql);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

	{
	$user_traffic = $row[user_traffic];
	}

if ( $file_free == "1")
	{
	$query_klicks = "UPDATE " . DOWNLOADS_TABLE . " SET klicks=klicks+1 WHERE id = '$id'";
	$result_klicks = mysql_query($query_klicks);
	}

if ( $userdata['session_logged_in'] AND $user_traffic > $file_size AND $file_free == "0")
	{
	$query_traffic = "UPDATE " . USERS_TABLE . " SET user_traffic=user_traffic-" . $file_size . " WHERE user_id = '$user_id'"; 
	$query_klicks = "UPDATE " . DOWNLOADS_TABLE . " SET klicks=klicks+1 WHERE id = '$id'";
	$result_traffic = mysql_query($query_traffic);
	$result_klicks = mysql_query($query_klicks);
	}

if ( $file_extern == "1" )
	{
	Header("Location: $file_name");
	}

if ( $file_free == "1" OR ( $userdata['session_logged_in'] AND $user_traffic > $file_size) )
	{
	header("Content-Type: application/octet-stream");
	header("Content-Disposition: attachment; filename=\"$file_name\"");
	readfile($download_dir . "/" . $file_name);
	}

?>
grz
hotschi
Hotschi

Beitrag von Hotschi »

Sorry.

Of course <? and ?> :-)
Anonymous

RE

Beitrag von Anonymous »

THANKS A LOT!!!!!!!!!!!

You are the best!! :wink:
Gesperrt