// we format data if ($field_list[$j] == 'weather_id' and $id_search = array_search($_POST['data'][$i][$j], $new_weather)) { $value_list[$j] = $id_search; } elseif ($field_list[$j] == 'field_state_id' and $id_search = array_search($_POST['data'][$i][$j], $new_field_state)) { $value_list[$j] = $id_search; } elseif ($field_list[$j] == 'field_id' and $id_search = array_search($_POST['data'][$i][$j], $new_field)) { $value_list[$j] = $id_search; } elseif ($field_list[$j] == 'competition_id' and $id_search = array_search($_POST['data'][$i][$j], $new_competition)) { $value_list[$j] = $id_search; } elseif ($field_list[$j] == 'club_home_id' and $id_search = array_search($_POST['data'][$i][$j], $new_club)) { $value_list[$j] = $id_search; } elseif ($field_list[$j] == 'club_visitor_id' and $id_search = array_search($_POST['data'][$i][$j], $new_club)) { $value_list[$j] = $id_search; } if ($field_list[$j] == 'match_date') { $value_list[$j] = convert_date_sql($_POST['data'][$i][$j]); } if ($field_list[$j] == 'club_home_id') { $tmp_club_home = explode('_', $_POST['data'][$i][$j]); $value_list[$j] = $tmp_club_home[0]; if (isset($tmp_club_home[1]) and $tmp_club_home[1] != '') { $field_list[$nb_column + 1] = 'team_home_id'; $value_list[$nb_column + 1] = $tmp_club_home[1]; $field_value_list[$nb_column + 1] = $field_list[$nb_column + 1] . "='" . $value_list[$nb_column + 1] . "'"; } } if ($field_list[$j] == 'club_visitor_id') { $tmp_club_visitor = explode('_', $_POST['data'][$i][$j]); $value_list[$j] = $tmp_club_visitor[0]; if (isset($tmp_club_visitor[1]) and $tmp_club_visitor[1] != '') { $field_list[$nb_column + 2] = 'team_home_id';
# avatar if (isset($_POST['avatar']) and !empty($_POST['avatar']) and !check_url($_POST['avatar'])) { $page['erreur'][$nb_erreur]['message'] = $lang['member']['E_invalid_avatar']; $nb_erreur++; } # there is no error in submited datas if ($nb_erreur == 0) { $_POST['status'] = 0; // simple member $_POST['valid'] = -1; // we ask for an activation if (isset($_POST['pass_member'])) { $_POST['pass_md5'] = md5($_POST['pass_member']); } if (isset($_POST['date_birth']) and !empty($_POST['date_birth'])) { $_POST['date_birth'] = convert_date_sql($_POST['date_birth']); } if (!isset($_POST['sex'])) { $_POST['sex'] = ""; } # we save data $sql_add = sql_replace($sql['member']['insert_member_registration'], $_POST); $sgbd = sql_connect(); $execution = sql_query($sql_add); if ($execution) { $page['L_message'] = $lang['member']['form_registration_add_1']; $page['value_id'] = sql_insert_id($sgbd); # we send an email if (MAIL == 1 and REGISTRATION_MAIL == 1) { $var['firstname'] = $_POST['login']; $var['site_title'] = SITE_TITLE;
$page['erreur'][$nb_erreur]['message'] = $lang['news']['E_empty_release']; $nb_erreur++; } elseif (!check_date($_POST['release'])) { $page['erreur'][$nb_erreur]['message'] = $lang['news']['E_invalid_release']; $nb_erreur++; } if (isset($_POST['release_time']) and !empty($_POST['release_time']) and !check_hour($_POST['release_time'])) { $page['erreur'][$nb_erreur]['message'] = $lang['news']['E_invalid_release_time']; $nb_erreur++; } $_POST['member'] = $_SESSION['session_member_id']; if ($nb_erreur == 0) { if (empty($_POST['release_time'])) { $_POST['release_time'] = '00:00'; } $_POST['release'] = convert_date_sql($_POST['release']); $_POST['release'] .= " " . $_POST['release_time']; /* cas d'un premier add */ if (empty($_POST['id']) and $right_user['add_news']) { $sgbd = sql_connect(); $sql_add = sql_replace($sql['news']['insert_news'], $_POST); if (sql_query($sql_add) != false) { $page['L_message'] = $lang['news']['form_news_add_1']; } else { $page['L_message'] = $lang['news']['form_news_add_0']; } $page['value_id'] = sql_insert_id($sgbd); sql_close($sgbd); } elseif ($right_user['edit_news']) { $sql_edit = sql_replace($sql['news']['edit_news'], $_POST); $sgbd = sql_connect();
$page['value_day'] = $ligne['match_day']; $page['value_field_state'] = $ligne['field_state_id']; $page['value_field'] = $ligne['field_id']; $page['value_weather'] = $ligne['weather_id']; $page['value_date'] = convert_date($ligne['match_date'], $lang['match']['format_date_form']); $page['value_hour'] = convert_date($ligne['match_date'], $lang['match']['format_hour_form']); if ($page['value_hour'] == "00:00") { $page['value_hour'] = ""; } $page['value_score_visitor'] = $ligne['match_score_visitor']; $page['value_score_home'] = $ligne['match_score_home']; $page['value_spectators'] = $ligne['match_spectators']; $page['value_comment'] = $ligne['match_comment']; } # On determine la season dans laquelle se joue le match $var['date'] = convert_date_sql($page['value_date']); include_once create_path("competition/sql_competition.php"); $sql_season = sql_replace($sql['competition']['select_season_date'], $var); $sgbd = sql_connect(); $res_season = sql_query($sql_season); $ligne_season = sql_fetch_array($res_season); sql_free_result($res_season); sql_close($sgbd); $page['value_season'] = $ligne_season['season_id']; # liste des clubs include_once create_path("club/sql_club.php"); include_once create_path("club/lg_club_" . LANG . ".php"); include_once create_path("club/tpl_club.php"); $var['condition'] = ""; $var['order'] = ""; $var['limit'] = "";
} } } if (isset($var['value_team']) and !empty($var['value_team'])) { $join .= " INNER JOIN " . T_team_player . " AS ej ON ej.member_id=m.member_id "; array_push($condition, " ej.team_id = '" . $var['value_team'] . "' "); } if (isset($var['value_season']) and !empty($var['value_season'])) { array_push($condition, " mc.season_id='" . $var['value_season'] . "' "); } if (isset($var['value_date_start']) and check_date($var['value_date_start'])) { $join .= " INNER JOIN " . T_season . " AS s ON s.season_id=mc.season_id "; if (isset($var['value_team']) and !empty($var['value_team'])) { $join .= " AND s.season_id=ej.season_id "; } $var['value_date_start'] = convert_date_sql($var['value_date_start']); array_push($condition, " (s.season_date_start <='" . $var['value_date_start'] . "' AND s.season_date_end >= '" . $var['value_date_start'] . "') "); } if (isset($var['value_referee']) and $var['value_referee'] == 1) { array_push($condition, " m.level_id!='0' "); } if (isset($var['value_member']) and !empty($var['value_member'])) { array_push($condition, " m.member_id NOT IN (" . $var['value_member'] . ") "); } if (isset($var['value_member_in']) and !empty($var['value_member_in'])) { array_push($condition, " m.member_id IN (" . $var['value_member_in'] . ") "); } if (isset($var['value_group']) and !empty($var['value_group'])) { array_push($condition, " m.member_status='" . $var['value_group'] . "' "); } if (isset($var['value_name']) and !empty($var['value_name'])) {
} if (!isset($_POST['date_end']) or empty($_POST['date_end'])) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_empty_date_end']; $nb_erreur++; } elseif (!check_date($_POST['date_end'])) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_invalid_date_end']; $nb_erreur++; } if (isset($_POST['date_start']) and isset($_POST['date_end']) and !empty($_POST['date_start']) and !empty($_POST['date_end']) and convert_date_sql($_POST['date_start']) > convert_date_sql($_POST['date_end'])) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_invalid_dates']; $nb_erreur++; } # there is no error in submited datas if ($nb_erreur == 0) { $_POST['date_start'] = convert_date_sql($_POST['date_start']); $_POST['date_end'] = convert_date_sql($_POST['date_end']); # case : new item to add if (!isset($_POST['id']) or empty($_POST['id'])) { $sql_add = sql_replace($sql['competition']['insert_season'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_add) != false) { $page['L_message'] = $lang['competition']['form_season_add_1']; } else { $page['L_message'] = $lang['competition']['form_season_add_0']; } sql_close($sgbd); } else { $sql_modification = sql_replace($sql['competition']['edit_season'], $_POST); $sgbd = sql_connect(); if (sql_query($sql_modification) != false) { $page['L_message'] = $lang['competition']['form_season_edit_1'];