Jump to content

phpBB Login


Rushy

Recommended Posts

Hey all,

 

i'm currently using the following code to place a phpBB3 login box anywhere on my website. As you can see, it uses the phpBB3 "ucp.php?mode=login" code to process everything.

 

Is there a way that I can send the form data to "ucp.php?mode=login" and then KEEP all the post data and redirect it to a new page to use the post data again?

 

Here is the code i'm using:

 

    <body bgcolor="#FFFFFF">
    <FORM action=ucp.php?mode=login method=post target=main>
          <TABLE class=forumline cellSpacing=1 cellPadding=3 width="106"border=0><TBODY>
            <TR>
              <TD class=row1 vAlign=center align=middle height=28 width="90"><SPAN class=gensmall><INPUT class=post size=10 name=username value="Username"><br>
                <INPUT class=post type=password size=10 name=password value="Password"><br>
                Auto login ?<INPUT class=text type=checkbox name=autologin><br>
                 <INPUT class=mainoption type=submit value="Log in" name=login>
              </TD></TR></TBODY></TABLE></FORM>

 

Basically I want "Username" to be carried across so I can use it in an SQL statement like -  "Select 'data' FROM 'table' WHERE $Username = 'ID'".

 

Make sense?

 

Cheers for any advice ;)

Link to comment
Share on other sites

Ok, so let's clarify this a little.

You want your login box to POST to ucp.php?mode=login so that it can authenticate on phpBB

but you then want to intercept this process and push that POST'd data to another script of your choosing.

 

Now i'm guessing here but I would endeavour to say that you would rather not edit the phpBB code for this operation.

1) Because it means you have to edit code you are not familiar with

2) What happens when someone goes directly to the phpBB login? They'll get redirected to your page of course.

 

Ok, so the solution lies in the clarification really.

What you NEED to do is NOT post your form to ucp.php?mode=login , but instead post to YOUR php script.

What you then need to do is use CURL to take the POST data you have been given by the form and POST off to the phpBB login page. Retrieve the answer from phpBB and then handle the data YOU want and do the processes you need to do (e.g. make that SQL call), and then of course top it all off and redirect to your other page.

 

Et voila.

Link to comment
Share on other sites

Hmm just had a thought...

 

What if I used this script.. then somehow stored the entered username in a cookie. The login is processed, the user is authenticated, and then it redirects to my page where I can use the cookie value in the "select where" statement. If the auth fails, I use an else and send them back to the login form.

 

Will that work?

 

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = '/phpbb/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    if (!$user->data['is_registered']) {
       echo '<div id="login">';
       echo '<form method="post" action="'.$phpbb_root_path.'/ucp.php?mode=login" class="headerspace">';
             
       echo '      <ul>';
       echo '      <li><label for="username">Username:</label> <input type="text" name="username" id="username" size="5" class="inputbox" title="Username" />  </li>';
       echo '         <li><label for="password">Password:</label> <input type="password" name="password" id="password" size="5" class="inputbox" title="Password" /></li>';
       echo '         <li><label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" class="checkbox" /></label> <input type="submit" name="login" value="Login" class="button2" /></li>';
       echo '         </ul>';
       echo '         <input type="hidden" name="redirect" value="'.$returnAddress.'">';
       echo '         </fieldset>';
       echo '      </form>';
       echo '   </div>';

    }

    if ($user->data['is_registered']) {
       echo '<a href="'.$phpbb_root_path.'/ucp.php?mode=logout'.$SID.'">Logout</a>';

    }

    ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.