View Single Post
  #1  
Old 08-04-2012, 10:23 AM
blade x is offline blade x
Registered User

Join Date: Aug 2012
Posts: 3

phpuploader to use phpbb session tables

Hi

I would like to say what a cool addon to any forum software this is i have searched high and low for an uploader that gives a link to the selected uploaded file/image.

Now lets get right to it

i dont want to use the password feature as i really thinks it sux as the password could be handed out to any one (forum members pass it on to friends)

so the solution is to create a custom page using phpbb and then insert your script in to the html file (for phpbb custom page)

now the down fall is your script will not run from a html file

so the solution is to make a index1.php and place the below code in it (it will check if the user is logged in and if not force them to login to phpbb)

the below snipp needs a html file
once you get passed the phpbb's login box your pushed to the upload box


PHP Code:
<?php
define
('IN_PHPBB'true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);

//Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
if (
$user->data['user_id'] == ANONYMOUS)
{
    
login_box(''$user->lang['LOGIN']);

page_header('Title Here');

$template->set_filenames(array(
    
'body' => 'dummy_body.html',
));

ob_start();

include(
'upload.php');

$template->assign_var('CONTENT'ob_get_clean());

page_footer();
?>
so now we need a html file so we make a dummy_body.html file and place it in the right location using the code below
PHP Code:
<!-- INCLUDE overall_header.html -->

{
CONTENT}

<!-- INCLUDE 
overall_footer.html --> 
and now for your script in a .php file

it works but it pulls the forum page all to the left and looks a mess

so the question is how can this snippet below be worked in to your script without the need for a html file that in turn would stop the forums theme being used and with out breaking the uploader ?

PHP Code:
<?php
define
('IN_PHPBB'true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
if (
$user->data['user_id'] == ANONYMOUS)
{
    
login_box(''$user->lang['LOGIN']);


page_header('Title Here');

$template->set_filenames(array(
    
'body' => 'yourpage_body.html',
));

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
Reply With Quote