I have been trying to use PDO instead of the basic MySQL (I was told it may be deprecated). I keep getting this error:
Fatal error: Call to a member function rowCount() on a non-object in /home/stratusc/public_html/cgi-bin/ip-only/bta/action.php on line 70
My code is this: (WARNING HORRIBLE SYNTAX)
[syntax=php]if($_GET['do'] == 'login'){
$email = base64_encode('someGuy@me.com');
$email = str_replace('=','',$email);
$pass = 'test';
$filter1 = hash('gost', $email);
$salt = $db2->query("select * from salt where email = '".$filter1."'");
$salt = $salt->fetch();
$coresalt = $salt['coresalt'];
$salt1 = $salt['salt1'];
$salt2 = $salt['salt2'];
$salt3 = $salt['salt3'];
$pass = enc($pass,$email,$coresalt,$salt1,$salt2,$salt3);
$login_check = $db1->query("select * from usr where email = '$user' and password = '$pass' limit 1");
$login_check = $login_check->fetch();
$login_check = $login_check->rowCount();
if($login_check == 1){
echo 'Yes!';
}else{
echo 'No.';
}
die();
}[/syntax]
I'll try to explain what went on in my head to do this...
Well, all emails are stored in the SEPARATE password salts DB with a bit of base64 (to throw hackers off, if they gain access to my DB ) Then they are hashed in GOST. No idea why.
But basically, what I want is to count the number of rows with PDO. I have no clue how to stop this error. When I commented out all of the problematic code, it always said 'Yes!' no matter what I changed the password to.
Please help me
Oh, and i was told that if I prepare() then execute() I wouldn't need to do any sort of stripping. Is this true?
(Sorry if this made no sense, I haven't had any sleep in a long time...)