I am in need of some advice on how to best process code to keep things running efficiently while still returning dynamic strings to the user.
In my particular situation, I have a set of string responses that vary based on a set of six variables. Early in the project, it was easy to simply use nested if and switch statements. However, as the project advances, this set of code is becoming massive. I would very much like find a way to store this information in a database, but I am unaware of a way to do so that doesn't open up the database to vulnerabilities.
A sample script might look like the following:
printf("Let's say for a moment here, that I want to have a script that is something like this where, ". $yourname ." is printed as well as other pieces of information stored from a database such as: ".$yourfavoritefood." or ".$timesinceloggedon.". Clearly this output will be different from person to person.");
Now imagine I have hundreds of these variable driven scripts. Is there a way to SECURELY store scripts in a mysql database so that I can query only the script I need given the program driven variables at the time?