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) - Craigw - 12-01-2008 08:58 PM

instead of using forms to logout, why didnt you just use a simple link?

Code:
echo "<a href='./member.php?action=logout&amp;logoutkey=".$mybb->user['logoutkey']."'>Logout</a>";



RE: Integrating MyBB into your website. (Login Form) - Karan139 - 12-01-2008 10:26 PM

Hey, well I'm using a CMS which already has a login system implemented in it, and was wondering how I can Integrate the two together so you would have the same account on the website and the forums. I am using Webspell (clan CMS) and was wondering if anyone could help me do this.

Thanks.


RE: Integrating MyBB into your website. (Login Form) - Tabo - 12-06-2008 01:04 AM

This post, ages and ages ago (like a year+ or something) was the first time I tried to write my own PHP (I started with that then done other basic things on my own), I'm still not good, but anyway thanks man.


RE: Integrating MyBB into your website. (Login Form) - freedom - 12-13-2008 09:06 AM

I have done as suitable and the session correctly works.
The code
PHP Code:
echo "Hey, $mybbuser[username]. <br> " 
, however, don't stamp the name of the user.

Where I am wrong?


RE: Integrating MyBB into your website. (Login Form) - John_S - 12-13-2008 12:58 PM

(12-13-2008 09:06 AM)freedom Wrote:  I have done as suitable and the session correctly works.
The code
PHP Code:
echo "Hey, $mybbuser[username]. <br> " 
, however, don't stamp the name of the user.

Where I am wrong?

Hello!

Actually you'd better use this code:
PHP Code:
echo "Hey, {$mybb->user['username']}. <br> " 

Hope it helps.


RE: Integrating MyBB into your website. (Login Form) - tbanucci - 12-15-2008 09:57 PM

This code has worked out great for me, with one exception. On my website, I changed all of the pages from HTML to PHP so that you can login from any page. I have a page on my site that was already in PHP, and does not want to co-exist with the PHP code you wrote in the initial post.

Here is the PHP header:
PHP Code:
<?php
include('_config.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 

and later, the code.....
PHP Code:
<?php
$sql2 
"SELECT
            *
        FROM        _members         
        WHERE        active = 1
        ORDER BY    company  ASC"
;
$qid2 db_query($sql2);
$limit db_num_rows($qid2);
//$limit--;
$randNum rand(0,$limit);

if (
db_num_rows($qid2) >= 1) {

    for (
$a2=0$a2<db_num_rows($qid2); $a2++) {
        list(
$id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid2);
            if (
$randNum == $id) {
                echo 
'<table width="100%" border="0" cellspacing="0" cellpadding="3">
                        <tr>
                            <td width="100%" valign="middle" style="font-size:16px;background-color:#88a6d5;border:2px solid #666;font-size:13px;padding:10px;text-align:center;">
                <h2 style="font-size:19px;color:#fff;margin-bottom:6px;">'
.$company.'</h2>
                    <strong>'
.$firstname.' '.$lastname.'</strong><br>
                    '
.$phone.'<br><br>';
                    if (!empty(
$email)) { echo '<img src="images/email_med.gif" style="margin-bottom:-3px;"> <a href="mailto:'.$email.'" style="font-size:13px;text-decoration:none;color:#fff;">E-mail</a>&nbsp;&nbsp;'; }
                    if (!empty(
$website)) { echo '<img src="images/home_med.gif" style="margin-bottom:-3px;"> <a href="http://'.$website.'" target="_blank" style="font-size:13px;text-decoration:none;color:#fff;">Website</a>'; }
                echo 
'</tr></td></table>';
            }
    }
}
?>

<table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
        <td width="50%" valign="top" style="font-size:11px;"> 

<?php
$sql 
"SELECT
            *
        FROM        _members         
        WHERE        active = 1
        ORDER BY    company  ASC"
;
$qid db_query($sql);
$howmany db_num_rows($qid);
$half number_format($howmany 2);

$counter 0;

if (
db_num_rows($qid) >= 1) {

    for (
$a=0$a<db_num_rows($qid); $a++) {
        list(
$id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid);
            echo 
'
            <div style="padding-bottom:12px;border-bottom:1px solid #cccccc;">
                <h2 style="font-size:14px;color:#6C8CBF;margin-bottom:6px;">'
.$company.'</h2>
                <strong>'
.$firstname.' '.$lastname.'</strong><br>
                '
.$phone.'<br><br>';
                if (!empty(
$email)) { echo '<img src="images/email.gif"> <a href="mailto:'.$email.'" style="font-size:11px;text-decoration:none;color:#666;">E-mail</a>&nbsp;&nbsp;'; }
                if (!empty(
$website)) { echo '<img src="images/home.gif"> <a href="http://'.$website.'" target="_blank" style="font-size:11px;text-decoration:none;color:#666;">Website</a>'; }
            echo 
'</div>';
            
$counter++;
            if (
$counter == $half) { echo '</td><td width="20">&nbsp;</td><td width="50%" valign="top" style="font-size:11px;">'; }
    }
}
?>
</td>
    </tr>
</table>

<!--
<table width="100%" border="0" cellspacing="0" cellpadding="6">
    <tr>
        <td width="350"><h4>Company Name</h4></td>
        <td><h4>Name</h4></td>
        <td><h4>Office</h4></td>
        <td><h4>Email</h4></td>
        <td><h4>Website</h4></td>
    </tr>
<?php
$sql 
"SELECT
            *
        FROM        _members         
        WHERE        active = 1
        ORDER BY    company  ASC"
;
$qid db_query($sql);

if (
db_num_rows($qid) >= 1) {

    for (
$a=0$a<db_num_rows($qid); $a++) {
        list(
$id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid);
            echo 
'
            <tr>
                <td width="350">'
.$company.'</td>
                <td>'
.$firstname.' '.$lastname.'</td>
                <td>'
.$phone.'</td>
                <td><a href="mailto:'
.$email.'">'.$email.'</a></td>
                <td><a href="http://'
.$website.'" target="_blank">'.$website.'</a></td>
            </tr>'
;
    }
}
?>

The actual page in question is:

http://www.bapva.com/members.php

Any ideas on how to make these co-exist on the same page? Right now, I just have a link to the forum...


RE: Integrating MyBB into your website. (Login Form) - Cipher 2009 - 12-17-2008 08:06 PM

Hi all,

I'm currently trying to do a site-forum integration using a forum that uses MyBB 1.4.4 (current at the time of writing). I'm currently using the following code, which is essentially taken from the very first post here, because it seems to be the most solid. Does anyone know how I could possibly amend this in order to make it fully compatible with MyBB 1.4.x? At the moment, the script works, but it doesn't amend once logged in, and it stops all PHP after it on the page from working.

Just so you know, this is in an includes file in public_html/includes/{file}. The forum is in public_html/forum/.

Code:
<?php
chdir('./forum/');
define("IN_MYBB", 1);
require './global.php';
?>
<div class="moduletop">Recommended Links</div>
<div class="menu">
<?php

if($mybb->user['uid'])
{
echo "Hey, $mybbuser[username].<br>
Thanks for logging in.";
}
else
{
echo "<form action='forum/member.php' method='post'>
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>";
}
?>
</div>
<div class="modulebottom"></div>



RE: Integrating MyBB into your website. (Login Form) - utenfly - 01-08-2009 01:40 PM

hi!!

I used this and it is very useful but I have a problem. I use a cms (xoops) and I had to did an iframe with that login. Well, the file where is that code is in loggin.php but I didn't use login form just a link to login form in forums. When I log in I'm redirecting to loggin.php and I want that it goes to forum index. How can I do it?

thx


RE: Integrating MyBB into your website. (Login Form) - John_S - 01-10-2009 02:11 PM

(01-08-2009 01:40 PM)utenfly Wrote:  hi!!

I used this and it is very useful but I have a problem. I use a cms (xoops) and I had to did an iframe with that login. Well, the file where is that code is in loggin.php but I didn't use login form just a link to login form in forums. When I log in I'm redirecting to loggin.php and I want that it goes to forum index. How can I do it?

thx

Heya!

In order to force redirection to the forum index you have to change this:
<input type='hidden' name='url' value='index.php' />
to have "value='index.php'" instead of anything else.


RE: Integrating MyBB into your website. (Login Form) - utenfly - 01-10-2009 03:01 PM

Ya.. well, I don't use the way of first post. I changed the form by a "Enter - Register".