Merge commit 'stash' into redesign2018
This commit is contained in:
94
homepage/wkParticipo/addFahrt.php
Normal file
94
homepage/wkParticipo/addFahrt.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
require_once('./local/db.php.inc');
|
||||
require_once('./local/wkParticipoConf.php.inc');
|
||||
require_once('./auth.php');
|
||||
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: "; 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ü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ück zur Übersicht</a></div>
|
||||
<?php $mysqli->close();?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user