Add session support.

Including codes in three parts:
1. Database script;
2. PHP API updates;
3. App API class update and some test code.