You are here: eval() is insecure, but what are the alternatives? « PHP Programming Language « IT news, forums, messages
eval() is insecure, but what are the alternatives?

Posted by werner on 01/20/06 09:28

Hi!

I don't want to use eval() in order to parse a user-supplied formula.
What alternatives do I have? PHP has no standard functionality for
tokenizing or parsing expressions in this regard.

Here is a simple example: The user supplies the following formula in
string format,
"a = (6+10)/4",
and the script needs to find out what the value of 'a' is.

How can I go about it without using eval(), since using eval in this
case could be very risky! (The user can supply *any* expression, as
there is no function that can determine the meaning of the string as an
expression).

Thank you for taking the time t read my question.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация