1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Is login integration possible with vBulletin??

Discussion in 'PHP' started by Dave4559, Oct 2, 2008.

  1. #1
    Hi all,

    I have an existing content site which is is based on the latest PHP code and a MYSQL database. It is similar to an article directory - users can login and submit articles, create a profile, rate, comment etc.

    If I install vBulletin, I would really like to integrate the login process. E.g. if they login to my site, they automatically get logged into the forum as well (which they will access from the home page).

    Is this easy/possible? I am worried about not having access to source code. How many hours would it take?

    Thanks in advance for all of your advice,

    Dave.
     
    Dave4559, Oct 2, 2008 IP
  2. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #2
    Is it possible? Yes.

    Is it easy? No.

    You might try looking at a few "bridges" that link Wordpress/Other CMS to vBulletin and going from their example. You can't estimate how many hours it would take, but I would suggest you outsource it if you are at all new to PHP/MySQL because this isn't going to be an easy task.
     
    zac439, Oct 2, 2008 IP
  3. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Ok, this is an easy way to do it yourself.

    Include a file that checks if the user is logged in
    <?php require_once (''.$_SERVER["DOCUMENT_ROOT"].'/your_include_directory/vblogin_inc.php'); ?>
    PHP:
    This is the file that does the check: vblogin_inc.php:
    <?php
    // Edit the line below to show path to your forums
    $forumpath = "http://www.blablabla.com/myforumdirectory/";
    
    // Check if user is logged in
    if ($vbulletin->userinfo['userid']!=0) {
    
    // If Logged in display welcome back message
    echo "<p>Welcome back, <b>";
    echo $vbulletin->userinfo['username'];
    echo " !</b>  - ";
    
    // If logged in display logout link
    echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
    echo $vbulletin->userinfo['logouthash'];
    echo "\">";
    echo "Log out</a></p>";
    
    } else { // If user is not logged in, we do this stuff
    
    // Display login boxes + button
    // You can style this with html or CSS as normal if desired.
    // Edit formaction to point to your forum loginpage
    echo('
    <form id="rightlogin" action="/myforumdirectory/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
    <script type=text/javascript src="'.$forumpath.'clientscript/vbulletin_md5.js"></script>
    <table border="0"><tr><td colspan="2" valign="bottom"  style="height: 20px">Log in</td></tr>
    <tr><td valign="bottom">Username</td><td valign="bottom">Password</td></tr>
    <tr><td valign="bottom"><input type="text" name="vb_login_username"></td>
    <td valign="bottom"><input type="password" name="vb_login_password">
    <input type="submit" value="Log in" />
    <tr><td colspan="2">
    <label for=cb_cookieuser_navbar><input name="cookieuser" type="checkbox" id="cb_cookieuser_navbar" value="1" checked="checked" /> Remember me </label>
    </td></tr></table>
    <input type="hidden" name="s" value="" />
    <input type="hidden" name="do" value="login" />		
    <input type="hidden" name="vb_login_md5password" />
    <input type="hidden" name="vb_login_md5password_utf" />
    </form>
    ');
    
    }
    ?>
    PHP:
    What this file does is to check if the user is logged in or not.
    If the user has not logged in it shows a small login form.
    If a user is logged it shows a greeting with the username.

    Add the include statement to all php files that you want to perform check if the user is logged in or not.
    Put the include line where you want the login form/greeting to be displayed.

    That's it you're done.

    See an example of use here: http://alltomskolan.se

    :)
     
    wing, Oct 2, 2008 IP
    Dave4559 likes this.
  4. vBSeed

    vBSeed Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yep, we implement a similar system on our site to integrate user/support/payment systems with our forums.
     
    vBSeed, Oct 2, 2008 IP
  5. Dave4559

    Dave4559 Peon

    Messages:
    174
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks a lot Wing!! Much appreciated.
     
    Dave4559, Oct 3, 2008 IP