MyBB Community Forums

Full Version: Fatal error: Call to a member function get() on a non-object in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am working on a heavily customised portal and have a problem with a contact us page.

I got the contact form somewhere on the mybb site and when logged in to the site it works fine but when viewing the page as a guest they see the rest of the page but where the form should be is:

Quote:Fatal error: Call to a member function get() on a non-object in /home/techmonk/public_html/inc/plugins/pagemanager.php(803) : eval()'d code on line 185

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<link type="text/css" rel="stylesheet" href="http://www.techmonkeys.co.uk/cache/themes/theme5/global.css" />
<link type="text/css" rel="stylesheet" href="http://www.techmonkeys.co.uk/cache/themes/theme5/ads.css" />
<link type="text/css" rel="stylesheet" href="http://www.techmonkeys.co.uk/cache/themes/theme5/topmenu.css" />
<link type="text/css" rel="stylesheet" href="http://www.techmonkeys.co.uk/cache/themes/theme5/forummenu.css" />
<link type="text/css" rel="stylesheet" href="http://www.techmonkeys.co.uk/cache/themes/theme5/portal.css" />

<title>Techmonkeys Ltd - Making I.T. Work</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

</head>
<body>
<div class="main">
  <div class="header">
    <div class="header_resize">
      <div class="logo">
        <h1><a href="index.html"><span>Tech</span>Monkeys<small>Making I.T. work</small></a></h1>
      </div>
      <div class="menu_nav">
        <ul>
          <li class="active"><a href="index.html">Home</a></li>
          <li><a href="blog.html">Services</a></li>
          <li><a href="about.html">About Us</a></li>
          <li><a href="contact.html">Contact Us</a></li>
          <li><a href="index.php">Forums</a></li>

        </ul>
      </div>
      <div class="clr"></div>
      <div class="hbg"><img src="tmimages/header_images.png" width="430" height="315" alt="" class="fl" />
        <div class="info fl">
          <h3>because we  <br />
            love I.T.</h3>
        </div>
        <div class="clr"></div>
      </div>
      <div class="clr"></div>

    </div>

  </div>
  <div class="header_footer">
      <div class="phone_container">
          <div class="callback">
                <a href="#"><img src="tmimages/callback.png" alt="Request a free callback" title="Request a free callback" /></a>
         </div>
          <div class="phone_no">
              0845 621 6660
         </div>

<div class="searchcontainer">
    <div class="search">
            <form method="get" id="search" action="#">
              <span>
              <input type="text" value="Search..." name="s" id="s" />
              <input name="searchsubmit" type="image" src="tmimages/search.gif" value="Go" id="searchsubmit" class="btn"  />
              </span>
            </form>
            <div class="clr"></div>
          </div>
        </div>
  </div>

<br />
  </div>
  <div class="content">
    <div class="content_resize">

        <div class="pagecontentcontainer">

            <div class="pagecontenttop">

            </div>

            <div class="pagecontent">

<?php


global  $lang;

$lang->load('member');
$lang->load('messages');
$lang->load('datahandler_user');

$subject = htmlspecialchars_uni(trim($mybb->input['subject']));
$message = htmlspecialchars_uni(trim($mybb->input['message']));

$name = htmlspecialchars_uni(trim($mybb->input['name']));
$email = htmlspecialchars_uni(trim($mybb->input['email']));

$usertemplate = '<tr>
<td width="30%" ><strong>{$lang->full_name}</strong></td>
<td width="70%" ><input type="text"  size="25" name="name" value="{$name}" /></td>
</tr>
<tr>
<td width="30%" ><strong>{$lang->email_address}</strong></td>
<td width="70%" ><input type="text"  size="25" name="email" value="{$email}" /></td>
</tr>';

$usertemplate = str_replace("\'", "'", addslashes($usertemplate));

eval("\$usertemplate = \"" . $usertemplate . "\";");



if($mybb->input['action'] == 'do_email' && $mybb->request_method == 'post')
{
	verify_post_check($mybb->input['my_post_key']);

	if(empty($name))
	{
		$errors[] = $lang->userdata_missing_username;
	}
	elseif(strpos($name, '<') !== false || strpos($name, '>') !== false || strpos($name, '&') !== false || my_strpos($name, '\\') !== false || strpos($name, ';') !== false || strpos($name, ',') !== false)
	{
		$errors[] = $lang->userdata_bad_characters_username;
	}

	if(empty($email))
	{
		$errors[] = $lang->userdata_missing_email;
	}
	elseif(!validate_email_format($email))
	{
		$errors[] = $lang->userdata_invalid_email_format;
	}

	if(empty($subject))
	{
		$errors[] = $lang->error_no_email_subject;
	}

	if(empty($message))
	{
		$errors[] = $lang->error_no_email_message;
	}

	if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])
	{
		$imagehash = $db->escape_string($mybb->input['imagehash']);
		$imagestring = $db->escape_string($mybb->input['imagestring']);
		$query = $db->simple_select('captcha', '*', 'imagehash="' . $imagehash . '"'); 
		$imgcheck = $db->fetch_array($query);
		if(my_strtolower($imgcheck['imagestring']) != my_strtolower($imagestring) || !$imgcheck['imagehash'])
		{
			$errors[] = $lang->error_regimageinvalid;
		}
		$db->delete_query('captcha', 'imagehash="' . $imagehash . '"');
	}

	if(count($errors) == 0)
	{
		if($mybb->settings['mail_handler'] == 'smtp')
		{
			$from = $email;
		}
		else
		{
			$from = $name . ' <' . $email . '>';
		}
		my_mail($mybb->settings['adminemail'], '[' . $mybb->settings['bbname'] . ' ' . $pages['name'] . '] ' . $subject, $message, $from, '', '', false, 'text', '', $email);

		redirect($mybb->settings['bburl'], $lang->redirect_emailsent);
	}
	else
	{
		$errors = inline_error($errors);
	}
}

if($mybb->settings['captchaimage'] == 1 && function_exists('imagepng') && !$mybb->user['uid'])
{
	$randomstr = random_str(5);
	$imagehash = md5(random_str(12));
	$imagearray= array(
		'imagehash' => $imagehash,
		'imagestring' => $randomstr,
		'dateline' => TIME_NOW
	);
	$db->insert_query('captcha', $imagearray);
	eval("\$captcha = \"" . $templates->get('post_captcha') . "\";");
}

$template = '
<div class="greyboxcontainer">
	<div class="greyboxtop">
	</div>
	<div class="greybox">

		<div class="formleft">
			{$errors}
			<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
			<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
			<table class="formtable">
			<thead>
			<tr>
			<td colspan="2" >
			<strong>' . $pages['name'] . '</strong>
			</td>
			</tr>
			</thead>
			<tbody>
			{$usertemplate}
			<tr>
			<td width="30%"><strong>{$lang->email_subject}</strong></td>
			<td width="70%"><input type="text" class="textbox" size="25" name="subject" value="{$subject}" /></td>
			</tr>
			<tr>
			<td valign="top" width="30%"><strong>{$lang->email_message}</strong></td>
			<td width="70%"><textarea cols="20" rows="5" name="message">{$message}</textarea></td>
			</tr>
			{$captcha}
			</tbody>
			</table>
			<br />
			<input type="hidden" name="action" value="do_email" />
			<div align="center"><input type="submit"  value="{$lang->send_email}" /></div>
			</form>
			<br />
		</div>
			
		<div class="formright">
		<iframe width="200" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&amp;source=s_q&amp;hl=en&amp;q=23+Beachill+Rd,+Havercroft,+Wakefield+WF4+2EJ,+United+Kingdom&amp;aq=&amp;sll=53.800651,-4.064941&amp;sspn=14.56721,43.286133&amp;ie=UTF8&amp;geocode=FaI9MgMdZ3nq_w&amp;split=0&amp;hq=&amp;hnear=23+Beachill+Rd,+Havercroft,+Wakefield+WF4+2EJ,+United+Kingdom&amp;z=14&amp;iwloc=A&amp;ll=53.624226,-1.410713&amp;output=embed"></iframe><br /><small><a href="http://maps.google.co.uk/maps?f=q&amp;source=embed&amp;hl=en&amp;q=23+Beachill+Rd,+Havercroft,+Wakefield+WF4+2EJ,+United+Kingdom&amp;aq=&amp;sll=53.800651,-4.064941&amp;sspn=14.56721,43.286133&amp;ie=UTF8&amp;geocode=FaI9MgMdZ3nq_w&amp;split=0&amp;hq=&amp;hnear=23+Beachill+Rd,+Havercroft,+Wakefield+WF4+2EJ,+United+Kingdom&amp;z=14&amp;iwloc=A&amp;ll=53.624226,-1.410713" style="color:#0000FF;text-align:left">View Larger Map</a></small>
			<br />Techmonkeys Ltd<br />
			23 Beachill Road<br />
			Havercroft<br />
			Wakefield<br />
			WF4 2EJ<br />
			<br />
			
		</div>
		<div class="clear"></div>
	</div>					
	<div class="greyboxbottom">
	</div>
	<br />

</div>

';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);

?>

            </div>

            <div class="pagecontentbottom">

            </div>

        </div>




      <div class="sidebar">
        <div class="gadget">
            <div class="nav_menu">
                <h2>Services</h2>
                    <ul>
                        <li><a href="#">Tailored I.T. Support</a></li>
                        <li><a href="#">Virtualisation</a></li>
                        <li><a href="#">off-site Backup</a></li>
                        <li><a href="#">Project Management</a></li>
                        <li><a href="#">24/7 System Monitoring</a></li>
                        <li><a href="#">Network Design</a></li>


                    </ul>
                <h2>About Us</h2>
                    <ul>
                        <li><a href="#">Blah</a></li>
                        <li><a href="#">Blah</a></li>
                        <li><a href="#">Blah</a></li>
                        <li><a href="#">Blah</a></li>
                        <li><a href="#">Blah</a></li>
                    </ul>
            </div>
       </div>

        <div class="gadget">
          <h2 class="star"><span>Latest Tweet:</span></h2>
          <div class="clr"></div>
          <div class="testi">
              <div class="quoteleft">
                <span class="q"><img src="tmimages/qoute_1.gif" width="20" height="15" alt="" /></span>
              </div>
                <div id="twitter_div">
                    <ul id="twitter_update_list">
                        <li>&nbsp;</li>
                    </ul>
                </div>

                <div class="quoteright">
                    <span class="q"><img src="tmimages/qoute_2.gif" width="20" height="15" alt="" /></span>
                </div>
          </div>
        </div>
      </div>
      <div class="clr"></div>
    </div>
  </div>
  <div class="fbg">
    <div class="fbg_resize">
      <div class="col c1">
        <h2><span>Stay in touch</span></h2>
        <div class="stayintouch">
            <div class="social">
                <a href="#"><img src="tmimages/facebook.png" alt="Facebook" title="Join us on Facebook" /></a>
            </div>
            <div class="social">
                <a href="#"><img src="tmimages/linkedin.png" alt="Linked In" title="Join us on Linked In" /></a>
            </div>
            <div class="clear"></div>
            <div class="social">
                <a href="#"><img src="tmimages/skype.png" alt="Skype" title="Call us on Skype" /></a>
            </div>
            <div class="social">
                <a href="#"><img src="tmimages/twitter.png" alt="Twitter" title="Follow us on Twitter" /></a>
            </div>
        </div>
      </div>
      <div class="col c2">
        <h2><span>IT Services and Solutions in:</span></h2>
        <p>
            <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Ackworth" title="IT support in Ackworth">Ackworth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Allerton" title="IT support in Allerton">Allerton</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Alwoodley" title="IT support in Alwoodley">Alwoodley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Bardsey" title="IT support in Bardsey">Bardsey</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Barkisland" title="IT support in Barkisland">Barkisland</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Boston Spa" title="IT support in Boston Spa">Boston Spa</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Bramhope" title="IT support in Bramhope">Bramhope</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Brighouse" title="IT support in Brighouse">Brighouse</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Castleford" title="IT support in Castleford">Castleford</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Clifton" title="IT support in Clifton">Clifton</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Dewsbury" title="IT support in Dewsbury">Dewsbury</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Farsley" title="IT support in Farsley">Farsley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Featherstone" title="IT support in Feathersone">Featherstone</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Garforth" title="IT support in Garforth">Garforth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Gomersal" title="IT support in Gomersal">Gomersal</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Guiseley" title="IT support in Guiseley">Guiseley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Harewood" title="IT support in Harewood">Harewood</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Headingley" title="IT support in Headingley">Headingley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Heath" title="IT support in Heath">Heath</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q= Hemsworth" title="IT support in Hemswroth">Hemsworth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Hepworth" title="IT support in Hepworth">Hepworth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=  Horsforth" title="IT support in Horsforth">Horsforth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Huddersfield" title="IT support in Huddersfield">Huddersfield</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Keighley" title="IT support in Keighley">Keighley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Kirkburton" title="IT support in Kirkburton">Kirkburton</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Knottingley" title="IT support in Knottingley">Knottingley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Ledsham" title="IT support in Ledsham">Ledsham</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Leeds" title="IT support in Leeds">Leeds</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Linton" title="IT support in Linton">Linton</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Liversedge" title="IT support in Liversedge">Liversedge</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Low Moor" title="IT support in Low Moor">Low Moor</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Marsden" title="IT support in Marsden">Marsden</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Oldfield" title="IT support in Oldfield">Oldfield</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Ossett" title="IT support in Ossett">Ossett</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Otley" title="IT support in Otley">Otley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Oulton" title="IT support in Outlton">Oulton</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q= Pontefract" title="IT support in Pontefract">Pontefract</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Pudsey" title="IT support in Pudsey">Pudsey</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Rawdon" title="IT support in Rawdon">Rawdon</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Riddlesden" title="IT support in Riddleston">Riddleston</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Ripponden" title="IT support in Ripponden">Ripponden</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Rothwell" title="IT support in Rothwell">Rothwell</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Rothwell Haigh" title="IT support in Haigh">Haigh</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Roydhouse" title="IT support in Roydhouse">Roydhouse</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Scarcroft" title="IT support in Scarcroft">Scarcroft</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=South Elmsall" title="IT support in Elmsall">Elmsall</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Stanningley" title="IT support in Stanningley">Stanningley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Tingley" title="IT support in Tingley">Tingley</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Todmorden" title="IT support in Todmorden">Todmorden</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Wadsworth" title="IT support in Wadsworth">Wadsworth</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Wakefield" title="IT support in Wakefield">Wakefield</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Walshford" title="IT support in Walshford">Walshford</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=West Tanfield" title="IT support in West Tanfield">West Tanfield</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Widdop" title="IT support in Widdop">Widdop</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Wike" title="IT support in Wike">Wike</a> | <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Wilsden" title="IT support in Wilsden">Wilsden</a>
        </p>
      </div>
      <div class="col c3">
          <div class="tmlatestthreads">
                <h2><span>Latest from <a href="/index.php">the forum</a></span></h2>


                    {$threadlist}


          </div>
<br />
      </div>
      <div class="clr"></div>
    </div>
  </div>
  <div class="footer">
    <div class="footer_resize">
      <p class="lf">&copy; Copyright <a href="#">Techmonkeys Ltd 2011</a>.</p>
      <p class="rf">Web Design and Development |  <a href="#" title="Web Design, Web Hosting, Web Developement">Techmonkeys.co.uk</a> </p>
      <div class="clr"></div>
    </div>
  </div>
</div>
</body>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/techmonkeys.json?callback=twitterCallback2&count=2"></script>
</html>

This is line 185

eval("\$captcha = \"" . $templates->get('post_captcha') . "\";");

Sorry I cant show you the page as it isnt live for guests yet, so unless you want to register at the www.techmonkeys.co.uk/index.php


Any ideas??
Add $templates variable in global, like this;
global $lang, $db, $mybb, $templates, $captcha;
Yaldaram your my hero, quick and correct Smile

Thank you!