Files
cwsvJudo/homepage/redesign2018/markdownExperiment/wkParticipo/addFahrt.php
marko 21922347d3 Ereignisse brauchen nicht mehr zwingend einen Wettkampf im
Wettkampfkalender

- Die Ereignisse wurden um ihr Datum erweitert
- Daten, die sonst aus dem Wettkampfeintrag des zugehörigen Wettkampfes
gezogen worden wären, müssen jetzt als json in die Bemerkunksspalte
geschrieben werden
- Events ohne zugehörigen Wettkampf im Wettkampfkalender müssen
momentan noch per Hand eingefügt werden. Es gibt keine Oberfläche
dafür.

Changes to be committed:
	modified:   addFahrt.php
	modified:   addStarter.php
	modified:   addStarterDev.php
	modified:   admin/adminAddStarter.php
	modified:   admin/newsLetter.php
	modified:   admin/showEvent.php
	modified:   admin/showFahrt.php
	modified:   auth.php
	modified:   authLogin.php
	modified:   index.php
	modified:   lib/wkParticipoLib.inc.php
	modified:   showWkEvent.php
2018-11-29 15:57:22 +01:00

94 lines
3.9 KiB
PHP

<?php
//var_dump($_POST);
require_once('./local/db.php.inc');
require_once('./local/wkParticipoConf.php.inc');
require_once('./auth.php');
require_once('./lib/wkParticipoLib.inc.php');
$message = array();
if(!empty($_POST)){
if( empty($_POST['f']['eventId']) ){
$message['error'] = 'ERR: Fehlende eventId!';
die("ERR: Fehlende eventId!");
}
else{
// print_r($_POST['f']['anzPlaetze']);
if( !empty($_POST['f']['anzPlaetze']) ){
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqli->connect_error) {
$message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;
}
$query = sprintf(
"INSERT INTO wkParticipo_Fahrten (eventId, fahrerId, plaetze) values (%s, %s, %s);",
$mysqli->real_escape_string($_POST['f']['eventId']),
$mysqli->real_escape_string($_SESSION['user']['userId']),
$mysqli->real_escape_string($_POST['f']['anzPlaetze'])
);
$result = $mysqli->query($query);
if(!$result){
//echo "Fehler bei der Meldung: " . mysql_error(); die($query);
echo "Fehler bei der Meldung: "; die($query);
}
$message['success'] =
"Neue Fahrt für eventId " . $_POST['f']['eventId'] . " mit " . $_POST['f']['anzPlaetze'] . " hinzugefügt";
$userData = getUserData($mysqli, $_SESSION['user']['userId']);
$eventData = getWkEventData($mysqli, $_POST['f']['eventId']);
$wkData = getWkData($mysqli, $eventData['wkId']);
$notificationMail['to'] = $userData['eMail'];
$notificationMail['subject'] = "=?UTF-8?B?".base64_encode("Fahrtbestätigung")."?=";
$notificationMail['message'] = "Fahrt zum Wettkampf " . mb_convert_encoding($wkData['Veranstaltung'], 'UTF-8', 'ISO-8859-1') . " mit ".$_POST['f']['anzPlaetze']." Plätzen 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'] );
}
header('Location: http://' . $_SERVER['HTTP_HOST'] . $wkParticipoConf['rootDir'] . '/index.php');
$mysqli->close();
}
}
} else {
$message['notice'] = 'Übermitteln Sie das ausgefüllte Formular um ein neues Event zu erstellen.';
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Wettkampfplaner - Meldung</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqli->connect_error){
$message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;
}
$eventData = getWkEventData($mysqli, $_POST['f']['eventId']);
$wkData = getWkData($mysqli, $eventData['wkId']);
?>
<div id="meldungsBox">
<ul>
<li>F&uuml;r Wettkampf: <?php echo mb_convert_encoding($wkData['Veranstaltung'], 'UTF-8', 'ISO-8859-1')?></li>
</ul>
<form action="./addFahrt.php" method="post">
<input type="hidden" name="f[eventId]" id="eventId"<?php echo isset($_POST['f']['eventId']) ? ' value="' . htmlspecialchars($_POST['f']['eventId']) . '"' : '' ?> />
Anzahl Plätze: <input type="text" name="f[anzPlaetze]">
<button type="submit" name="submit">Fahrt anmelden</button>
</form>
</div>
<div><a href="./index.php">Zur&uuml;ck zur &Uuml;bersicht</a></div>
<?php $mysqli->close();?>
</body>
</html>