Question
I can modify language files, but I can modify "load.php" correctly :oops: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 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!
30 secs :mrgreen:
grz
hotschi
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);
}
?>
hotschi