mysql - Execute User submitted sql safely -
i want execute user submitted sql code in server (for teaching purposes). can dangerous. want know better, if execute sql code (if there secure way this) or check if user code matches regular expression , show symbolic result.
the easiest , basic thing can limit account used webpage in first place.
give specific account privileges specific things specific database. disable i/o disk , other such features well.
be definition though, you must allow insert, create, delete, update statements.
furthermore 3 options:
create complete webapp
additionally, if possible give each user own account, sandboxed rest of schemas.
you create web application that:
- manages user accounts (registration, etc).
- creates separate databases each user.
- manages permissions sandbox each user in own schema.
- provides environment running queries.
provide them access php admin
give students access phpmyadmin, without administrator password. each student have own username, , access own database specific permissions.
limit users using select
if teaching basic select statements, , joins, can give specific account used web interface privileges that.
Comments
Post a Comment