MyBB Community Forums
Integrating MyBB into your website. (Login Form) - Printable Version

+- MyBB Community Forums (http://community.mybb.com)
+-- Forum: Resources (/forum-8.html)
+--- Forum: Third Party Integration (/forum-132.html)
+--- Thread: Integrating MyBB into your website. (Login Form) (/thread-6190.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47


RE: Integrating MyBB into your website. (Login Form) - bnstep - 10-11-2008 10:40 PM

I have an existing website with several users. Does anyone know how to integrate MyBB with your existing login. What I want to do is have my users login to my website and when they click the forum link be automatically logged in to MyBB. I've tried passing the params through the session and redirecting but its not working.

Any help....please.


RE: Integrating MyBB into your website. (Login Form) - Mr Skull - 10-12-2008 08:58 AM

Thanks I really needed that Smile


RE: Integrating MyBB into your website. (Login Form) - Lokki - 10-23-2008 06:42 AM

hello I have one little problem with this code
when I logout from my website it doesn't log me out from my forum ... it stay logged in.

i use this code before anything:
PHP Code:
<?php
    define
("IN_MYBB",1);
    
chdir('forum'); // path to MyBB
    
require './global.php';
?>

and this where the login box appear:
PHP Code:
<?php

if($mybb->user['uid'] > 0) { // The user is logged in, say Hi
    
echo "Hey, "$mybb->user['username'] .".<br>Thanks for logging in.<br><br>";

} else {

     
// The user is not logged in, Display the form
    
echo "<form action='forum/member.php' method='post'>
    <input type=\"hidden\" name=\"my_post_key\" value=\"
$mybb->post_code\" />
    Username: <input type='text' name='username' size='25' maxlength='30' /><br />
    Password: <input type='password' name='password' size='25' />
    <input type='hidden' name='action' value='do_login'>
    <input type='hidden' name='url' value='index.php' />
    <input type='submit' class='submit' name='submit' value='Login' /></form><br>"
;
}

?>

any idea?

ps
sorry for my english.


RE: Integrating MyBB into your website. (Login Form) - TStarGermany - 10-23-2008 04:52 PM

ahm, how do you manage to get the required logoutkey to your login/logout box?


RE: Integrating MyBB into your website. (Login Form) - Lokki - 10-23-2008 05:12 PM

PHP Code:
<form action='forum/member.php?action=logout&logoutkey=".$mybb->user['logoutkey']."' method='post'>
<
input type='hidden' name='action' value='logout'> </form



RE: Integrating MyBB into your website. (Login Form) - TStarGermany - 10-23-2008 05:18 PM

you may try
-> clean up your form url to only member.php and transfer all variables with input type hidden. the POST method might destroy the additional parameters you have implemented in your form URL...
PHP Code:
<form action='forum/member.php' method='post'>
<
input type='hidden' name='action' value='logout'
<
input type='hidden' name='logoutkey' value=$mybb->user['logoutkey'] >
</
form



RE: Integrating MyBB into your website. (Login Form) - Lokki - 10-23-2008 05:49 PM

still don't work
i forget to tell the my forum is under a subdomain forum.mysite.com
maybe this is the main problem...i don't know...


RE: Integrating MyBB into your website. (Login Form) - TStarGermany - 10-23-2008 06:19 PM

well then, lets have a look, can you provide some testaccount?


RE: Integrating MyBB into your website. (Login Form) - Infernolized - 10-23-2008 06:35 PM

You should still be able to use mysite.com/forum when doing this. As for the code, instead of:

$mybb->user['logoutkey']

Try:

{$mybb->user['logoutkey']}

I had the same problem with forms and other HTML coding until I used the {} around the variable. If that still doesn't work then.. well then I really don't know xD


RE: Integrating MyBB into your website. (Login Form) - Lokki - 10-23-2008 07:20 PM

@ TStarGermany
yes i can provide a test acoun i will send you on pm a username and password
@Infernolized
thanks it works but...
I logout form my website, i'm redirected to forum index from there I go back to website index, and from website index I go to forum and I'm logged in

thanks for help