FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[RESOLVED] phpbb Help with making an upload script.





Dougie1
Well I would like to make a script that only lets you upload if you are logged in. Is there a statement in phpbb that is like:

if($user_logged_in===true){.....}

if ($user_not_logged_in===false{.....}

Because that is what I would need to do this! Any help would be appreciated. Ta.
ncwdavid
To check if someone is logged in you will need to get phpBB sessions to the upload page you are making so in your upload page/script or whatever put this at the top:

Code:
<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);

    //
    // Start session management
    //
    $userdata = session_pagestart($user_ip, PAGE_INDEX);
    init_userprefs($userdata);
    //
    // End session management
    //
?>


You might have to change the "$phpbb_root_path".

Then to check if the user is logged in use this:

Code:
if($userdata['session_logged_in']){
echo "User Loggeg In!";
}
else{
echo "Not Logged In";
}


Hope that helps!
Dougie1
Fantastic!! Just what I needed. I also see you are from near where I am (well nearer than most people on here).

Anyway. Thanks very much! Very Happy
Related topics
looking for wap upload script
Upload Script
Need help with php script
RESOLVED:phpbb prob...soooo close
Help with upload form script! [RESOLVED]
Upload Script
Need help making logout script
Upload a preset file using PHP
I need a php upload script, NEEDED BADLY
image upload, and return url to image
Need help with PHP script[RESOLVED]
phpbb help EDIT: resolved
How to do an upload script??
Help me upload these files (250 Frih$)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.