Version: 1.00, by mcahill
Developer Last Online: Dec 2012
Version: 3.0.0
Rating:
Released: 02-02-2004
Last Update: Never
Installs: 74
No support by the author.
This is a simple modification to do, and adds a lot of value to your homepage.
Notes:
1. This script can occassionally have conflicts with other javascripts. Test before you deploy.
2. If you use and include to put the file on your page, be sure that the chdir and the require for global.php is in the head of the main document.
3. It is assumed that you are using a php page, and that you have already got connectivity with your database.
The code:
At the top of the document, before the <html> or <head> tags (edit to provide the path for your particular installation):
Before requesting support, please check the following:
1. Make sure you have the path to your forum in the chdir. If you haven't done this, you will get a "can't include" error.
2. Make sure you have the chdir in the main document. If it isn't you will get a "can't modify header" error.
3. If those don't resolve the issue, try putting the login in a separate file, with no other code. If it works there, then you will know that you have a conflict with one of the scripts on the page you are trying to add the login to. I can't help you if you've got a conflict with another script.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Ok im going to need a little help from someone good with PHP. What happens is i tried on 3.5 and its pretty good but what happens is i login it logs in but then on the main page it just comes up with the login will i need to make a new file and redirect that to the logged in page eg indexloggedin.php also i tried logging in and i check the forums it says i have visited in the last 15 minutes but i dont seem to be logged in!
Same problem, I log in, but it always asks to log in.
I checked the vB settings for the cookies, I am using the .domain.com setting. Don't see why it isn't working.
the code works great but when i enter my login details, if the page changes to the "thanks for logging in" page and then back to the page that has the login forms. Is there anyway to say get it to not go to the thanks for loggin in page and then rather than just displaying the login boxed display the users avatar who just logged in?
thanks
yes there is - there are other threads about this topic - but basically you need to hack into the vb code and adapt it for use on non-vb pages - it's pretty basic php/html coding.
Say you add that on a non-vb page and your vB forum goes down it will render your non-vb page inaccessible. Is there any way to mod the code to ignore the "global.php" if say your forum database goes down?
I've added this using the mod code that displays the avatar... everything works fine UNTIL I log off, at which point when I try to go to my non vB page displaying the login box or the welcome user info I get:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
chdir("./forums");
include("./global.php");
// added this line to include the user functions which
// has the fetch_avatar_url() function
include("./includes/functions_user.php");
chdir("../");
?>
And this is in the body:
Code:
<?
if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
// i assigned the avatar url to the variable $user_av and check to see if it's empty.
$user_av = fetch_avatar_url($bbuserinfo['userid']);
if($user_av!='')
$user_av="/forums/" . $user_av; //replace "/forum/" with your virtual path to your forum pages.
print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>");
//if the avatar url is not empty, display it
if($user_av!='')
print("<img src=\"" . $user_av . "\" vspace=4>");
} else {
?>
<form action='/forums/login.php' method='post' onsubmit='md5hash(vb_login_password,vb_login_md5password)'>
<script type='text/javascript' src='/forum/clientscript/vbulletin_md5.js'></script>
<span class="sectionheader">Username:</span>
<input type='text' class='button' name='vb_login_username' id='navbar_username' size='15' accesskey='u' tabindex='1' value='' onfocus='if (this.value == 'username') this.value = '';' /><br>
<span class="sectionheader">Password: </span>
<input type='password' class='button' name='vb_login_password' size='15' accesskey='p' tabindex='2' /><br>
<input type='checkbox' name='cookieuser' value='1' tabindex='3' id='cb_cookieuser_navbar' accesskey='c' checked='checked' /><span class='sectionheader'>Remember Me</span><br>
<input name="submit" type='submit' class='button' accesskey='s' tabindex='4' title='Log In' value='Log In' />
<input type='hidden' name='do' value='login' />
<input type='hidden' name='forceredirect' value='1' />
<input type='hidden' name='vb_login_md5password' />
</form>
<?
}
?>