Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usages of MySQLi but not prepared statements. #22

Closed
JABirchall opened this issue Oct 2, 2014 · 1 comment
Closed

Usages of MySQLi but not prepared statements. #22

JABirchall opened this issue Oct 2, 2014 · 1 comment

Comments

@JABirchall
Copy link

I dont know why you decided to change from mysql to mysqli, Maybe it was because of the php warnings, maybe it was because you read up in why MySQL functions are being removed.

the fact is mysql and methods used to sanitize are not safe, PDO and MySQLi are safe if you use prepared statements.
example

$sql = "
    INSERT INTO
        `memory` (`name`, `type`, `target`, `value`, `created`, `modified`)
    VALUES (
        '".addslashes($name)."',
        '".addslashes($type)."',
        '".addslashes($target)."',
        '".addslashes($sql_value)."',
        NOW(),
        NOW()
)";

can be better sanitized with

$sql = "
    INSERT INTO `memory` (`name`, `type`, `target`, `value`, `created`, `modified`)
    VALUES (?,?,?,?,NOW(),NOW())
";
$this->MySQL->bind_param($name, $type, $target, $sql_value);// the variables can be assigned anytime after or before the prepare untill executed
// More code?
$this->MySQL->execute();

I would help you out but you state development is exclusive by you, BTW Im building a Twitch bot usiong you bot since nimda2 is outdated as off php 5.6 :P

@noother
Copy link
Owner

noother commented Oct 2, 2014

Satements like this are exactly why I want core-development to be exclusive to me..
The fact is™, mysql & methods to sanitize ARE safe IF you know what's happening and use them correctly.
So, sorry, not interested in prepared statements nor PDO - I neither want the negative performance impact by sanitizing unnecessary stuff, nor do I want 3 php statements instead of 1 - thanks anyway.

Prepared statements is not the only thing MySQLi introduced.

Nimda2 is completely outdated & just there for archival purposes.

@noother noother closed this as completed Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants