Version: 1.10, by Billspaintball
Developer Last Online: Nov 2011
Category: Integration with vBulletin -
Version: 3.6.5
Rating:
Released: 12-01-2006
Last Update: 04-23-2007
Installs: 197
Additional Files
No support by the author.
Hack Description
This is a cutdown version of the user authentication and access control system I use on the non vB pages on my website.
This uses the vB 3.6 login system to log you in and out. It allows you to move between your forums and other pages on your site while remaining logged in.
It allows you to do things such as restrict pages by usergroup, display different content depending on a user being logged in or not.
For example, you can have banner Adds displying to non members only, and/or let members access to specific content.
Ive cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating.
I will try and offer support, but work and family commitments mean I dont have much free time.
This code is a mix of my own, and pieces I have used from other hacks that are floating around.
This script has been confirmed as working on
vB 3.6
vB 3.6.1
vB 3.6.2
vB 3.6.3
vB 3.6.4
vB 3.6.5
Changelog
Version 1.10 (24th April 2007)
Fixed - // in paths bug
Fixed - Javascript warning in some browsers
Fixed - Tidied up some code
Version 1.0 (2nd December 2006)
Very similar to my vB 3.5 version, however logout bug fixed and should be more compatible with other scripts on your page.
Click on Install
If you have this script installed then please click on the install link because;
You will get notified if any security issues are reported.
You will get notified when there are any upgrades to this script
It gives me a warm fuzzy feeling and motivates me to develop more
Donations
First of all, to be clear. This script is 100% free.
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
<?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 // ++++++++++++++++++++++++++++++++++
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&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 />
</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
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