setCity($_POST['ddlCity']); }*/ if (isset($_POST['txtCity'])) { $uo->setCity($_POST['txtCity']); } if (isset($_POST['txtFirstName'])) { $uo->setFirstName($_POST['txtFirstName']); } if (isset($_POST['txtLastName'])) { $uo->setLastName($_POST['txtLastName']); } if (isset($_POST['txtDay']) && isset($_POST['txtMonth']) && isset($_POST['txtYear'])) { $uo->setBirthDay($_POST['txtYear']."-".$_POST['txtMonth']."-".$_POST['txtDay']); } if (isset($_POST['txtSupportPeople'])) { $uo->setSupportCount($_POST['txtSupportPeople']); } else { $uo->setSupportCount(0); } if (isset($_POST['txtStaffName'])) { $uo->setSupportNames($_POST['txtStaffName']); } if (isset($_POST['txtNationality'])) { $uo->setNationality($_POST['txtNationality']); } if (isset($_POST['txtCellPhone'])) { $uo->setCellPhone($_POST['txtCellPhone']); } if (isset($_POST['txtOccupation'])) { $uo->setOccupation($_POST['txtOccupation']); } if (isset($_POST['chkLanguage'])) { $chkLanguage = $_POST['chkLanguage']; $uo->setLanguages(implode(", ", $chkLanguage)); } if (isset($_POST['txtLanguage'])) { $uo->setLanguages($uo->getLanguages().", ".$_POST['txtLanguage']); } if (isset($_POST['txtWinnerthink'])) { $uo->setWhyIWillWin(str_replace("'", "`",$_POST['txtWinnerthink'])); } if (isset($_POST['txtMail'])) { $uo->setSupportEmail($_POST['txtMail']); } if (isset($_POST['txtCellPhone2'])) { $uo->setSupportCellPhone($_POST['txtCellPhone2']); } if (isset($_POST['txtMedicalComments'])) { $uo->setMedicalTreatment($_POST['txtMedicalComments']); } if (isset($_POST['empf'])) { $empf = $_POST['empf']; } if (isset($_POST['rbMedical'])) { if ($_POST['rbMedical'] == 'medical o.k.') { $uo->setMedicalConditions(1); } else { $uo->setMedicalConditions(0); } } else { $uo->setMedicalConditions(0); } $uo->setIsActive(1); $uo->setIsRunner(1); $uo->setIsAdmin(0); $um = new UserManager($uo); //bekomme ein Objekt vom Typ User oder wenn mehr gefunden dann ein array mit benutzerobjekten $foundUsers = $um->getUserByEmail($uo->getEmail()); $foundUser = ""; if (is_array($foundUsers)) { if (count($foundUsers) == 1) { if ($foundUsers[0] instanceof User) $foundUser = $foundUsers[0]; } } elseif ($foundUsers instanceof User) { $foundUser = $foundUsers; } if ($foundUser instanceof User) { $uo->setUserId($foundUser->getUserId()); $resp = "2"; } else { $uo->setUserId($um->insertUser()); $resp = "1"; } if (isset($_FILES['img'])) { if ($_FILES['img']['tmp_name'] <> "") { $bild = $_FILES['img']['tmp_name']; $name = $uo->getUserId().".jpg"; list($breit_orig, $hoch_orig) = getimagesize($bild); # Breite und Höhe des Originalbilds ermitteln $breit = 55; # Breite des Thumbs $hoch = 70; # Höhe des Thumbs $image_p = imagecreatetruecolor($breit, $hoch); # Thumb erstellen $color = imagecolorallocate($image_p, 255, 255, 255); # Füllfarbe "weiß" imagefill($image_p, 0, 0, $color); # Thumb mit Farbe füllen $image = imagecreatefromjpeg($bild); # Thumb aus hochgeladener Datei erstellen imagecopyresampled($image_p, $image, 0, 0, 0, 0, $breit, $hoch, $breit_orig, $hoch_orig); # Bildthumb in "weißes" Thumb an Position 0 einfügen imagejpeg($image_p, USER_PICTURES.$name, 90); # Thumb in Verzeichnis kopieren (Originalname), JPEG-Qualität: 90% //echo "thumbpath: ".$pfad."thumbs/thumb_".$names[$x]; } } $uco = new UsersCities(); if ($uco->checkUserCity($_POST["ddlCity"], $uo->getUserId())) { $resp = "3"; } else { $uco->insertUsersCities($_POST["ddlCity"], $uo->getUserId()); } } //header('location: index.php'); switch ($resp) { case "1": $_SESSION['appmsg'] = "Thanks for your Application!"; include("php/sendcitychoice.php"); include("appconfirmdef.php"); break; case "2": $_SESSION['appmsg'] = "Your email already exists! But your application for this city was successfull!"; include("php/sendcitychoice.php"); include("appconfirmdef.php"); break; case "3": $_SESSION['appmsg'] = "An application for this email and this city already exists!"; include("appconfirmdef.php"); break; case "4": $errmsg = ""; foreach($errors as $error) $errmsg .= $error."\n
\n"; $_SESSION['appmsg'] = $errmsg; include("appconfirmdef.php"); break; default: $_SESSION['appmsg'] = "An application for this email and this city already exists!"; //include("php/sendcitychoice.php"); include("appconfirmdef.php"); break; } } }