vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   VB Login on a Non-VB Page vB3 RC3 (https://vborg.vbsupport.ru/showthread.php?t=61112)

Marulatree 04-14-2004 10:48 AM

thanks for this hack.

Can I request 2 things:

1. After Logging in, can the member be sent back to the page he logged in at.
2. Once the person has logged in, can you add: Welcome back "username" and You have 0 new PM's (or if 2 new PM's - you have 2 new PM's)...

Many Thanks...

Marulatree 04-15-2004 10:11 AM

bump....

akiy 04-15-2004 04:49 PM

Quote:

Originally Posted by Kumaro
Okay, I finally got this hack to work with my PHPnuke 7.1. There's still 1 problem remaining. It logs in and returns to the main page, however the message does not change to "Welcome username", it always shows the login form....I made it into a phpnuke block, so it is in its' own file. The login is successful, but there is no welcome page.

Make sure your "Path to Save Cookies" setting in your Administrator Control Panel is set so that the path includes your login page. For example, you might need to change it from "/forum/" to "/"...

Marulatree 04-20-2004 10:14 PM

that's right - ignore me....;)

Slappy Nutz 05-06-2004 11:03 AM

Ok, I have a small problem, when the user is logged into the forums every thing is fine, but when there is an unregistered or logged out user I get this

Unable to add cookies, header already sent.
File: /blablablablabla/public_html/indexnew.php
Line: 1

Line 1 is the call to global.php, anyone know why this is happening? Thanks

EDIT: Ummm, I noticed anything that uses a call to global.php on the main page makes this happen, we also have latest post and events from the calander calling to it . . . . . :ermm: :disappointed:

Slappy Nutz 05-09-2004 07:24 AM

NM fixed

yabba 05-09-2004 05:36 PM

Dont Work for me

Quote:

Parse error: parse error in /homepages/2/d***/htdocs/forum/nonvblogin.php on line 9

misterfade 05-30-2004 04:47 PM

Quote:

Originally Posted by Marulatree
Can I request 2 things:

1. After Logging in, can the member be sent back to the page he logged in at.
2. Once the person has logged in, can you add: Welcome back "username" and You have 0 new PM's (or if 2 new PM's - you have 2 new PM's)...

That's exactly what I'm looking for! Plus a link to View New Posts. Does anyone know how to do this with this hack?

Thanks.

opus 06-01-2004 02:24 AM

bump

BarHopper 06-04-2004 05:43 PM

Quote:

Originally Posted by yabba
Dont Work for me


I get exactly the same error.

Help will be much appreciated.

Casparian 06-05-2004 02:33 AM

Anyone know a way to get the default template to show up on non forum pages? I'm sure I've seen this before but can't find where!

TYorke 06-05-2004 02:44 AM

Quote:

Originally Posted by Slappy Nutz
NM fixed

How did you fix it? I am having the same problem!

Anyone?

:D

AbstractHipHop 06-06-2004 06:44 PM

for everyone getting the parse error
i fixed mine by removing this line
PHP Code:

chdir("../); 


Marulatree 06-08-2004 12:24 PM

bump to my first post...?

Mu5icMan 06-09-2004 10:20 AM

has anyone figured out how to use this with other Javascript applications

007 06-10-2004 12:57 PM

Quote:

Originally Posted by AbstractHipHop
for everyone getting the parse error
i fixed mine by removing this line
PHP Code:

chdir("../); 


You could just change that to
PHP Code:

chdir("../"); 

There was a missing "

And how did you guys get past the cookies error?

007 06-11-2004 01:40 AM

Found something that should have been mentioned. You have to set your cookies to work on your full domain, not just your forums. Otherwise works well.

Logging out doesn't seem to log out the users from the non-vb page all the time if they have "Remember Me" checked...

Ghostspy 06-14-2004 10:06 PM

if you use post nuke how will this work??

Mu5icMan 06-15-2004 03:12 PM

does anyone know how to rewrite this code for use with *.wml files.

StewardManscat 06-15-2004 11:30 PM

Curious.
When I try this, I get redirected back to my custom login page.
So I add:

PHP Code:

if ($bbuserinfo['userid']!=0) {
  
header("Location: forum/index.php");
  exit;


Works ok ...but.

But now for some reason the userid cookie is not set. Other cookies are: hash, lastvisit etc. But not the userid.

So the login is good so long as I remain within the forum system. But if I move into my custom site (or the photopost subsystem), the username reverts to "Guest". Because the code is not picking up the userid cookie.

I can code to lookup the sessionhash instead, but now I think I am travelling too far in the wrong direction.

Vewy stwange. Any guidance much appreciated.

WishER 06-24-2004 04:45 PM

Hi folks,

After a while of debugging my problems and so on, i managed to get all this worked out.

Let start with the problems I had. After I logged in, I would still get the login form instead of the welcome back message. I fixed that by first making sure that vb3 was setting the cookies for my whole server, by using .bayareamuscle.com as the domain. I also had to put the initiation code, that calls/requires globals.php, at the very top of the php page:

At the top of my non vb3 page:
PHP Code:

<? 
chdir("./forum/"); 
include('./global.php');   
chdir("../"); 
?>

The rest of the code was the same. I just used that where i needed the login box.

So that fixed my problem witht he login box always showing up.

Now on to the avatar on this page. This was actually very simple, all i had to do was add 3 lines to the current code.

Lets start with the including of the required files:
PHP Code:

<? 
chdir("./forum/"); 
include('./global.php');   

// added this line to include the user functions which 
// has the fetch_avatar_url() function
include('./includes/functions_user.php');

chdir("../"); 
?>

PHP 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="/forum/" . $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='/forum/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:&nbsp;</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> 
                        <? 



?>

Hope this helps. Ofcourse, now you can also use all the other functions in the functions_user.php include, so check out what it offers.

Sorry for the ugly code, but I just came up with it no more than 3 mins ago and since this page was still open, i figured i'd contribute with what i found. now ya can take care of the clean up. :)

p.s. you can see this work at BayAreaMuscle.com, you are going to have to login as user: DemoUser and password: demo, i created an avatar for this demo user.

Pz!

DuffMan 06-28-2004 01:49 AM

Whenever I try this, all variables that existed before global.php was called dissapaear. Is there any way around this or is vB's security just too powerful?

DF-inside 07-07-2004 08:44 PM

Still no stable code for this?

ravenswood1000 07-07-2004 09:01 PM

I just want a stable way of getting the vbulletin user id from whichever directory I call for it, but to no avail.

Vbullletin broke my site so I had to neuter it by adding globals variables that were important to me by including them in the "/includes/init.php" ignore array subroutine.

It is fun to sometimes subtract globals that are important to vbulletin just to see how it reacts.

ravenswood

CNibbana 07-08-2004 04:02 AM

Quote:

Originally Posted by Mu5icMan
has anyone figured out how to use this with other Javascript applications

I don't understand why you guys are using this line in the first place?
<script type='text/javascript' src='/forum/clientscript/vbulletin_md5.js'></script>

I am running my script as below which I copied directly from the VB3 source code and it works great: (of course you have to include the chdir at the top of your non VB3 page first)

<form method="post" class="login" action="/forum/login.php" onsubmit="md5hash(vb_login_password,vb_login_md5pa ssword)">
<p>Username:<input type="text" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="1" onfocus="if (this.value == 'User Name') this.value = '';" /></p>
<p>Password:<input type="password" name="vb_login_password" size="10" accesskey="p" tabindex="2" /></p>
<input type="hidden" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="login" /><input type="hidden" name="forceredirect" value="1" />
<input type="hidden" name="vb_login_md5password" />
<input type="submit" value="Login" class="submit" />

Mu5icMan 07-08-2004 08:35 AM

i asked that question because i have multiple 'OnSumbit = ???' commands. But i got mine to work, sort off. I still have a problem with cookies.

Sometimes it lets me in without entering username and password and sometimes i have to enter them.

WishER 07-13-2004 04:47 PM

Quote:

Originally Posted by ravenswood1000
I just want a stable way of getting the vbulletin user id from whichever directory I call for it, but to no avail.

Vbullletin broke my site so I had to neuter it by adding globals variables that were important to me by including them in the "/includes/init.php" ignore array subroutine.

It is fun to sometimes subtract globals that are important to vbulletin just to see how it reacts.

ravenswood

Dude, in all the includes and requires, change it to the local path. so that you don't have to do the linking relative to the file. an example of this is:

require("c:/www/username/public_html/forum/globals.php");

that will work from anywhere you do it. Just learn how you use: http://us2.php.net/manual/en/function.require.php

to get the stable one, all you have to do is cusomize it for your use. and it's just a matter of changing the path for the files and you are set. You are not always going to get the perfect match with these mods. Learn to use the PHP manual and your life will be a bit easier: http://us2.php.net/manual/en/

That's the problem with php, it acts differently on different machines depending on config, os, and so on, but hey it's free! LOL

Pz!

d3nnis 07-14-2004 07:22 AM

Quote:

Originally Posted by Ghostspy
if you use post nuke how will this work??


yeah i am curious if this works for php nuke?

lmongello 07-14-2004 01:08 PM

I can't seem to get this working right...

I have a www.mysite.com/downloads/index.php page that I want to implment this on

My forums are in www.mysite.com/forums

The top of my index page is:

<?php
chdir("../forums/");
require('./global.php');
chdir("../");
?>

and I was sure to change "forum" to "forums" throughout the rest fo the script. I get errors like:

Warning: fopen(./file_info/descriptions/logo_sm.gif.0): failed to open stream: No such file or directory in /home/virtual/site1/fst/var/www/html/download/index.php on line 716 (also 718 and 718)

I have a feeling that the first few lines of the page are what's screwing it up.

The /download/index page reads the downloads directory and lists files in there. It also calls to a subdirectory at downloads/file_info for headers, etc. (it's using PHP Easy Download V0.995 By Paul Alger)

Anybody able to help???

Thanks!! :)

klassicd 08-12-2004 05:58 PM

chdir("../); should be chdir("../");

genmud 08-14-2004 08:27 PM

would there be any way to do it so instead of making sure that the user is logged in, it would make sure that (a) the user is logged in, and (b)the user is in a certain group...

jfreyholtz 08-19-2004 05:58 PM

Shouldn't requiring global.php on any page on your site include those users online?

I have it included on all my pages (ie, /blah.php and not just /forum/*.php), and have login enabled for all pages (which works great), but those users aren't showing up in the Whos Online piece on the forum.

Any ideas why it doesn't?

Jargon 08-21-2004 01:59 AM

Its still not showing Welcome Back, Username! any ideas?

http://www.liquid-core.net/user2.php

That is the page im testing the code on. You can login but when it redirects you you get the same Guest message.

Here is the code I am currently using.

PHP Code:

<?php 
error_reporting
(7); 
////////////////////////////////////// 
// You need to EDIT your PATHS or this will not WORK properly 
////////////////////////////////////// 
chdir('/home/*****/public_html/forums'); 
require_once(
'/home/*****/public_html/forums/global.php');  
?>
<?php
////////////////////////////////////// 
// No need to edit anything just yet please scroll down
////////////////////////////////////// 
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user ORDER BY joindate DESC LIMIT 1");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
// Top poster
$topposters=$DB_site->query_first("SELECT username,posts,userid FROM user ORDER BY posts desc LIMIT 1");
// Top Threads starter
$toptstarter=$DB_site->query_first("SELECT COUNT(*) AS count,postuserid,postusername FROM thread GROUP BY postuserid ORDER BY count DESC LIMIT 1");
//Get Latest Posts
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
  
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' 'trim($bbuserinfo['ignorelist'])));
  }
  
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
  
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
  
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
  if (
$newpm['messages']==0) {
    echo 
"";
  } else {
    echo 
"";
  }
} else {
  
$pminfo='';
}

//////////////////////////////////////////////////////////////////
//     STEP #1
//////////////////////////////////////////////////////////////////
//Please Enter the Full Path to the functions_user.php file
//////////////////////////////////////////////////////////////////
//
require_once('/home/*****/public_html/forums/includes/functions_user.php');
//
//////////////////////////////////////////////////////////////////
$indexpage true;
$bbuserinfo['avatarurl'] =
fetch_avatar_url($bbuserinfo['userid']);
$newposts $DB_site->query_first("
    SELECT COUNT(*) AS count
    FROM "
.TABLE_PREFIX."post
    WHERE dateline > '"
.$bbuserinfo['lastvisit']."'
"
);
$activethreads $DB_site->query_first("
    SELECT COUNT(*) AS count
    FROM "
.TABLE_PREFIX."thread
    WHERE lastpost > '"
.$bbuserinfo['lastvisit']."'
"
);
// ########## \\__> Added from Hwulex's Welcome Hack THANKS!!!<__// ########## \\
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
if (
$bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
 
 
//////////////////////////////////////////////////////////////////
//     STEP #2                                                  // 
//////////////////////////////////////////////////////////////////
//BEGIN HTML OUTPUT                                                   
//BE SURE TO LEAVE THE ECHO Strings in place                          
//Any Quotation marks need to have a \ before them                    
//////////////////////////////////////////////////////////////////
///////
// THE FOLLOWING IS THE HTML.  YOU MAY CHANGE THE HTML IF YOU MUST    
// Keep the strings intact and dont use quotation marks               
// A \ in front of them other wise you will get PARSE ERRORS!!!!!!
// THIS SECTION IS THE NAV LINKS AND THE LEFT COLUMN FOR THE TABLE    
// Leave All the ECHO tags Alone as well
//////////////////////////////////////////////////////////////////
///////
//////////////////////////////////////////////////////////////////
echo "


<table width=720><tr><td width=100% colspan=3 align=center valign=top>
<font size=1 face=verdana><a href=\"http://www.liquid-core.net/forums/private.php?s=
$session[sessionhash]\" target=\"_parent\"><b>Goto Your Inbox</b></a> |
<font size=1 face=verdana><a href=\"http://www.liquid-core.net/usercp.php?s=\" target=\"_parent\"><b>Control Panel</b></a> |
<a href=\"http://www.liquid-core.net/forums/search.php?s=
$session[sessionhash]&do=getnew\" target=\"_parent\"><font size=\"1\" face=\"verdana\" target=\"_parent\">View New Posts</font></a> |
<a href=\"http://www.liquid-core.net/forums/login.php?s=
$session[sessionhash]&do=logout\" target=\"_parent\"><font size=\"1\" face=\"verdana\">Proceed to Log Out</font></a>
</td></tr><tr><td width=10%><a href=\"http://www.liquid-core.net/forums/profile.php?
$session[sessionurl]&do=editavatar\"><img src=\"$bbuserinfo[avatarurl]\" border=\"0\"></a></td><td width=50%>

<font size=1 face=verdana>Welcome Back, <b>
$username!</b><br> There have been $activethreads[count] threads and $newposts[count] posts since your last visit! <br>
<font size=1 face=verdana>There is currently: <b>
$numbermembers</b> members with a total of <b>$totalposts</b> posts and <b>$totalthreads</b> threads.<br>
<font size=1 face=verdana><b>
$bbuserinfo[username]</b> - You have $bbuserinfo[pmunread] new message(s) since your last visit.<br>
<font size=1 face=verdana>(You have 
$bbuserinfo[pmunread] unread messages and $bbuserinfo[pmtotal] total messages in all your folders.


)"
;
////////////////////
//Leave This Alone//
////////////////////
} else {
/////////////////////
// STEP #3         //
//Guest Column Edit//
// Dont Forget to  //
// Change the Urls //
// IN the FORM     //
/////////////////////
echo "


<table width=720><tr><td width=10%>
$avatarimage</td><td width=50%>
<font size=1 face=verdana>Welcome Guest!<br><table width=100% border=0 cellpadding=0 cellspacing=0>
<font size=1 face=verdana>

If this is your first visit, be sure to read the <a href=\"http://www.liquid-core.net/forums/faq.php?s=
$session[sessionhash]\" target=\"_parent\">
<b>FAQ</b></a>.  You have to <a href=\"http://www.liquid-core.net/forums/register.php?s=
$session[sessionhash]\"
target=\"_parent\"><b>register</b></a>  before you can post on our forums or interact with our growing community.


  <form action=\"http://www.liquid-core.net/forums/login.php\" method=\"post\" onsubmit=\"md5hash(vb_login_password,vb_login_md5password)\">
        <script type=\"text/javascript\" src=\"http://www.liquid-core.net/forums/clientscript/vbulletin_md5.js\"></script>
        <table cellpadding=\"0\" cellspacing=\"3\" border=\"0\">
        <tr>
            <td><font size=1 face=verdana>User Name</td>
            <td><input type=\"text\" class=\"button\" name=\"vb_login_username\" id=\"navbar_username\" size=\"10\" accesskey=\"u\" tabindex=\"1\" value=\"User Name\" onfocus=\"if (this.value == 'User Name') this.value = '';\" /></td>
            <td colspan=\"2\" nowrap=\"nowrap\"><label for=\"cb_cookieuser_navbar\"><input type=\"checkbox\" name=\"cookieuser\" value=\"1\" tabindex=\"3\" id=\"cb_cookieuser_navbar\" accesskey=\"c\" checked=\"checked\" /><font size=1 face=verdana>Remember Me?</label></td>
        </tr>
        <tr>
            <td><font size=1 face=verdana>Password</td>
            <td><input type=\"password\" class=\"button\" name=\"vb_login_password\" size=\"10\" accesskey=\"p\" tabindex=\"2\" /></td>
            <td><input type=\"submit\" class=\"button\" value=\"Log in\" tabindex=\"4\" title=\"Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself.\" accesskey=\"s\" /></td>
        </tr>
        </table>
        <input type=\"hidden\" name=\"s\" value=\"\" />
        <input type=\"hidden\" name=\"do\" value=\"login\" />
        <input type=\"hidden\" name=\"forceredirect\" value=\"1\" />            
        <input type=\"hidden\" name=\"vb_login_md5password\" />
        </form>

"
;

/////////////////////
//Leave This Alone //
/////////////////////
}
///////////////////////////////
// STEP #4                   //
// BEGIN RIGHT COLUMN HTML OUTPUT//
// NO QUOTATION MARKS PLEASE //
// You Can Edit This now     //
///////////////////////////////
echo "


</td>
<td width=40% align=right>
<font size=1 face=verdana>Newest member <a
href=\"http://www.liquid-core.net/forums/member.php?s=&action=getinfo&userid=
$newuserid\">$newusername</a><br>
<font size=1 face=verdana>The Current Top Poster is: <a href=http://www.liquid-core.net/forums/member.php?&action=getinfo&userid=
$topposters[userid]>
<b>
$topposters[username]</b></a></font>($topposters[posts])<br>
<font size=1 face=verdana>The Current Top Thread Starter is: <font color=red>
<a href=http://www.liquid-core.net/forums/member.php?&action=getinfo&userid=
$toptstarter[postuserid]><b>$toptstarter[postusername]</b></font>
</a>(
$toptstarter[count])</td></tr></table>


"
;
?>


AlexSFBay 08-25-2004 11:25 PM

This hack is GREAT, but I was wondering if anyone figured out a way to not have users on non-vB pages showing up on the forum's "Who's Online" page, which results in:

Guest | Unknown Location (followed by the non-vB page URL)

* I tried closing the script hack by adding mysql_close (); to the end of the script, but it didn't change anything. Any suggestions?

Tayeb 08-27-2004 02:00 PM

Hello all:

I have a login system working outside vb actually under phpnuke and am at at the moment refining it, to release the hack next week as my new contribution to vbulletin.org.

The ideas can be used in other portal system. If you want to have a look at the login check at:

http://www.myiwc.com

:)

Jargon 08-29-2004 07:49 PM

Ah its still not working. Anyone have a better version?

stan68 08-31-2004 02:50 PM

Quote:

Originally Posted by WishER
Hi folks,

After a while of debugging my problems and so on, i managed to get all this worked out.

Let start with the problems I had. After I logged in, I would still get the login form instead of the welcome back message. I fixed that by first making sure that vb3 was setting the cookies for my whole server, by using .bayareamuscle.com as the domain. I also had to put the initiation code, that calls/requires globals.php, at the very top of the php page:

At the top of my non vb3 page:
PHP Code:

<? 
chdir("./forum/"); 
include('./global.php');   
chdir("../"); 
?>

The rest of the code was the same. I just used that where i needed the login box.

So that fixed my problem witht he login box always showing up.

Now on to the avatar on this page. This was actually very simple, all i had to do was add 3 lines to the current code.

Lets start with the including of the required files:
PHP Code:

<? 
chdir("./forum/"); 
include('./global.php');   

// added this line to include the user functions which 
// has the fetch_avatar_url() function
include('./includes/functions_user.php');

chdir("../"); 
?>

PHP 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="/forum/" . $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='/forum/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:&nbsp;</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> 
                        <? 



?>

Hope this helps. Ofcourse, now you can also use all the other functions in the functions_user.php include, so check out what it offers.

Sorry for the ugly code, but I just came up with it no more than 3 mins ago and since this page was still open, i figured i'd contribute with what i found. now ya can take care of the clean up. :)

p.s. you can see this work at BayAreaMuscle.com, you are going to have to login as user: DemoUser and password: demo, i created an avatar for this demo user.

Pz!

This worked Great ty for the info :)
the machine

heres a screenshot since most of you won't see anything ;)

http://www.gamepsycosis.com/homepage.jpg

kelangtri 09-12-2004 06:26 AM

stan68, do u can share ur homepage, i can creat a info.php page, but i dont include it to my homepage, .html page , so sad

nhatrang 09-26-2004 05:17 AM

this is an easy script but why is it soo hard? hehehe

csimo 10-12-2004 01:06 AM

No longer needed.


All times are GMT. The time now is 02:45 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02934 seconds
  • Memory Usage 1,958KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete