I'm working on a project where the admin panel is just a shell that do some actions depending on what string you input. By shell i mean an input box where you type for example
delete user 1
and the user with id 1 is deleted. I have planned this for about 4 months and i have written all the commands that the app could manage. I have some problem to make this system. I was thinking about this solution:
$c = explode(' ', $input);
if ($c[0] == 'delete' and $c[1] == 'user' and count($c) === 3)
{
$c[2] = $id;
delete_user_by_id($id);
}
But i think it is not that well designed and i'm sure that it could be improved. I noticed that exists regular expression and that they could be better than this but i can't really figure out how to use them in the previous example. Any idea?
{Dize bir parçası (silmek kullanıcı VARIABLE) değişken olduğuna dikkat}