Forum Moderators: coopster
$dbh = mysql_connect($user,$pass,$host);
Obviously there are a number of functions to properly sanitize data before it is entered (mysql_real_escape_string etc.) and there are the options of storing the db connection info above the document root, but how many people generally setup more then once connection string parameter?
e.g
$dbr = mysql_connect($r_user, $r_pass,$host);
A wordpress site for instance could have a front-end db_user that only has read access to post tables and write to comments.
Any thoughts on this and do people believe it should be more documented to users that these options exist?
absolutely i do, it's not overkill, it's easy to do. the 'web' user should only have permissions to do what it needs to do and for the tables it needs to do it on, so should any other user you have.
i also make a lot of use of stored procedures and functions, which though not as mature as those available for sqlServer are still useful and used correctly also add a layer of 'security'
Do you notice much of a performance increase in Sprocs VS Mysqli VS inline mysql?
Do you also think that a lot more attention should be paid towards these extra layers in security for sites, or do you believe those that actually need to be aware of it are?
i.e a blog site that gets hacked might be a big blow to a user, but the security implications might not be as big compared to an ecommerce site. Then again casual users might be comfortable enough to setup mysql users but just aren't aware of the benefits..
>> or do you believe those that actually need to be aware of it are?
absolutely not, they aren't. there are a great many developers working on their own, either just with their own sites or a few clients and they are not aware of the benefits of different user permissions, when i started i learnt just from books and online tutorials, just as many others do ... and i don't remember learnign much about that security stuff at all - i got lucky and wised up before a disaster struck, however you only have to read the number of threads started here every time there is a new wave of sql injection attacks doing the rounds to see how widespread the issue is and how setting simple permissions could have saved a lot of people.
I guess a lot of the limitations with users actually come from shared hosting packages. Many people use a console to setup their DB users and they're automatically granted rights for everything in the DB. It's certainly something I'm more aware of now, but then again I've got my own server so these issues are a bit more on my radar these days. It's certainly something I'm paying a lot more attention to now and I will definitely try to inform others when answering queries around here