# Part 1
1. open the Admin Console login page
2. confirm, that:
* either there is no `adm_sid` cookie
* or there is no records in the `UserSessions`/ `UserSessionData` tables related to session key from the `adm_sid` cookie
3. replace `$application->Run();` code in the `/admin/index.php` with the following code:
```
lang=php
$application->StoreVar('name1', 'value1');
$application->Session->SaveData();
$application->StoreVar('name2', 'value2');
$application->Session->SaveData();
$application->Session->SetField('TimeZone', 'Asia/Hong_Kong');
$application->Session->SaveData();
$application->Session->SetField('Theme', '555');
$application->Session->SaveData();
```
4. open the Debugger Report
5. confirm, that SQLs, that interact with the session-related tables (see above) look like this (irrelevant values replaced with `...`):
* setting 1st session data into related table:
```
INSERT INTO UserSessions (`PortalUserId`,`Language`,`Theme`,`GroupId`,`GroupList`,`IpAddress`,`SessionKey`,`LastAccessed`,`BrowserSignature`)lang=sql
VALUES ('...','...','999','...','...','...','790994740','...','...');INSERT INTO UserSessions (`PortalUserId`,`Language`,`Theme`,`GroupId`,`GroupList`,`IpAddress`,`SessionKey`,`LastAccessed`,`BrowserSignature`)
VALUES ('...','...','999','...','...','...','790994740','...','...');
REPLACE INTO UserSessionData (SessionKey, VariableName, VariableValue)
VALUES ('175175914', 'UserGroups', '14'),('175175914', 'user_id', '-2'),('175175914', 'curr_iso', 'USD'),('175175914', 'name1', 'value1'),('175175914', 'admin', '1'),('175175914', 'last_template', 'index.php|-login%3Am0--1--u-'),('175175914', 'last_template_popup', 'index.php|-login%3Am0--1--s-'),('175175914', 'last_url', '/d/in-portal.52x/admin/index.php?env=-login%3Am0--1--s-&next_template=index'),('175175914', 'last_env', '-login%3Am0--1--s-');
```
* setting 2nd session data into related table:
```
lang=sql
REPLACE INTO UserSessionData (SessionKey, VariableName, VariableValue)
VALUES ('662547442', 'name2', 'value2');
```
* setting 3rd session data into related table:
```
lang=sql
UPDATE UserSessions
SET TimeZone = 'Asia/Hong_Kong'
WHERE SessionKey = '662547442';
```
* setting 4th session data into related table:
```
lang=sql
UPDATE UserSessions
SET Theme = '555'
WHERE SessionKey = '662547442';
```
# Part 2
1. restore contents of the `/admin/index.php` file
2. delete all cookies (or at least delete `adm_sid` and `adm_sid_live` cookies)
3. reload the page (you should be still on Admin Login page)
4. add following code to the end of the `\UsersEventHandler::OnAfterLogin` method (file: `core/units/users/users_event_handler.php`):
```
lang=php
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'UserSessions
WHERE SessionKey = ' . $this->Conn->qstr($this->Application->GetSID());
$fields_hash = $this->Conn->GetRow($sql);
echo '<pre>', print_r($fields_hash), '</pre>';
exit;
```
5. perform login
6. confirm, that following info will be displayed (irrelevant values replaced with `...`):
```
Array
(
[SessionKey] => 673153364
[LastAccessed] => ...
[PortalUserId] => ...
[Language] => ...
[Theme] => 999
[GroupId] => ...
[IpAddress] => ...
[Status] => 1
[GroupList] => ...
[TimeZone] => ...
[BrowserSignature] => ...
)
```