Hi,
At the bottom of my page i get this:
Code:
Fatal error: Call to a member function on a non-object in /home/content/l/a/w/lawjigga/html/forum/includes/functions.php on line 4308
Line 4308 is:
PHP Code:
$vbulletin->db->unlock_tables();
I'm not a guru when it comes to PHP so I can't seem to see the problem.
Here's all the code on my page.
At very top of page:
PHP Code:
//Userpanel.php
chdir("/home/content/l/a/w/lawjigga/html/forum");
require('./global.php');
include('./includes/functions_user.php');
chdir("/home/content/l/a/w/lawjigga/html/");
In body (fetches news):
PHP Code:
$newsforums = 2;
$newsitems = 5;
$forumspath = "";
chdir("/home/content/l/a/w/lawjigga/html/forum");
$connection = mysql_connect(**************) or die ("Cannot connect to server.");
$db = mysql_select_db("trainhealthy", $connection) or die ("Could not select database.");
$sql = "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid = \"$newsforums\" ORDER BY threadid DESC LIMIT $newsitems";
$sql_result = mysql_query($sql, $connection) or die ("Could not execute query.");
if (!$sql_result) {
echo "<p>Could not get record.";
}
while ($row = mysql_fetch_array($sql_result)) {
$threadid = $row["threadid"];
$title = $row["title"];
$forumid = $row["forumid"];
$replycount = $row["replycount"];
$postusername = $row["postusername"];
$postuserid = $row["postuserid"];
$lastposter = $row["lastposter"];
$iconid = $row["iconid"];
$dateline = $row["dateline"];
$sql2 = "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM post WHERE threadid = \"$threadid\" ORDER BY postid ASC LIMIT 1";
$sql_result2 = mysql_query($sql2, $connection) or die ("Could not execute query in second sql statement.");
if (!$sql_result2) {
echo "<p>Could not get record in second statement.";
}
while ($row2 = mysql_fetch_array($sql_result2)) {
$pagetext = $row2["pagetext"];
$dateposted = date("D j M Y, g:i A",$dateline);
if ($replycount==1) {
$commenttext = "Comment";
}
else {
$commenttext = "Comments";
}
$bericht=$pagetext;
print "
<table border=\"0\" width=\"100%\" id=\"table1\" cellspacing=\"0\" cellpadding=\"2\">
<tr>
<td width=\"100%\">
<h2><b>$title</b></h2> - <img border=0 src=\"http://biorust.com/images/qbullets/edit.gif\"><a href=\"http://forums.trainhealthy.com/thread$threadid.html\"><b>$replycount</b> $commenttext</a><br>
:: Posted By <a href=\"http://forums.trainhealthy.com/member.php?s=&action=getinfo&userid=$postuserid\"><b>$postusername</b></a> at <i>$dateposted</i></a>
</tr>
<tr>
<td width=\"100%\">
<p align=\"justify\">".$bericht."</td>
</tr>
</table>
<p>
";
}
}
echo "<center><a href=\"http://forums.biorust.com/search.php\">Search the News</a> | <a href=\"http://forums.biorust.com/forum3.html\">View All News Posts</a></center>";
mysql_free_result($sql_result);
mysql_close($connection);
chdir("/home/content/l/a/w/lawjigga/html");
IN body (non vb login box):
PHP Code:
if ($vbulletin->userinfo['userid'] != 0)
{
echo "You are logged in as <b>";
echo $vbulletin->userinfo['username'];
echo "</b>.<br /><br />";
//Lastvisit
$currentmonth = date("F");
$lastvisitedmonth = date("F", $vbulletin->userinfo['lastvisit']);
if($currentmonth == $lastvisitedmonth){
$userlastvisit = date("g:i a", $vbulletin->userinfo['lastvisit']);
$lastvisitday = date("j", $vbulletin->userinfo['lastvisit']);
$daytoday = date("j");
if($daytoday == $lastvisitday){
$timesuffix = "Today";
}
if(($daytoday -1) == $lastvisitday){
$timesuffix = "Yesterday";
}
echo "Last Visit: ".$userlastvisit." ".$timesuffix;
}
else {
$userlastvisit = date("g:i a, F j Y", $vbulletin->userinfo['lastvisit']);
echo "Last Visit: ".$userlastvisit;
}
//
echo "<br /><br />";
echo "<u>PM Stats</u><br />" ;
if($vbulletin->userinfo['pmunread'] != 0) {
echo "Unread: ";
if($vbulletin->userinfo['pmunread'] <= 1) {
echo $vbulletin->userinfo['pmunread'];
echo "<br />";
echo "Total:";
}
}
if($vbulletin->userinfo['pmunread'] != 1 AND $vbulletin->userinfo['pmunread'] <= 2 AND $vbulletin->userinfo['pmunread'] != 0) {
echo "Unread: ";
echo $vbulletin->userinfo['pmunread'];
echo "<br /><b>Total:</b>";
}
if($vbulletin->userinfo['pmunread'] == 0) {
echo "Unread: ";
echo $vbulletin->userinfo['pmunread'];
echo "<br />Total :";
}
echo $vbulletin->userinfo['pmtotal'];
echo "<br />";
echo "<br />";
echo "<a href=forum/login.php?$session[sessionurl]do=logout&logouthash=$logouthash";
echo $vbulletin->userinfo['logouthash'];
echo ">";
echo " Log Out";
echo "</a>";
}
if ($vbulletin->userinfo['userid'] == 0)
{
echo "
<style type=text/css>
<form action=forum/login.php method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
<script type=text/javascript src=forum/clientscript/vbulletin_md5.js></script>
<table cellpadding=0 cellspacing=$stylevar[formspacer] border=0>
<tr>
<td >Username:<br />
<input class=\"textbox\" name=vb_login_username type=text id=navbar_username accesskey=u tabindex=1 onfocus=if (this.value == '$vbphrase[username]') this.value = ''; size=15 />
<br />
Password:<br />
<input class=\"textbox\" name=vb_login_password type=password accesskey=p tabindex=2 size=15 /><br />
<label for=cb_cookieuser_navbar><input name=cookieuser type=checkbox id=cb_cookieuser_navbar accesskey=c tabindex=3 value=1 checked=checked />Remember</label><br /><br />
<input class=\"submit\" type=submit accesskey=s tabindex=4 title=$vbphrase[enter_username_to_login_or_register] value='Log In' />
<br />
<a href=\"http://trainhealthy.com/forum/login.php?do=lostpw\">Lost Password?</a> ||
<a href=\"http://trainhealthy.com/forum/register.php\">Register</a></td>
</tr>
</table>
<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>
<!-- / login form -->";
}
Anyhelp is appreciated!