Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   phphq.Net Forums (https://novahq.net/forum/forumdisplay.php?f=277)
-   -   phpuploader to use phpbb session tables (https://novahq.net/forum/showthread.php?t=46829)

blade x 08-04-2012 10:23 AM

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();
?>


Scott 08-08-2012 03:18 PM

I think the easiest thing to do is to just integrate the phpbb sessions into the phuploader.php file and if they aren't logged in, redirect them to the phpbb login. Sort of like you already have it. You could also make the script look like your forums by modifying the actual HTML within the phUploader.php script. Although it would be static..

blade x 08-14-2012 07:13 PM

Done i went your first way as its only one file and every thing works well :clap2:


All times are GMT -5. The time now is 01:59 PM.

Powered by vBulletin®