So, I was wondering if this is enough to be sure that the user will not make any SQL injections, and the number will be always and only integer? The $ id function in the getArticle function is bound to the SQL query.
<?php $id = (isset($_GET['id']) && is_int((int)$_GET['id'])) ? (int)$_GET['id'] : false ?> <?php $news = $class->getArticle($id) ?>
As far as I tested, it worked fine, but since I'm not quite sure, I rather ask you, man! Well, people say prepared statements will do the trick. Would they really be? For example, can I be absolutely sure that if the binding parameter is an integer, will it be an integer larger?
Thanks in advance!
php sql-injection mysqli
Rihards
source share