Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Posts
    140
    Thanks
    52
    Thanked 0 Times in 0 Posts

    loggen-in status

    anyone here can share the code for logged-in status??

    heres the my code

    <form action="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login" method="post">
    <h3><a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login">Login</a> • <a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=register">Register</a></h3>
    <fieldset>
    <label for="username">Username:</label>
    <input type="text" name="username" id="username" size="10" title="Username" />
    <label for="password">Password:</label>
    <input type="password" name="password" id="password" size="10" title="Password" />
    <label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" /></label>
    <input type="submit" name="login" value="Login" />
    </fieldset>
    <input type="hidden" name="redirect" value="http://romelad.freehostia.com" />
    </form>

    I redirect the user logged-in at http://romelad.freehostia.com not at he forum board and when I logged in the logged-in or online status didn't show.


    can you please share your additional code to show the online status when I log-in.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    phpbb3 uses PHP sessions to keep track of the users that are logged-in.
    Outside of phpbb3, you can still use their sessions to check if the user is logged-in.

    So, without testing anything ... I'm thinking you might put the code below at the
    top of any pages you wish to check ... outsite of phpbb3:

    PHP Code:
    <?php
    session_start
    ();
    define('IN_PHPBB'true);
    $phpbb_root_path './phpbb3/';
    $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['is_registered']){
    echo(
    '<span style="font-size:13pt; font-weight:bold; color:#d31044;">Welcome Back '.$user->data['username'].'! </span> &nbsp; | &nbsp; <a href="' append_sid("{$phpbb_root_path}ucp.$phpEx"'mode=logout'true$user->session_id). '" class="textlink">Log out</a>');
    echo
    "<br />";

    // include whatever pages or files you want ... where the user is logged-in.

    }
    else{

    // the user is not logged-in, so give them a login page, or kick them out.

    }
    ?>

  • Users who have thanked mlseim for this post:

    finoy_ako (02-19-2010)

  • #3
    Regular Coder
    Join Date
    Jan 2010
    Posts
    140
    Thanks
    52
    Thanked 0 Times in 0 Posts
    thanks sir, you helped me a lot, but the thing is the input box for log-in and password is still there even they show me the words welcome back.

    please try to register and log-in to see the problem.
    link
    http://romelad.freehostia.com

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    You'll have to show us the script (file) for that page, so we can see why
    the login-box still shows. There must be an "if" statement missing or misplaced.

  • #5
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts
    You could use this:
    PHP Code:
    <form action="ucp.php?mode=login" method="post"
    instead of this:
    PHP Code:
    <form action="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login" method="post"
    if php script is in the same page as form.

    Also, can you tell me about the online thing? When the program will tell if user is online? I see that you send just a word "online", but there must be more difficult code in the online system. I can say some examples later if you want.

  • Users who have thanked auriaks for this post:

    finoy_ako (02-19-2010)

  • #6
    Regular Coder
    Join Date
    Jan 2010
    Posts
    140
    Thanks
    52
    Thanked 0 Times in 0 Posts
    heres my code

    Code:
    <?php
    session_start();
    define('IN_PHPBB', true);
    $phpbb_root_path = './phpbb3/';
    $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['is_registered']){
    echo('<span style="font-size:13pt; font-weight:bold; color:#d31044;">Welcome Back '.$user->data['username'].'! </span> &nbsp; | &nbsp; <a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '" class="textlink">Log out</a>');
    echo"<br />";
    
    // include whatever pages or files you want ... where the user is logged-in.
    
    }
    else{
    
    // the user is not logged-in, so give them a login page, or kick them out.
    
    }
    ?> 
    
    
    
    <form action="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login" method="post">
    <h3><a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login">Login</a> • <a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=register">Register</a></h3>
    <fieldset>
    <label for="username">Username:</label>
    <input type="text" name="username" id="username" size="10" title="Username" />
    <label for="password">Password:</label>
    <input type="password" name="password" id="password" size="10" title="Password" />
    <label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" /></label>
    <input type="submit" name="login" value="Login" />
    </fieldset>
    <input type="hidden" name="redirect" value="http://romelad.freehostia.com" />
    </form>






    Quote Originally Posted by mlseim View Post
    You'll have to show us the script (file) for that page, so we can see why
    the login-box still shows. There must be an "if" statement missing or misplaced.
    Sir mlseim the script I use is in my first post and I added your script too.


    sir auriaks I just followed the tutorial link below and they say I need to change phpBB3 to whatever folder my forum is in.

    http://wiki.phpbb.com/Practical.External_login

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 Posts
    Try this:

    PHP Code:
    <?php
    session_start
    ();
    define('IN_PHPBB'true);
    $phpbb_root_path './phpbb3/';
    $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['is_registered']){
    echo(
    '<span style="font-size:13pt; font-weight:bold; color:#d31044;">Welcome Back '.$user->data['username'].'! </span> &nbsp; | &nbsp; <a href="' append_sid("{$phpbb_root_path}ucp.$phpEx"'mode=logout'true$user->session_id). '" class="textlink">Log out</a>');
    echo
    "<br />";

    // user is logged-in

    }
    else{

    // user is NOT logged-in, so display the login form ...
    ?>

    <form action="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login" method="post">
    <h3><a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=login">Login</a> • <a href="http://romelad.freehostia.com/phpbb3/ucp.php?mode=register">Register</a></h3>
    <fieldset>
    <label for="username">Username:</label>
    <input type="text" name="username" id="username" size="10" title="Username" />
    <label for="password">Password:</label>
    <input type="password" name="password" id="password" size="10" title="Password" />
    <label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" /></label>
    <input type="submit" name="login" value="Login" />
    </fieldset>
    <input type="hidden" name="redirect" value="http://romelad.freehostia.com" />
    </form>

    <?php
    }
    ?>

  • Users who have thanked mlseim for this post:

    finoy_ako (02-20-2010)

  • #8
    Regular Coder
    Join Date
    Jan 2010
    Posts
    140
    Thanks
    52
    Thanked 0 Times in 0 Posts
    thanks sir its now working, I just forgot to combine the code. hehe.

    thanks again sir.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •