";
}
if( !isset($_POST['f']['type']) ){
$message['error'] .= "Fehlender type (".$_POST['f']['type'].") (POST: ".var_export($_POST, true).")
";
}
else{
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqlConn->connect_error) {
$message['error'] .= "Datenbankverbindung fehlgeschlagen: ".$mysqlConn->connect_error."
$wkEventData['meldefrist']){
$message['error'] .= "Die Meldefrist ist bereits abgelaufen!
";
}
else{
if( !isset($_POST['f']['userId']) ){
$query = sprintf(
"SELECT kinder FROM wkParticipo_Users WHERE id='%s';",
$mysqlConn->real_escape_string($_SESSION['user']['userId'])
);
$kinderResults = $mysqlConn->query($query);
if(!$kinderResults){
$message['warning'] .= "Fehler bei Abfrage der Kinder!
";
}
$kinderResult = $kinderResults->fetch_array();
$kinderIds = explode(',', $kinderResult['kinder']);
foreach($kinderIds as $kindId){
$query = sprintf("SELECT name, vorname FROM wkParticipo_Users WHERE id='%s';",
$mysqlConn->real_escape_string($kindId)
);
$kinderDaten = $mysqlConn->query($query);
if(!$kinderDaten){
$message['warning'] .= "Fehler bei Abfrage der Kinder!
";
}
if($mysqlConn->affected_rows != 1) $message['warning'] .= "Nicht eindeutige userId!
";
$kindDaten = $kinderDaten->fetch_array();
$meldungsBox =
"
Meldung".
"
".
"- Für Wettkampf: ".mb_convert_encoding($wkEventData['Veranstaltung'], 'UTF-8', 'ISO-8859-1')."
".
"- Für Starter: ".mb_convert_encoding($kindDaten['name'], 'UTF-8', 'ISO-8859-1').", ".mb_convert_encoding($kindDaten['vorname'], 'UTF-8', 'ISO-8859-1')."
".
"
".
"
";
}
}
else{
$userData = getUserData($mysqlConn, $_SESSION['user']['userId']);
$starterData = getUserData($mysqlConn, $_POST['f']['userId']);
// if(
// !in_array(
// $_POST['f']['userId'],
// explode(',', getUserData($mysqlConn, $_SESSION['user']['userId'])['kinder'])
// )
// ){
// $message['error'] .= "Es fehlt die Berechtigung diesen Starter zu melden!
";
// }
// else{
$message = addStarterToEvent($mysqlConn, $_POST['f']['userId'], $_POST['f']['eventId'], $_POST['f']['type']);
if( isset($message['success']) ){
$notificationMail['to'] = $userData['eMail'];
$notificationMail['subject'] = "=?UTF-8?B?".base64_encode("Meldebestätigung")."?=";
$notificationMail['message'] = $starterData['name'] . ", " . $starterData['vorname'] . " zum Wettkampf " . $wkData['Veranstaltung'] . " gemeldet. Diese Mail wurde automatisch vom Wettkampfplaner bei der Meldung versandt.";
$notificationMail['headers'] = "From: noreply.wettkampflaner@cwsvjudo.bplaced.net\r\n".
"Reply-To: cwsvjudo@arcor.de\r\n".
"X-Mailer: PHP/".phpversion()."\r\n".
"Content-Type: text/plain; charset=UTF-8";
if(!empty($notificationMail['to'])){
mail ( $notificationMail['to'] , $notificationMail['subject'] , $notificationMail['message'], $notificationMail['headers'] );
}
$notificationMail['to'] = $wkParticipoConf['adminEmail'];
if(!empty($notificationMail['to'])){
mail ( $notificationMail['to'] , $notificationMail['subject'] , $notificationMail['message'], $notificationMail['headers'] );
}
}
// }
}
}
}
$mysqlConn->close();
}
}
}
?>
Wettkampfplaner - Meldung
zum Wettkampf gemeldet!