46 useful PHP code snippets
blog.koonk.com
46 useful PHP code snippets
1–10 of 26 posts
Re: 46 useful PHP code snippets
#2I stopped at #3...using stripslashes is not an acceptable deterrent by any means. I am also unsure how htmlentities has anything to do with SQL injection...maybe you meant XSS prevention? I chose not to read the rest.
Re: 46 useful PHP code snippets
#3They are NOT useful, rather harmful. Oh Boy
Re: 46 useful PHP code snippets
#446 bad example PHP code snippets
Re: 46 useful PHP code snippets
#5I stopped at #3...using stripslashes is not an acceptable deterrent by any means. I am also unsure how htmlentities has anything to do with SQL injection...maybe you meant XSS prevention? I chose not to read the rest.
Yeah, just logged in to say that. Author probably never heard of PDO and parametrized queries...
Re: 46 useful PHP code snippets
#6I stopped at #3...using stripslashes is not an acceptable deterrent by any means. I am also unsure how htmlentities has anything to do with SQL injection...maybe you meant XSS prevention? I chose not to read the rest.
Oh wow. So happy not having to read such things anymore.
Re: 46 useful PHP code snippets
#7I stopped at #3...using stripslashes is not an acceptable deterrent by any means. I am also unsure how htmlentities has anything to do with SQL injection...maybe you meant XSS prevention? I chose not to read the rest.
100% agreed, I have the same sentiment. In the year 2015, everyone should know about injections and how to use prepared statements and similar insertion mechanisms that clearly separate query from data. A big no-no to solve anything with the presented function.
Re: 46 useful PHP code snippets
#8This doesn't look like the most professionally put together set of snippets I've ever seen. For example:
function is_validemail($email)
{
$check = 0;
if(filter_var($email,FILTER_VALIDATE_EMAIL))
{
$check = 1;
}
return $check;
}
is a long-winded way of doing: function is_validemail($email)
{
return filter_var($email, FILTER_VALIDATE_EMAIL) ? 1 : 0;
}Re: 46 useful PHP code snippets
#9Rocking compact() niiiice. Probably helpful for your average Wordpress developer, beyond that kind of yikes.
Re: 46 useful PHP code snippets
#1020. mysql_connect is depreciated, you should use mysqli_connect