echo json_encode($data); $ok = true; } else { header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); $data = array('error' => 2); echo json_encode($data); $ok = true; } } } } } if (strlen($request["username"]) && strlen($request["password"]) && strlen($request['cmd'])) { if (strcmp($request['cmd'], 'login') == 0) { if ($found = $userdata->checkLogin($request['username'], $request['password'])) { if ($found['enabled'] == 1) { $_SESSION['username'] = $request["username"]; $_SESSION['id'] = $found['id']; unset($_SESSION['project_id']); header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); $data = array('username' => $request["username"], 'SID' => session_id(), "mail" => $found['email']); echo json_encode($data); $ok = true; } else { header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); $data = array('disabled' => 11); echo json_encode($data); $ok = true;