function importFile($fileName) { $reg = parseLines(file($fileName)); if (isRegistrationAlreadyImported($reg)) { throw new Exception('Similar competitor already exists.'); } insertRegistration($reg); }
} function contactForm($connection, $name, $email, $betreff, $categories, $message) { $to = "*****@*****.**"; $from = "Kontakformular von " . $name . " Kategorie " . $categories; $fromMail = $email; if (!mail($to, $betreff, $message, "From: {$from} <{$fromMail}>", 'Content-type: text/plain; charset=utf-8')) { echo "Fehler beim Senden des Kontaktformulars! <br>"; } else { echo "Kontaktformular erfolgreich gesendet. <br>"; } } if ($connection) { switch ($code) { case 1: insertRegistration($connection, $vname, $nname, $uname, $sex, $mail, $birth, $street, $hnumber, $plz, $city, $country, $picture, $password_check, $password); break; case 2: changePassword($connection, $username, $pwOld, $pwNew, $pwNewChk); break; case 3: createNotice($connection, $title, $piece, $price, $minprice, $origPrice, $categories, $actors, $date, $shipping, $payment, $datei, $username, $location); break; case 4: confirm($connection, $token, $mail); break; case 5: updateNotice($connection, $title, $piece, $price, $minprice, $origPrice, $categories, $actors, $date, $shipping, $payment, $username, $location, $id); break; case 6: contactForm($connection, $name, $email, $betreff, $categories, $message);