如何解决“致命错误:在非对象上调用成员函数查询()”?

I have this script that I'm using, and on the index.php it's giving me this error from the code on line 15.

Fatal error: Call to a member function query() on a non-object

This is the entire index.php:

ob_start();
session_start();
if(file_exists("./install/install.lock"))
{
    print "You must delete install.php";
    exit;
}
elseif(file_exists("./install/update.lock"))
{
    print "You must delete update.php";
    exit;
}

$getuser = $os_DB->query("SELECT * FROM accounts WHERE id='".$_SESSION['userid']."'");
$ui      = $os_DB->fetch($getuser);

//Check if IP is banned
$ip = $_SERVER['REMOTE_ADDR'];
$checkbanned  = $os_DB->query("select * from banned where ip_addr='$ip'");

while($reason = $os_DB->fetch($checkbanned))
{
    if($os_DB->num($checkbanned) != 0) 
    {
        header("Location: site/banned");
    }
}
//check if ip is a proxy
require_once('includes/classes/ProxStop.php');

// Perform Lookup
$result = $ProxStop->proxyLookup($ip,$ref);

// The lookup failed, print the error message.
if($result===false)
{
    //echo 'The lookup failed with the error "'.$ProxStop->errors['code'].': '.$ProxStop->errors['msg'].'"';
}

// The IP is a proxy
elseif((int)$result->score>1)
{
    $os_DB->query("INSERT INTO banned VALUES ('$ip')");
    $os_DB->query("UPDATE accounts SET level=2 WHERE ip='$ip'");
    header("Location: site/banned");
}
//Save Referral
if($_GET['ref'] != "")
{
    $ref = $_GET['ref'];
    setcookie("Referral", $ref, time()+3600, "/", $domain);
}
if(!defined("OS_THEME"))
{
    print "This site has no theme defined";
    die();
}
else
{
    require_once($root . 'functions/functions.php');
    if($settings['captcha_type'] == 3)
    {
        require "securimage/securimage.php";
        $securimage = new Securimage();
    }
    include($root . 'header.php');
    include($root . 'action.php');
    include($root . 'footer.php');
}
?>

I'm not a programmer so I'm not sure what to do with this. I've read through other posts with issues similar but I don't know what to do.

Your problem is that $os_DB has not been defined. If you look at the code previous to line 15

$getuser = $os_DB->query("SELECT * FROM accounts WHERE id='".$_SESSION['userid']."'");

you'll see that this is the first time $os_DB has been used. You have to define $os_DB somehow. There's no indication what kind of object this should be but I imagine it's a type of database object like this:

$os_DB = new db();