Rushy Posted November 14, 2007 Share Posted November 14, 2007 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 Quote Link to comment Share on other sites More sharing options...
aschk Posted November 14, 2007 Share Posted November 14, 2007 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. Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 14, 2007 Author Share Posted November 14, 2007 Hm. That's exactly what I need to do. But your suggestion sounds really difficult. I was hoping there'd be some simple solution to the problem I'll do some research into what you said.. but i'm only a beginner at PHP Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 15, 2007 Author Share Posted November 15, 2007 Hmm i'm really lost Any chance of a few hints on how to do this? Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted November 15, 2007 Share Posted November 15, 2007 Have you read this page? http://olympuswiki.naderman.de/Adding_pages Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 15, 2007 Author Share Posted November 15, 2007 That looks promising. Cheers. I'll have a look. Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 15, 2007 Author Share Posted November 15, 2007 Ah.. that stuff is way beyond me. Obviously there's no simple way to do it. ah well, cheers for the help. Quote Link to comment Share on other sites More sharing options...
Rushy Posted November 15, 2007 Author Share Posted November 15, 2007 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>'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.