php bugfix
split code into frontend and backend php files