} if ($_POST['group'] > 0) { $return['players'] = readPlayersByGroup($conn, $_POST['group']); } else { if ($_POST['player'] > 0) { $return['characters'] = readCharactersByPlayer($conn, $_POST['player']); $return['groups'] = readGroupsByPlayer($conn, $_POST['player']); } } } else { if ($_POST['type'] == 'readData') { $return['instanceTypes'] = readInstanceTypes($conn); $return['instances'] = readInstances($conn); $return['paths'] = readPaths($conn); $return['professions'] = readProfessions($conn); $return['categories'] = readCategories($conn); if ($_POST['page'] == 'Guilds') { $return['groups'] = readGroups($conn); } else { if ($_POST['page'] == 'Players') { $return['players'] = readPlayers($conn); } } } else { if ($_POST['type'] == 'readProfessions') { $return['professions'] = readProfessions($conn); } else { $message = "Site error. Action not recognized."; $success = false; } }
$conn = new PDO('mysql:host=' . $servername . ';dbname=' . $database, $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($type == "login") { $message = "Login successful"; } else { if ($type == "readData") { $groups = readGroups($conn); $players = readPlayers($conn); $characters = readCharacters($conn); $records = readRecords($conn); $professions = readProfessions($conn); $gameBuilds = readGameBuilds($conn); $instances = readInstances($conn); $paths = readPaths($conn); $categories = readCategories($conn); $instanceTypes = readInstanceTypes($conn); $message = "Login successful"; } else { if ($type == "readRulesets") { $rulesets = readRulesets($conn); $message = "Rules read."; } else { if ($type == "addGroup") { $message = addGroup($conn); $groups = readGroups($conn); } else { if ($type == "editGroup") { $message = editGroup($conn); $groups = readGroups($conn); $players = readPlayers($conn);