vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Integration with vBulletin - Simple vB User login and access control on non vB pages (https://vborg.vbsupport.ru/showthread.php?t=132996)

djbaxter 02-20-2007 02:34 AM

Uninstall vBSEO. :)

Billspaintball 02-20-2007 04:05 AM

Quote:

Originally Posted by Mastar (Post 1186473)
How to get this to work wid vbseo?
Code:

Unable to add cookies, header already sent.
File: /home/XXXXX/public_html/index.php
Line: 1
 

 



Search Engine Optimization by vBSEO 3


Usually means you have some white space up the top of your page.

Post the first few lines of that page so we can see whats happening.

Skeezster 02-20-2007 04:26 PM

Hi,

I'm trying to use this in a page which contains other variables, but they're all being wiped. I've done some general reading on the VBulletin variable cleaning utility, but can't for the life of me figure out what I'm doing wrong.

Basically an "id" variable is passed (using the "request" function) with the URL for a simple news script (news.php?action=viewnews&id=5)
But with global.php (thus init.php) being used the variable is being wiped. How can I get around that?

Code:

        switch($_REQUEST['action']) {
    case 'viewnews':
            viewNews($id);
                break;
}


Thanks

Skeezster 02-20-2007 05:32 PM

Nevermind, I discovered just how stupid I was being!

Billspaintball 02-20-2007 11:08 PM

Quote:

Originally Posted by Skeezster (Post 1186822)
Hi,

I'm trying to use this in a page which contains other variables, but they're all being wiped.

At a guess your using the same variable names that vB uses.

Skeezster 02-21-2007 01:40 AM

I ended up putting the variable through the vbulletin variable cleaner which sorted things out nicely.

I'm able to log-in and out fine from any page with the includes, but when I attempt to use the user's name/id in the page then I don't get any result. I'm using the following code in the page:
Code:

                $member_name = $vbulletin->userinfo['username'];
                echo 'Hello there ' . $member_name;

And this is up at the top of the page:
Code:

<?php
$curdir = getcwd ();
chdir('/home/######/public_html/forum');
require_once('global.php');
chdir ($curdir);
include 'db.php';
global $db;
?>


Skeezster 02-21-2007 01:59 AM

Found the problem - it doesn't like being inside a function. Think I'm sorted now!

SocomNego 02-21-2007 02:52 AM

Ok well I keep on getting an error...here it is

Quote:

Fatal error: Call to a member function on a non-object in /home/gamesoga/public_html/forums/includes/functions.php on line 1154
Here is my functions.php file from line 1154 to 1174
PHP Code:

    $user $vbulletin->db->query_first_slave("
        SELECT " 
.
            
iif(($option 16), ' administrator.*, ') . "
            userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid" 
.
            
iif(($option 2) AND $vbulletin->options['avatarenabled'], ', avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight').
            
iif(($option 8), ', customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight') .
            
iif(($option 32), ', sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight') .
            
iif(!isset($vbphrase), fetch_language_fields_sql(), '') . "
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "user AS user
        LEFT JOIN " 
TABLE_PREFIX "userfield AS userfield ON (user.userid = userfield.userid)
        LEFT JOIN " 
TABLE_PREFIX "usertextfield AS usertextfield ON (usertextfield.userid = user.userid) " .
        
iif(($option 2) AND $vbulletin->options['avatarenabled'], "LEFT JOIN " TABLE_PREFIX "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " TABLE_PREFIX "customavatar AS customavatar ON (customavatar.userid = user.userid) ") .
        
iif(($option 8), "LEFT JOIN " TABLE_PREFIX "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid) ") .
        
iif(($option 16), "LEFT JOIN " TABLE_PREFIX "administrator AS administrator ON (administrator.userid = user.userid) ") .
        
iif(($option 32), "LEFT JOIN " TABLE_PREFIX "sigpic AS sigpic ON (user.userid = sigpic.userid) ") .
        
iif(!isset($vbphrase), "LEFT JOIN " TABLE_PREFIX "language AS language ON (language.languageid = " . (!empty($languageid) ? $languageid "IF(user.languageid = 0, " intval($vbulletin->options['languageid']) . ", user.languageid)") . ") ") . "
        
$hook_query_joins
        WHERE user.userid = 
$userid
    "
); 


I have tried to check it out, but I don't have a clue what it could be...
Any help would be much appreciated!!!

Billspaintball 02-22-2007 03:02 AM

There should be nothing wrong with the functions.php file, the problem will be in the page that has called it.

Have you followed the steps in the troubleshooting guide? https://vborg.vbsupport.ru/showpost....79&postcount=2
Including step 5 with the test code.

If you still have problems after this, please post the first few lines of the page you are trying to use this hack on.

HoG 02-23-2007 12:19 PM

Is it possible to redirect back to the page you accessed the login form from? if so can someone please give me the code to edit?

Thnx

PnL 02-23-2007 06:34 PM

HoG - this always redirects me back to the page from which our members log in.

QUESTION: How do I manipulate the size of the "Log In" button? I'd like to be able to streamline this hack so it fits neatly in a small area, and the button is quite large right now - can I adjust the size of it?

SocomNego 02-23-2007 07:44 PM

Quote:

Originally Posted by Billspaintball (Post 1188048)
There should be nothing wrong with the functions.php file, the problem will be in the page that has called it.

Have you followed the steps in the troubleshooting guide? https://vborg.vbsupport.ru/showpost....79&postcount=2
Including step 5 with the test code.

If you still have problems after this, please post the first few lines of the page you are trying to use this hack on.

Ok here is my code....The funny thing is that I have it on my home page and it works, but on this page it doesn't work even though I set it up the same way....

PHP Code:

<?php
   chdir
('/home/gamesoga/public_html/forums'); 
   require_once(
'/home/gamesoga/public_html/forums/global.php');  
?>

 
<?
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2 Final//EN'>
<HTML><HEAD>
<META NAME='Generator' CONTENT='Texpad 4'>
<TITLE></TITLE>
<STYLE type='text/css'>
<!--
BODY{
CURSOR: default;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px;
COLOR: #FFFFFF;
BACKGROUND: #000044;
MARGIN-LEFT: 0px;
MARGIN-RIGHT: 0px;
MARGIN-TOP: 0px;
MARGIN-BOTTOM: 0px;
MARGIN-WIDTH: 0px;
MARGIN-HEIGHT: 0px;
SCROLLBAR-FACE-COLOR: #333399;
SCROLLBAR-HIGHLIGHT-COLOR: #000000;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-3DLIGHT-COLOR: #000044;
SCROLLBAR-ARROW-COLOR: #000000;
SCROLLBAR-TRACK-COLOR: #000033;
SCROLLBAR-DARKSHADOW-COLOR: #000000
}
A{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
A:VISITED{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
A:HOVER{
COLOR: #FF0000;
TEXT-DECORATION: none
}
A:ACTIVE{
COLOR: #FFFFFF;
TEXT-DECORATION: none
}
UL{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
LI{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
P{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
TD{
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
TR{FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
SELECT    {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
INPUT     {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
TEXTAREA  {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
OPTION    {COLOR: #51485F; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
FORM      {FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10px}
.loginforma{
COLOR: #FFFFFF;
border-width: 1;
border-color: #000000;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginforma.gif')
}
.loginformb{
COLOR: #FFFFFF;
border-width: 1;
border-color: #000000;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginformb.gif')
}
.loginformc{
border-width: 0;
border-color: #000000;
width:34px; 
height:19px;
BACKGROUND-IMAGE: url('<? echo"$url[curtheme]"; ?>/images/loginformc.gif')
}

.catfont{
color: #FF9900;
}
.altcolor{
background: #3a4466;
}
.altcolora{
background: #000033;
}
.altcolorb{
background: #000020;
}
.altcolorc{
background: #000020;
}

-->
</STYLE>
<?
echo($out[header]);
?>

<SCRIPT LANGUAGE='JavaScript'>
function ugcorgy() {
if (parent != self)
  top.location.href = self.location.href
}
</SCRIPT>

</head>

<body onload='javascript:ugcorgy()'>



<table width='100%' height='100%' valign='top' border='0' bordercolor='#000000' cellspacing='0' cellpadding='0'>
<tr>
<td width='100%' height='90' valign='top' align='center' colspan='2'>

<table width='100%' height='90' align='left' border='0' bordercolor='#000000' cellspacing='0' cellpadding='0'>
<tr>
<td width='305' height='55' valign='top' align='left' class='menu'>
<img src='<? echo"$url[curtheme]"; ?>/images/header_upper.gif' border='0'></a><br>
<img src='<? echo"$url[curtheme]"; ?>/images/header_lower.gif'></td>

<td width='100%' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>

<td width='10' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='*' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_menu_b.gif'>



<?php
   
require_once('/home/gamesoga/public_html/login_inc2.php');
?>


</td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>


<td width='10' height='90' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/top_bg.gif'>
&nbsp;</td>

<td width='10' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_a.gif'></td>
<td width='13' height='90' valign='top' align='left'>
<img src='<? echo"$url[curtheme]"; ?>/images/top_menu_c.gif'></td>


</tr>
</table>

</td>
</tr>
<tr>
<td width='175' height='100%' valign='top' align='left' background='<? echo"$url[curtheme]"; ?>/images/left_bg.gif'>

<table width='175' height='100%' align='left' border='0' cellspacing='0' cellpadding='0'>


<?
echo($out[menu]);
?>


<tr>
<td width='175' height='*' valign='top' align='left'>
&nbsp;</td>
</tr>
</table>


</td>
<td width='100%' height='100%' valign='top' align='left'>


<!-- BODY START -->

<?
echo($out[body]);
?>

<br></td>

</td>
</tr>
<tr>
<td width='100%' height='50' valign='left' align='bottom' colspan='2' background='<? echo"$url[curtheme]"; ?>/images/bottom_bg.gif'>

<table width='100%' height='50' align='left' border='0' cellspacing='0' cellpadding='0'>
<tr>

<td width='325' height='50' valign='bottom' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bottom_left_corner.gif'></td>


<td width='5%' height='50' valign='bottom' align='center'>
&nbsp;</td>

<td width='10' height='50' valign='left' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bot_menu_a.gif'></td>

<td width='400' height='50' valign='center' align='center' background='<? echo"$url[curtheme]"; ?>/images/bot_menu_b.gif'>

<?
/*
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
printf("<center><font size='-2' color='#FFFFFF'>This page created in %f seconds</font></center>", $totaltime);
*/
?>
</td>


<td width='10' height='50' valign='bottom' align='center'>
<img src='<? echo"$url[curtheme]"; ?>/images/bot_menu_c.gif'></td>

<td width='*' height='50' valign='bottom' align='center'>
&nbsp;</td>

</tr>
</table>

</td>
</tr>
</table>
</body>
</html>


Billspaintball 02-26-2007 04:13 AM

Quote:

Originally Posted by HoG (Post 1189010)
Is it possible to redirect back to the page you accessed the login form from? if so can someone please give me the code to edit?

Thnx

It should do that automaticly.

Billspaintball 02-26-2007 04:16 AM

Quote:

Originally Posted by PnL (Post 1189242)
HoG - this always redirects me back to the page from which our members log in.

QUESTION: How do I manipulate the size of the "Log In" button? I'd like to be able to streamline this hack so it fits neatly in a small area, and the button is quite large right now - can I adjust the size of it?

In the file
login_inc.php
find the line with
// You can style this with html or CSS as normal if desired.
and you will see the login form code.
You can make the boxes smaller by editing
size=10
and/or you can add css or html tags to format the text size/colour/font etc as desired.

Billspaintball 02-26-2007 04:21 AM

Quote:

Originally Posted by SocomNego (Post 1189302)
Ok here is my code....The funny thing is that I have it on my home page and it works, but on this page it doesn't work even though I set it up the same way....

PHP Code:

<?php
   chdir
('/home/gamesoga/public_html/forums'); 
   require_once(
'/home/gamesoga/public_html/forums/global.php');  
?>



Try changing that bit above to
<?php
$curdir = getcwd ();
chdir('/home/gamesoga/public_html/forums');
require_once('/home/gamesoga/public_html/forums'/global.php');
chdir ($curdir);
?>

If that does not work I suspect that your trying to use a variable named the same as a reserved vB one.

DaveS 02-26-2007 05:14 PM

Does this mod allow me to use the vB headers and footers?

Billspaintball 02-26-2007 09:23 PM

Quote:

Originally Posted by DaveS (Post 1191268)
Does this mod allow me to use the vB headers and footers?

I dont know.
I havent looked into whats involved in calling the vB header and footer templates.

abenoking 02-28-2007 04:17 PM

Many thanks. This snippet allowed me to do something that I've been begging for support on vb.org for the past several months. Plus, it is super-easy to modify and customize.

My only question, is if you have a complete list of $vbulletin->userinfo[] variables that I can use in conjunction with this mod.

jasbell 03-01-2007 01:02 PM

This is probably a common request/hack so that is why I am describing what I have done.

I took Billspaintball's script for use as a single point login for my site, with the objective of not letting anyone into my entire site without the correct credentials/authorization. I want to permit access only to user groups 2,5,6,or 7 (registered users, moderators, and admins).

www.mysite.com
www.mysite.com/forums

A page with Bill's script code sits at the root (index.php) and my forum is under /forums. If a non-authorized user comes along I want to bounce him/her back to the ROOT with a message.

First I set the permissions of the usergroups to what I think they should be to stop them from getting nto my site at all, then I also use the following alteration of Bill's code on the root index page:

Code:

if($isAdmin){
        //show welcome message
        //show logout link
        //show link to forum
}elseif($isAuthorized){
        //javascript that sends authorized user to the forum homepage /forums
        echo "
        <script>       
                document.onload = redir();       
                function redir(){
                        window.location.replace(\"forums\");       
                }
        </script>
        ";
}else{
        //USER IS NOT AUTHORIZED
        //show a specific message regarding why they do not have access
        //show login boxes
        //show registration request link ONLY if user is usergroup 1 (Unregistered / Not Logged In)
}

The complication arises when I set the permissions of the usergroups of the unauthorized users. I dont want them to see ANYTHING. However, if I set the permissions of these users so that Usergroup Manager>>Forum Viewing Permissions>>Can View Forum == NO, the basic VBulletin authentication stops working correctly and I get a ghostlike home index page that appears like a screwed up version of the forum index page (see 1st attached snapshot). Also, logout stops working (see second attached snapshot).

If I change the permissions and allow my defined set of unauthorized usergroups access to view forums the problem goes away. However, this defeats my goal in preventing these unauthorized users from seeing the forum in the first place and by typing in /forum they can view the forum homepage!

Can anyone can shed light on this and help me achieve what I would like to do?

Thanks!

Jonathan

abenoking 03-09-2007 04:18 PM

Quote:

Originally Posted by Skeezster (Post 1187168)
Found the problem - it doesn't like being inside a function. Think I'm sorted now!

Just thought I would emphasize this, as I missed it the first time, and it hung me up for a couple of days. You cannot call the form or require inside a function.

Any chance for a fix on this though? It would make templating much easier.

brandondrury 03-12-2007 03:04 AM

Quote:

Out of curosity, does this support multiple unique domains and subdomains,?
I couldn't get it to work on my subdomain. Luckily, I'm still building the site so I just switched the forum over to a standard directory and this seams to be working great.

Great mod! You saved me a day of work!

Brandon

Billspaintball 03-14-2007 09:55 AM

Quote:

Originally Posted by brandondrury (Post 1201320)
I couldn't get it to work on my subdomain. Luckily, I'm still building the site so I just switched the forum over to a standard directory and this seams to be working great.

Great mod! You saved me a day of work!

Brandon

Yes, subdomains are a never ending headache.
Works for some, not for others :confused:

Ive not been able to pinpoint why, but possibly something to do with server configuation I spose.

upirate 03-17-2007 05:57 AM

would this work on vb 3.6.5 ?

jags2ooo 03-18-2007 09:46 PM

nice hack, thanks for this! Question :D

Do you know of a way of displaying the person that is logged in "New Pms #" "New Posts #"

Billspaintball 03-18-2007 11:32 PM

Quote:

Originally Posted by upirate (Post 1205416)
would this work on vb 3.6.5 ?

Yes.

Billspaintball 03-18-2007 11:34 PM

Quote:

Originally Posted by jags2ooo (Post 1206877)
nice hack, thanks for this! Question :D

Do you know of a way of displaying the person that is logged in "New Pms #" "New Posts #"

This one does.
https://vborg.vbsupport.ru/showthread.php?t=108026
Its under the vB 3.5 section but still works fine on the vB 3.6 series.

jags2ooo 03-19-2007 12:00 AM

Thanks alot Great stuff exactly what i needed/wanted :D. This is a great lil add makes the site feel more interactive O_O . Thanks alot Billspaintball

jags2ooo 03-19-2007 12:41 AM

I am currently using this script & another script which requires for me to add this also <?php
chdir('./forums');
require_once('./vBExternal.php');
?>

But php wont allow me to add two require_once is there any way to get around this ?

Billspaintball 03-19-2007 01:52 AM

Quote:

Originally Posted by jags2ooo (Post 1206960)
I am currently using this script & another script which requires for me to add this also <?php
chdir('./forums');
require_once('./vBExternal.php');
?>

But php wont allow me to add two require_once is there any way to get around this ?


There is a guide on using this script with vBexternal right here
https://vborg.vbsupport.ru/showpost....&postcount=399

Jim Nayzium 03-20-2007 03:55 AM

You guys say this should redirect me to the page that found the login page automatically right?

Well would that page have to be a native vBulletin page? meaning, I have my own pages that I am adding this to....

and when i click them, to get to my newly created page with this code on -- which does work perfectly by the way, it always redirects the users who login back to the now logged in login page...as opposed to index.php at my root for example..

mysite.com/index.php -- they click login, which takes them to

mysite.com/login.php -- which neitehr of which are vBulletin pages yet....

so they login successfully, I see the vBulletin redireting message, and they are sent back to

mysite.com/login.php not the index.php page I wanted to happen...

is there some form of variable I need to include in the login.php link like ?prevousurl-index.php etc....

jags2ooo 03-21-2007 09:17 PM

having a problem, im using this addon

I'm not a PHP PRO ---




but now i can not use simple dynamic include urls (www.site.com?page=Staff)

<?php
$page = $_GET['page'];
if (!empty($page)) {
$page .= '.php';
i
else {
include('news.html');
}
?>


when i delete global.php from require it works fine >< does anyone have any ideas?

Thanks.

Billspaintball 03-21-2007 10:45 PM

Quote:

Originally Posted by jags2ooo (Post 1209139)
having a problem, im using this addon

I'm not a PHP PRO ---




but now i can not use simple dynamic include urls (www.site.com?page=Staff)


when i delete global.php from require it works fine >< does anyone have any ideas?

Thanks.

Global.php may redefine $page.
Im not sure if $page is a vB variable or not.

If possible try renaming your variable to something different such as mypage and see if that fixes it.

jags2ooo 03-21-2007 10:46 PM

Quote:

Originally Posted by Billspaintball (Post 1209205)
Global.php may redefine $page.
Im not sure if $page is a vB variable or not.

If possible try renaming your variable to something different such as mypage and see if that fixes it.

I tried alot of random names like , "exile, happy, thispage,content, con etc etc" thats not the case. I guess its something to do with global.php :( . I hope someone can figure out a way around this if not im screwed :(

jeramie78 03-22-2007 11:29 PM

ok i got a problem when im logged in to the forum everything works find but when im not logged in i get this error on my homepage.

Unable to add cookies, header already sent.
File: /home/gamer/public_html/index.php
Line: 11

this file is a encoded script by the author so i am lost. why does it give me this error only when im not logged in?

jeramie78 03-25-2007 11:25 PM

ok i fixed the last issue now im having another issue when i try to login i get this in my Address bar and it doesnt log me in

http://www.gamersiege.com/index.php?...5password_utf=

changed personal info for apparent reasons

Fixed that had a open form on the page

now im getting the infamous

Fatal error: Call to a member function on a non-object
on line 150

ok before i get the normal response i have tried everything as requested.
http://gamersiege.com

Billspaintball 03-26-2007 05:03 AM

Can you post the code for your login_inc.php file.

jeramie78 03-26-2007 09:40 PM

PHP Code:

<?php
// Edit the lines below to show path to your forums
$forumpath "http://www.gamersiege.com/forums/";

// Set the maximum display size for the avatar
$maxw 100// Max thumbnail width
$maxh 100// Max thumbnail height

// ++++++++++++++++++++++++++++++++++
// Deluxe vB User login and access control on non vB pages
// Version 2.10 - June 4 2006
// By Bill  bill@billspaintball.com
// ++++++++++++++++++++++++++++++++++


// ++++++++++++++++++++++++++++++++++
// You dont have to edit anything underneath here,
// but you can if you wish to style the login box
// to match the style of your site.
// ++++++++++++++++++++++++++++++++++



// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {


// ++++++++++++++++++++++++++++++++++
// display avatar - resize if too big
// ++++++++++++++++++++++++++++++++++

$userid=$vbulletin->userinfo['userid'];
$file $forumpath."/image.php?u=$userid";
list(
$width$height$type) = getimagesize($file);

if ( 
$width <= $maxw AND $height <= $maxh )// check width and height
   
{// if width and height under size display unchanged
       
echo "<img src=\"$file.$type\" align=\"center\" border=\"0\">";
   }
   else 
   {  
    if (
$width $maxw)//check if width is too wide
        
// if it is, resize
        
$ratio $width $maxw//work out resize ratio
        
$newwidth $maxw// new width
        
$newheight = ($height $ratio); // new height at this resize
        
}
        else
        {
        
$newheight $height// if width is ok, set this cos we need it later
        
$newwidth $width// if width was ok, set this cos we ned it later
        
}
    If (
$newheight <= $maxh )        
        {
        
// if current height is ok, were done.
        

        
        else 
// either origional or resized height is too big
            
if( $newheight >= $maxh )
            { 
// if resized height is still too big we resize it
            
$ratio2 $newheight $maxh//work out resize ratio
            
$newheight $maxh// give $newheight a new value
            
$newwidth = ($newwidth $ratio2); // new width at this resize
            
// the value of $newwidth has just been changed
            
else
            {
// if were here then origional height is too big so we resize it
            
$ratio2 $newheight $maxh//work out resize ratio
            
$newheight $maxh// give $newheight a new value
            
$newwidth = ($newwidth $ratio2); // new width at this resize
            
}

        
// now we can finally display resized pic
        
echo "<img src=\"$file.$type\" border=\"0\" width = \"$newwidth\" height = \"$newheight\" align=\"center\">"// display resized pic
   
}
// +++++++++++++++++++++++  
// end avatar display code
// +++++++++++++++++++++++ 


// +++++++++++++++++++++++++++++++++++++++++
// As Logged in display welcome back message
// +++++++++++++++++++++++++++++++++++++++++
echo "Welcome Back, <b>";
echo 
$vbulletin->userinfo['username'];
echo 
" !</b><br>";

// As were logged in display logout link
echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
echo 
$vbulletin->userinfo['logouthash'];
echo 
"\">";
echo 
"<font size=\"1\" face=\"verdana\">Log Out</font></a><br>";

// Display last visit time and date
echo "You last visited: $pmbox[lastvisitdate] at $pmbox[lastvisittime]";
echo 
"<br>";

// Display PM Details and generate link to PM box
echo "<a href=\"".$forumpath."private.php?$session[sessionurl] \">Private Messages: </a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]";
echo 
"<br>";

} else { 



// ++++++++++++++++++++++++++++++++++++++++++
// If user is not logged in, we do this stuff
// ++++++++++++++++++++++++++++++++++++++++++

// Display text and link to register.
echo "
    You have to <a href=\""
.$forumpath."/register.php?s=$session[sessionhash]\"
    target=\"_parent\"><b>register</b></a>  before you can post on our forums or use our advanced features.
    "
;

// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"</form></form>
    <form action=\""
.$forumpath."/login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
    <script type=text/javascript src=\""
.$forumpath."/clientscript/vbulletin_md5.js\"></script>
    User Name:<br>
    <input name=vb_login_username type=text id=navbar_username size=10 />
            
    <br>Password:<br>
    <input name=vb_login_password type=password size=10 />
    </br>
        
    <label for=cb_cookieuser_navbar><input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
    Remember Me?<br /></label>
    
        
    <input type=submit title=
$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
        
    <input type=hidden name=s value=
$session[sessionhash] />
    <input type=hidden name=do value=login />        
    <input type=hidden name=vb_login_md5password />
    <input type=hidden name=vb_login_md5password_utf />

    </form>
"
;
// +++++++++++++++++++++++++++++++++++++++ 
// End of login box for non logged in user
// +++++++++++++++++++++++++++++++++++++++
}

// +++++++++++++++++++++++++++++++++++++++++++++++++++
// we want do display stats either way so they go here
// +++++++++++++++++++++++++++++++++++++++++++++++++++

// get total number of threads and posts
$getstats $db->query_read('SELECT threadcount, replycount FROM ' TABLE_PREFIX 'forum');
while (
$forum $db->fetch_array($getstats))
{
    
$totthreads += $forum['threadcount'];
    
$totposts += $forum['replycount'];
}
$totthreads vb_number_format($totthreads);
$totposts vb_number_format($totposts);

// display total threads and total posts - Uses vB phrases, but change if you like
echo"<br /> $vbphrase[threads]$totthreads<br />$vbphrase[posts]$totposts<br /> ";

// Only display link and number of new posts if logged in
if ($vbulletin->userinfo['userid']!=0) {

// finds number of new posts
$newposts $db->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "post AS post " iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' TABLE_PREFIX 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));
$newposts vb_number_format($newposts['count']);

echo
"<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$vbphrase[new_posts]</a>: $newposts<br />";}
//  end of number of new posts stuff
?>

Just realized im using the deluxe version but it still a real error :)

Billspaintball 03-26-2007 11:51 PM

Looks like you have it all fixed now.
I created an account on your forums and logged in and out ok.
What was the problem in the end?

Account I created was billtest, you may want to delete it now.

jeramie78 03-26-2007 11:54 PM

I removed this part of the code
which i really wanted to use. and wish i could still use
PHP Code:

// +++++++++++++++++++++++++++++++++++++++++++++++++++
// we want do display stats either way so they go here
// +++++++++++++++++++++++++++++++++++++++++++++++++++

// get total number of threads and posts
$getstats $db->query_read('SELECT threadcount, replycount FROM ' TABLE_PREFIX 'forum');
while (
$forum $db->fetch_array($getstats))
{
    
$totthreads += $forum['threadcount'];
    
$totposts += $forum['replycount'];
}
$totthreads vb_number_format($totthreads);
$totposts vb_number_format($totposts);

// display total threads and total posts - Uses vB phrases, but change if you like
echo"<br /> $vbphrase[threads]$totthreads<br />$vbphrase[posts]$totposts<br /> ";

// Only display link and number of new posts if logged in
if ($vbulletin->userinfo['userid']!=0) {

// finds number of new posts
$newposts $db->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "post AS post " iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' TABLE_PREFIX 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));
$newposts vb_number_format($newposts['count']);

echo
"<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$vbphrase[new_posts]</a>: $newposts<br />";}
//  end of number of new posts stuff 

also it doesnt show the avatars when signed in :(
im using 3.6.5

akulion 03-27-2007 03:42 AM

good stuff :D

Tagged for future use


All times are GMT. The time now is 01:37 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.01821 seconds
  • Memory Usage 2,006KB
  • 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
  • (5)bbcode_code_printable
  • (5)bbcode_php_printable
  • (16)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