Hallo, i'm Italian and my english is very poor ... i hope you can understand me.
I have some functions built by another programmer, these functions can be called from an admin panel in a textbox (used by secretaries .. nice secretaries) who can fail the parameters or the name of the function.
I want to control if the function written by the user is right and can be saved in the database.
Can anyone help me? I've tried to catch the errors from the eval way, but i discovered that is impossible! ;-(
Thanks at all
Marco
Check user function syntax
Moderator: General Moderators
Re: Check user function syntax
Post some code and we'll see what we can do.
-
superblood
- Forum Newbie
- Posts: 2
- Joined: Thu May 20, 2010 5:26 pm
Re: Check user function syntax
Stupid example, only for understand
This is the functions of the other programmer
Here is the form who use the users
When user press "Save Changes" i want to control in "goform.php" the syntax of the mess written in the textbox "function" before save it in the database.
For example .. if the user insert in the textbox "function" a value like this "example2 (1)" or "esample2 (1,2)" i want to alert him of his mistake before save.
I hope you can understand me...
This is the functions of the other programmer
Code: Select all
function example ($par1,$par2){
echo "$par1 <---->$par2";
}
function example2 ($rap1,$rap2){
$par = $par1 + $par2;
echo "$par <---";
}
Code: Select all
<form name="formexample" method="POST" action="goform.php">
<input type="text" name="function" value="">
<input type="submit" value="Save Changes">
</form>
For example .. if the user insert in the textbox "function" a value like this "example2 (1)" or "esample2 (1,2)" i want to alert him of his mistake before save.
I hope you can understand me...
Re: Check user function syntax
Oh, I see. You're talking about data validation.
The best thing you can do is to go look up some tutorials on data validation in PHP, I'm sure you can find some in Italian.
The best thing you can do is to go look up some tutorials on data validation in PHP, I'm sure you can find some in Italian.