NameSilo

[Resolved] Don't know what's wrong

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

Mr Blockeel

Established Member
Impact
2
don't know what's wrong

Does anybody know why this script gives this error?
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\pokerday\jet_30\html\login0.php on line 18

The form is situated in login.php and the code below is login0.php

Code:
<?php

if (isset($_POST['submit'])) { // if form has been submitted

    /* check they filled in what they were supposed to and authenticate */
    if(!$_POST['uname'] | !$_POST['passwd']) {
        die('You did not fill in a required field.');
    }

    // authenticate.

    if (!get_magic_quotes_gpc()) {
        $_POST['uname'] = addslashes($_POST['uname']);
    }
	
    $qry = "SELECT username, password FROM users WHERE username = '".$_POST['uname']."'";
    $check = $db_object->query($qry);          /// this is line 18

    if (DB::isError($check) || $check->numRows() == 0) {
        die('That username does not exist in our database.');
    }

    $info = $check->fetchRow();

    // check passwords match

    $_POST['passwd'] = stripslashes($_POST['passwd']);
    $info['password'] = stripslashes($info['password']);
    $_POST['passwd'] = md5($_POST['passwd']);

    if ($_POST['passwd'] != $info['password']) {
        die('Incorrect password, please try again.');
    }

    // if we get here username and password are correct, 
    //register session variables and set last login time.

    $date = date('m d, Y');

    $qry = "UPDATE users SET last_login = '$date' WHERE username = '".$_POST['uname']."'";
    $update_login = $db_object->query($qry);

    $_POST['uname'] = stripslashes($_POST['uname']);
    $_SESSION['username'] = $_POST['uname'];
    $_SESSION['password'] = $_POST['passwd'];
    $db_object->disconnect();
?>

<h1>Logged in</h1>
<p>Welcome back <?php echo $_SESSION['username']; ?>, you are logged in.</p>

<?php

} else {    // if form hasn't been submitted

?>
ga naar member.php
<?php
}
?>

problem resolved, thanks to the help of my brother who just came home
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
looks like the connection to the DB failed as $db_object was not a valid connection resource.
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back