} ### Variables Variables Variables $base_name = plugin_basename('likedome/admin/ranklist.php'); $base_page = 'admin.php?page=' . $base_name; $category = trim($_REQUEST['category']); define('LIKEDOME_PLUGINS_ROOT', dirname(dirname(__FILE__))); require_once LIKEDOME_PLUGINS_ROOT . '/config.php'; require_once LIKEDOME_PLUGINS_ROOT . '/includes/classes.php'; require_once LIKEDOME_PLUGINS_ROOT . '/includes/templatespart.php'; ### Determines Which Category It Is switch ($category) { // Add case 'addRankType': $matchTypeId = intval($_POST['matchTypeId']); $rankName = trim($_POST['rankName']); $succe = addRankType($matchTypeId, $rankName); if (!intval($succe)) { echo "比分类型添加失败"; return; } echo "比分类型添加成功"; break; // Del // Del case 'delRankType': $currentRankTypeSelect = intval($_POST['currentRankTypeSelect']); $succe = delRankType($currentRankTypeSelect); if ($succe != 1) { echo "删除比分类型失败"; return; }
/** * 添加比赛分类 */ function addMatchType($matchtype) { global $wpdb; if (!empty($matchtype)) { $result = $wpdb->insert('wp_likedome_match_type', array('type' => $matchtype)); if (intval($result)) { addRankType($result, '总分'); } } return $result; }