Hi guys, I am working at a project and I want to let the users submit some code for testing(I know about the security riscks). Now I want to know if I should save the code in a database before running and testing it. If so, how can I make my server to check every second if new code was submitted or not(I am using laravel)?And can I open a new process for every code that need to be tested?
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Typically you want to avoid checking a database to determine when to perform an action, in your case, test the code the user submits. This is because polling a database like this, particularly every second, is very resource intensive. So, you might want to try just running the code when the user enters it, and then save it, thereby avoiding the whole "check the database" step, and just retrieve the code when the user needs it again (this is called event-driven programming, if you're curious). I'm afraid I can't offer any specifics on how to test the code using PHP (I'm more of a Java guy), but these are just some thoughts to keep in mind as you design your project.
Hope this helps!
It helps, thank you!