<?php session_start(); header('Content-Type: application/json'); include "classes.php"; $conf = new Config('kamil', substr(md5($_GET['password']), 0, 20)); $conn = new connection($conf); $jsonResult = new JSON(array(), null, array()); if ($conn->error) { $jsonResult->json_data['result_code'] = JSON::$resultCodes['token_error']; } else { $jsonResult->json_data['result_code'] = JSON::$resultCodes['access_granted']; $jsonResult->json_data['result_token'] = substr(md5($_GET["password"]), 0, 20); $_SESSION['password'] = $jsonResult->json_data['result_token']; } print $jsonResult->PrepareJSON();