before switch to resource.php for actions server side
use resource.php and functions.php instead of many php