jakCheckuserdata($valid_username, $userpass); if ($user_check == true) { // Now login in the user and return tha data $user = $jakuserlogin->jakrestLogin($user_check, $userpass); // Get the user details $jakuser = new JAK_user($user); // Check if a sibling has logged in $opcacheid = $jakuser->getVar("id"); if ($jakuser->getVar("opid") != 0) { $opcacheid = $jakuser->getVar("opid"); } // Write the log file each time someone login after to show success JAK_base::jakWhatslog('', $opcacheid, $user_check["id"], 0, 2, 0, '', $user_check["username"], '', $valid_ip, ''); // finally update the push notification table if we need to do so, max 2 devices (One for Android and One for IOS) if (!empty($device) && !empty($token)) $jakuserlogin->jakWriteDeviceToken($jakuser->getVar("id"), $opcacheid, $device, $token, $appname, $appversion); // Only the SuperAdmin in the config file see everything if ($jakuser->jakSuperadminaccess($jakuser->getVar("id"))) { $superadmin = true; } else { $superadmin = false; } // Get the maximum upload or set to 2 $postmax = (ini_get('post_max_size') ? filter_var(ini_get('post_max_size'), FILTER_SANITIZE_NUMBER_INT) : "2"); // Cache stuff if (file_exists(APP_PATH.JAK_CACHE_DIRECTORY.'/opcache'.$opcacheid.'.php')) include_once APP_PATH.JAK_CACHE_DIRECTORY.'/opcache'.$opcacheid.'.php'; // timezone from server date_default_timezone_set(JAK_TIMEZONESERVER); $jakdb->query('SET time_zone = "'.date("P").'"'); // Return the json object die(json_encode(array('status' => true, 'userid' => strval($jakuser->getVar("id")), 'name' => $jakuser->getVar("name"), 'username' => $jakuser->getVar("username"), 'hash' => $jakuser->getVar("idhash"), 'email' => $jakuser->getVar("email"), 'picture' => JAK_FILES_DIRECTORY.$jakuser->getVar("picture"), 'responses' => strval($jakuser->getVar("responses")), 'files' => strval($jakuser->getVar("files")), 'transfer' => strval($jakuser->getVar("transferc")), 'permissions' => $jakuser->getVar("permissions"), 'superadmin' => $superadmin, 'postmaxsize' => $postmax, 'filetypes' => JAK_ALLOWEDO_FILES, 'urlabout' => "https://jakweb.ch", 'urlterms' => "https://jakweb.ch/terms-condition", 'urlprivacy' => "https://jakweb.ch/privacy"))); } } die(json_encode(array('status' => false, 'errorcode' => 4))); ?>