Hey guys.
I am having a problem with my login script which was partly coded by myself, which I use on my normal website.
It all works fine, except for one error at the bottom of the page which I believe is related to my cookie grabber.
Anyway, here is the code I am using.
PHP Code:
<?
// Edit the lines below to show path to your forums
$forumpath = "http://www.thrillhistory.com/forums/";
// Set the maximum display size for the avatar
$maxw = 100; // Max thumbnail width
$maxh = 100; // Max thumbnail height
if ($vbulletin->userinfo['userid']!=0) {
$username=$vbulletin->userinfo['username'];
// ++++++++++++++++++++++++++++++++++
// 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
// +++++++++++++++++++++++
print("<br><align='center'><span class='sectionheader'>Welcome back, $username!<p>");
// Display PM Details and generate link to PM box
echo "<strong><center><a href=\"".$forumpath."private.php?$session[sessionurl] \">Private Messages:</a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]</strong></center>";
echo "<p>";
// As were logged in display logout link
echo "<strong><center><a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&logouthash=$logouthash";
echo $vbulletin->userinfo['logouthash'];
echo "\">";
echo "<font size=\"1\" face=\"verdana\">Log Out of ThrillHistory.com</font></a><br></strong></center>";?>
<?
} else {
?>
</span></p>
<form action='/forums/login.php' method='post' class="style1" onsubmit='md5hash(vb_login_password,vb_login_md5password)'>
<p align="center" class="inbottom style75">
<script type='text/javascript' src='/forums/clientscript/vbulletin_md5.js'></script>
<strong>Username:</strong>
<input type='text' class='button' name='vb_login_username' id='navbar_username' size='15' accesskey='u' tabindex='1' value='' onfocus='if (this.value == 'username="username"') this.value = ''; />
<br />
<strong>Password:</strong>
<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' />
<strong>Remember Me</strong><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' />
</p>
</form>
<div align="left" class="style1">
<div align="center">
<p><span class="inbottom"><a href="/forums/register.php?">Would you like to comment on some of the things being said below? Join ThrillHistory.com Now, it's FREE! </a> </span>
<?
}
?>
Here's the cookie grabber code.
PHP Code:
<?php
chdir("/home/thrillhi/public_html/forums/");
require('/home/thrillhi/public_html/forums/global.php');
chdir("../");
?>
And finally, here is the error I am recieving.
PHP Code:
Fatal error: Call to a member function unlock_tables() on a non-object in /home/thrillhi/public_html/forums/includes/functions.php on line 4419
Guys I hope you can help me. I normally wouldn't be so fussy, however it just makes me look so unprofessional, and it could possibly be leaving my site open to hackers.
So, if anyone out there would be able to help me, I would be greatly appreciative.
Thanks.
Regards
Paul