Code for the backend part (php code, system admin web gui, JSON apis)