Dateigrösse: 27.26 kb
1<?php $ok = null; $nr = 100; $wer = ''; $email = ''; $text = ''; $copyText = ''; $alert = array('• Bitte E-Mail-Adresse der Firma prüfen', '• Bitte E-Mail-Adresse prüfen', '• Bitte Betreff prüfen', '• Bitte Mitteilung prüfen', '• Bitte alle erforderlichen Dokumente anhängen', '• Bitte AGB bestätigen', '• Bitte nur PDF oder Word-Datei anhängen' ); $allowed_attach = array( 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.oasis.opendocument.text' ); $checkEmail = true; $style = 'block'; $bool0 = 'hidden'; $bool1 = 'hidden'; $bool2 = 'hidden'; $bool3 = 'hidden'; $bool4 = 'hidden'; $bool5 = 'hidden'; $bool44 = 'hidden'; $alert0 = ' '; $alert1 = ' '; $alert2 = ' '; $alert3 = ' '; $alert4 = ' '; $alert5 = ' '; $alert44 = ' '; $alert55 = ''; $alert66 = ''; $red_bg = false; /* */ // Erzeuge einen zufaellig aussehenden Zugangscode aus dem Datum ... $code = chr((date("y") + 7) % 10 + date("m") + 68 + (date("m") % 2) * 32) . chr((date("d") + (date("d") %2)) / 2 + 66 + (37 * (date("d") %2))); // ... den der Anwender mittels "hidden field" uebergibt. So laesst sich // das Gros der Skript gesteuerten Angriffe von vornherein abblocken. if ( isset($_POST['ok']) ) { if(!isset($_POST['code']) || $_POST['code'] != $code) die ('<div style="margin:2em; font-size:12pt; font-weight:bold;"><p>Mailcode fehlt!</p><br><p><a style="color:#c03;" href="index.php?nid=two">back</a></p></div>'); $ok = true; $anhang = array(); //print_r($_POST); $data = array_map('_filterData', $_POST); //print_r($data); $wer = "msteiner2015@bluewin.ch"; //$data['wer']; $email = $data['email']; $betreff = $data['subject']; $text = $data['text']; $copy = isset($data['copy2me']); $anhang = $_FILES['attach']; $anhang0 = $anhang['name'][0].$anhang['type'][0].$anhang['tmp_name'][0].$anhang['error'][0].$anhang['size'][0]; /* foreach($anhang as $key => $value) { echo $key .' => '. count($value); print_r($value); echo '<br>'; foreach($value as $k => $v) { echo $k .' => '. $v; echo '<br>'; } } */ $agb = isset($data['agb']); /* */ if($agb!=true) { $ok = false; $nr = 5; } // $anhang['type'] != 'application/pdf' ... if(!in_array($anhang['type'][0], $allowed_attach) || !in_array($anhang['type'][1], $allowed_attach)) { $ok = false; $nr = 44; $red_bg = true; } // $anhang['error'] 0=Ja->OK!, 4=No->KO! if($anhang['error'][0] !=0 || $anhang['error'][1] !=0) { $ok = false; $nr = 4; $red_bg = true; } if(strlen($text) <= 5) { $ok = false; $nr = 3; $red_bg = false; } if(strlen($betreff) < 8) { $ok = false; $nr = 2; $red_bg = false; } if($checkEmail && !checkEmail($email, true)) { $ok = false; $nr = 1; $red_bg = false; } if($checkEmail && !checkEmail($wer, true)) { $ok = false; $nr = 0; $red_bg = false; } } if($ok) { if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol = "\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol = "\r"; } else { $eol = "\n"; } $zeit1 = date('d.m.Y'); $zeit2 = date('H:i'); $msgHead = '<span style="color: #000;">'. $email .' schrieb am '. $zeit1 .' um '. $zeit2 .' Uhr: </span>'. $eol.$eol; $msgText = utf8_decode($text); $msgText = $msgText . $eol.$eol; $msgMail = $email . $eol.$eol; $toName = "Michaelis"; //$to = "mistone@protonmail.com"; $to = "msteiner2015@bluewin.ch"; //$fromName = "Contact-Formular"; //$from = "no-reply@localhost"; $fromName = $wer; $from = $email; $subject = utf8_decode($betreff); // "Bewerbungsformular" $body = $msgText; //$msgHead.$msgText; // Formular gegen Spam Injections ueberwachen, alle Zugriffe im Logfile »log.txt« protokollieren $logfile = "./js/log.txt"; $tmpfile = fopen($logfile, "a+"); fwrite($tmpfile, $zeit1 ." ". $zeit2 ." ### ". $subject ." ### ". $from ."\r\n"); fclose($tmpfile); $subject = htmlspecialchars($subject); if ( preg_match( "/[\r\n]/", $from ) || substr_count( $from, '@' )>1 || preg_match( "/[\r\n]/", $subject ) || preg_match( "/[#,;]/", $subject ) ) { mail( $to, 'Injection in picasso2', 'Ein neuer Versuch mein online Bewerbungsformular auszunutzen' ); die( '<h2 style="color:crimson; font-size:36pt;">f*** U ashole !!!</h2>' ); exit(); } /********************** version 2.5 *********************/ require_once 'js/html_mime_mail_2.5/htmlMimeMail.php'; $mail = new htmlMimeMail(); $mail->setFrom($from .' <'. $from .'>'); $mail->setSubject($subject); $add = ''; $mail->setHtml($add . $body); $msgAttach = ''; $filename = array(); $anlagen = 0; $pre = ''; $allowed_mimetypes = array( 'image/gif', 'image/png', 'image/jpg', 'image/jpeg', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.oasis.opendocument.text', 'text/plain' ); for($i=0; $i < count($anhang); $i++) { if(is_uploaded_file($anhang['tmp_name'][$i])) { foreach($anhang as $key => $val) { $pre .= $key.' => '.$val[$i]; $pre .= '<br />'; } if(in_array($anhang['type'][$i], $allowed_mimetypes)) { if($attach[$i] = $mail->getFile($anhang['tmp_name'][$i])) { $mail->addAttachment($attach[$i], utf8_encode($anhang['name'][$i]), $anhang['type'][$i]); //$filename[$anhang['type'][$i]][] = $anhang['name'][$i]; $filename[$anhang['type'][$i]][] = '<span title="'. $anhang['type'][$i] .'">'. $anhang['name'][$i] .'</span>'; $anlagen = 1; } else { $anlagen = 2; } } else { //echo $anhang['type'][$i].'<br>'; $anlagen = 3; $filename[$anhang['type'][$i]][] = '<span style="color:red;" title="'. $anhang['type'][$i] .'">'. $anhang['name'][$i] .' wurde gelöscht!</span>'; // - - unset($anhang[$i]); } } } $mail->send(array($toName .' <'. $to .'>')); if($copy) { $mail->send(array($fromName .' <'. $from .'>')); $copyText = '<br><h4>Eine Kopie wurde an '. $from .' gesendet.</h4>'; $copyText .= '<div style="width:77%; padding:0.5em 0 1em 0; margin:0px auto; border-top:1pt dashed black; text-align:center;"></div>'; } else { $copyText .= '<br><br><div style="width:66%; padding:0.5em 0 1em 0; margin:0px auto; border-top:1pt dashed black; text-align:center;"></div>'; } $msgAttach = '<br><div style="width:55%; padding:0.5em 0 1em 0; margin:0px auto; border-top:1pt dashed black; text-align:center;"></div>'; $ctr = 0; if($anlagen==1 || $anlagen==3) { $clip = '<img style="margin:0 10px -3px 0;" src="../img/paperclip.gif" alt="Attachment" width="15" height="15" border="0" />'; $alarm = '<img style="margin:0 10px -3px 0;" src="../img/icon_alarm.gif" alt="Alarm" width="15" height="14" border="0" />'; $error = '<img style="margin:0 8px -3px 0;" src="../img/icon_error.png" alt="Error" width="16" height="16" border="0" />'; $img = '<img style="margin:0 10px -2px 0;" src="../img/icon_image.gif" alt="Bild" width="16" height="16" border="0" />'; $pdf = '<img style="margin:0 10px -2px 0;" src="../img/icon_pdf.gif" alt="PDF" width="16" height="16" border="0" />'; $odt = '<img style="margin:0 10px -2px 0;" src="../img/icon_odt_16x14.png" alt="ODT" width="14" height="16" border="0" />'; //$odt = '<img style="margin:0 10px -2px 0;" src="../img/icon-odt-16x16.gif" alt="ODT" width="16" height="16" border="0" />'; $doc = '<img style="margin:0 10px -3px 0;" src="../img/icon-word-2010_16x16.png" alt="DOC" width="16" height="16" border="0" />'; $doc = '<img style="margin:0 10px -2px 0;" src="../img/icon_word.gif" alt="DOC" width="16" height="16" border="0" />'; $docx = '<img style="margin:0 10px -3px 0;" src="../img/icon_docx.gif" alt="DOCX" width="16" height="16" border="0" />'; $docx = '<img style="margin:0 10px -4px 0;" src="../img/icon-word-18x18.gif" alt="DOCX" width="18" height="18" border="0" />'; $i=0; foreach($filename as $key => $value) { foreach($value as $k => $v) { $icon = stristr($v, 'wurde gelöscht!') ? $error : $clip; if($icon==$clip) { $ctr++; if($anhang['type'][$i]=='application/pdf') { $icon = $pdf; } elseif($anhang['type'][$i]=='application/vnd.oasis.opendocument.text') { $icon = $odt; } elseif($anhang['type'][$i]=='image/gif' || $anhang['type'][$i]=='image/png' || $anhang['type'][$i]=='image/jpg' || $anhang['type'][$i]=='image/jpeg') { $icon = $img; } elseif($anhang['type'][$i]=='application/msword') { $icon = $doc; } else { $icon = $docx; } } $i++; $title = stristr($v, 'wurde gelöscht!') ? 'Sorry, falscher Dateityp' : 'Anhang '. $ctr; $msgAttach .= '<span title="'. $title .'">'. $icon .'</span><span style="color:#454545;" title="OOPS">'. $v .'</span>'; $msgAttach .= '<p style="padding:0.25em; margin:0; border:0pt dotted #454545;"></p>'; } } //$msgAttach .= $pre; $msgAttach .= '<div style="width:33%; padding:0.5em 0; margin:0px auto; border-bottom:1pt dashed black; text-align:center;"></div>'; } if($anlagen==2) { $msgHead = '<span style="color:red;">Fehler beim Anhang</span>'; $msgText = 'an error occured while reading attachment(s)!'; } $meldung = '<div style="text-align:center !important; width:45em !important; color:#228b22 !important; background:transparent; margin:1em 0; padding:2em 2em 1em 2em; border:1pt solid #454545; border-radius:20px; box-shadow:3pt 3pt 6pt #228b22; line-height:22px; letter-spacing:1px;"><span style="font-size:155%">Vielen Dank für deine Bewerbung.</span><br><br><span style="font-size:133%">Wir melden uns in den nächsten Tagen bei dir.</span>'.$copyText.'<p style="margin:0;padding:0;height:10px;"></p>' . $msgHead . '<br><div style="font-size:10pt; color:#353535; margin:10pt 0;"><div style="width:80%;margin:0 auto;">' . nl2br($text) . '</div> '. $msgAttach .'<br><a href="' . $_SERVER['PHP_SELF'] . '?nid=two" class="notable" style="font-size:9pt;">weiter</a></div></div>'; $style = 'none'; } else { $action = $_SERVER['PHP_SELF'] . '?nid=two'; $wer = _filterData($_POST['wer']); $email = _filterData($_POST['email']); $betreff = _filterData($_POST['subject']); $text = _filterData($_POST['text']); $check = $copy ? 'checked="checked"' : ''; $checked = $check; $checkAGB = $agb ? 'checked="checked"' : ''; $checkedAGB = $checkAGB; if($nr==1) { $autofocus1 = 'autofocus'; $bg1 = 'background-color:#ffb8b8; border-color:#666;'; $bool1 = 'visible'; $alert1 = $alert[1]; } if($nr==2) { $autofocus1 = ''; $autofocus2 = 'autofocus'; $bg2 = 'background-color:#ffb8b8; border-color:#666;'; $bool2 = 'visible'; $alert2 = $alert[2]; } if($nr==3) { $autofocus3 = 'autofocus'; $bg3 = 'background-color:#ffb8b8; border-color:#666;'; $bool3 = 'visible'; $alert3 = $alert[3]; } if($nr==4) { $bool4 = 'visible'; $alert4 = $alert[4]; } if($nr==5) { $bool5 = 'visible'; $alert5 = $alert[5]; } if($nr==44) { $bool44 = 'visible'; $alert44 = $alert[6]; } if($nr>3 && $nr<100) { $autofocus1 = ''; $autofocus2 = ''; $autofocus3 = ''; } if($red_bg) { $alert55 = 'background-color:#ffb8b8;'; $alert66 = 'background-color:#ffb8b8;'; } } ?> <div id="feedback" style="display:<?php echo $style; ?>"> <fieldset class="fset"> <legend>Bewerbungsformular</legend> <form class="fb" action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" name="feedback" id="feedback"> <div style="display:none;"> <div class="beschriftung" title=""><span style="cursor:default;">An:</span><span style="font-size:95%; color:#b00; padding:0 2px; cursor:default;"></span></div> <!-- title="Pflichtfeld (muss ausgefüllt werden)" --> <input type="text" id="inp0" name="wer" placeholder="jobs@personalag.ch" onclick="$(inp0).value='Bitte nicht ausfüllen';" onblur="$(inp0).value='';" readonly="readonly" title="Dieses Feld nicht ausfüllen" size="25" maxlength="50" class="rand readonly" value="" /><br> <div id="alertAn" class="alert" style="visibility:hidden"> </div> <p style="clear:left; padding:2px; margin:0;"></p> </div> <div class="beschriftung" style="cursor:default;" title="Empfänger/in, Personalchef/in">An:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span></div> <input type="text" id="inp1" name="email" placeholder="" onkeyup="$(alertVon).style.visibility='hidden'; this.style.backgroundColor='#fff';" onclick="this.style.backgroundColor='#fff';" onblur="" title="Geben Sie hier die E-Mail-Adresse der Firma ein" size="25" maxlength="50" class="rand" style="<?php echo $bg1; ?>; margin-bottom: 5px;" value="<?php echo $email; ?>" <?php echo $autofocus1; ?> /><br> <div id="alertVon" class="alert" style="visibility:<?php echo $bool1; ?>"><?php echo $alert1; ?></div> <!-- onclick="iXT(1); mandatoryClick(1,1)" onkeypress="mandatoryClick(1,0)" --> <p style="clear:left; padding:3px; margin:0;"></p> <div class="beschriftung" style="cursor:default;" title="Bewerbung als ...">Betreff:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span></div> <input type="text" id="inp2" name="subject" placeholder="" onkeyup="$(alertBetreff).style.visibility='hidden';this.style.backgroundColor='#fff';" onclick="this.style.backgroundColor='#fff';" onblur="" title="Bewerbung als ..." size="25" maxlength="50" class="rand" style="<?php echo $bg2; ?>; margin-bottom: 5px;" value="<?php echo $betreff; ?>" <?php echo $autofocus2; ?> /><br> <div id="alertBetreff" class="alert" style="visibility:<?php echo $bool2; ?>"><?php echo $alert2; ?></div> <p style="clear:left; padding:3px; margin:0;"></p> <div class="beschriftung" style="cursor:default;" title="Sehr geehrte Damen und Herren ...">Mitteilung:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span></div> <textarea id="inp3" name="text" onkeyup="$(alertMitteilung).style.visibility='hidden';this.style.backgroundColor='#fff';" onclick="this.style.backgroundColor='#fff';" placeholder="" rows="6" cols="" class="rand" style="<?php echo $bg3; ?>" <?php echo $autofocus3; ?>><?php echo $text; ?></textarea><br> <div id="alertMitteilung" class="alert" style="visibility:<?php echo $bool3; ?>"><?php echo $alert3; ?></div> <p style="clear:left; padding:2px; margin:0;"></p> <div class="beschriftung" title="Sende eine Kopie dieser Bewerbung an dich selber"> <span class="helptxt" style="top:1px; position:relative; left: -3px; cursor:help;" onmouseover="console.log($('cbx').checked)" onclick="$('cbx').checked==false ? $('cbx').checked=true : $('cbx').checked=false;"> <img src="../img/icon_info_12px.png" width="12" height="12" alt="info" border="0" /></span> <span style="cursor:default;">Kopie: </span> </div> <!-- <input type="checkbox" id="cb1" name="cbox1" onclick="try { document.getElementById('cb1').checked=false; } catch (e) {}" value="" /> Sehr geehrte(r) ... ### 1 - 2 Sätze zum Inserat ### Freundliche Grüsse und Name Empfänger Bewerbung als ... --> <div style="border:0px dotted grey;"> <input type="checkbox" id="cbx" name="copy2me" class="cb" style="display:none;" <?php echo $checked; ?> /><label class="cbl" for="cbx"></label> </div> <p style="clear:left; padding:5px; margin:0; font-size: 8px;"> </p> <div class="beschriftung" style="margin-top: -3px; padding-bottom: 50px;" title="PDF anhängen > Symbol Büroklammer anklicken und Dokumente vom USB-Stick (D:) öffnen"> <span style="cursor:default;">Anhang: </span> </div> <div id="inpAtt" onclick="$('alertAnhang1').style.display='none';" style="display:inline-block; float:left; margin-left: 0px;"> <!-- <label id="label4" for="inp4" onclick="$('inp4').style.visibility='visible'; this.style.display='none';" style="cursor:pointer; border-radius: 3pt; font-size:111%; font-weight:normal; margin-left:1pt;"> <img src="./img/paperclip.gif" alt="" width="15" height="15" border="0" style="margin:0 0 -2px 4px;" /> Motivationsschreiben<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld"></span> </label> <input onblur="chkDoc(this.value,4);" type="file" id="inp4" name="attach[]" class="anhang" value="" size="" style="margin-left: -2px; border:none !important; visibility:hidden; background-color:#90bade; border:3px solid #2175bc; padding-right:5pt;" /> <p style="padding:0.25em; margin:0;"></p> --> <label id="label5" for="inp5" onclick="$('inp5').style.visibility='visible'; this.style.display='none';" style="cursor:pointer; border-radius:3pt; font-size:111%; font-weight:normal; margin-left:1pt;<?php echo $alert55; ?>"> <img src="./img/paperclip.gif" alt="" width="15" height="15" border="0" style="margin:0 0 -2px 4px;" /> Lebenslauf<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span> </label> <input onblur="chkDoc(this.value,5);" type="file" id="inp5" name="attach[]" class="anhang" value="" size="" style="margin-left: -2px; border:none !important; visibility:hidden; background-color:#90bade; border:3px solid #2175bc; padding-right:5pt;" /> <p style="padding:0.25em; margin:0;"></p> <label id="label6" for="inp6" onclick="$('inp6').style.visibility='visible'; this.style.display='none';" style="cursor:pointer; border-radius:3pt; font-size:111%; font-weight:normal; margin-left:1pt;<?php echo $alert66; ?>"> <img src="./img/paperclip.gif" alt="" width="15" height="15" border="0" style="margin:0 0 -2px 4px;" /> Zeugnisse<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span> </label> <input onblur="chkDoc(this.value,6);" type="file" id="inp6" name="attach[]" class="anhang" value="" size="" style="margin-left: -2px; border:none !important; visibility:hidden; background-color:#90bade; border:3px solid #2175bc; padding-right:5pt;" /> <p style="padding:0.25em; margin:0;"></p> <label id="label7" for="inp7" onclick="$('inp7').style.visibility='visible'; this.style.display='none';" style="cursor:pointer; border-radius:3pt; font-size:111%; font-weight:normal; margin-left:1pt;" > <img src="./img/paperclip.gif" alt="" width="15" height="15" border="0" style="margin:0 0 -2px 4px;" /> Foto / Diplome / Bewerbung </label> <input onblur="chkImg(this.value,7);" type="file" id="inp7" name="attach[]" class="anhang" value="" size="" style="margin-left: -2px; border:none !important; visibility:hidden; background-color:#90bade; border:3px solid #2175bc; padding-right:5pt;" /> <!-- <input style="margin-left: -2px; padding:1pt 5pt 1pt 1pt; visibility:hidden; box-shadow:2px 2px 3pt #454545 !important; border-color:#fff !important;" /> --> <p style="clear:left; padding:0.2em; margin:0;"></p> <span id="alertAnhang1" class="alert" style="padding: 0 0 4px 2px !important; visibility:<?php echo $bool4; ?>;"><?php echo $alert4; ?></span> <span id="alertAnhang2" class="alert" style="padding: 0 0 4px 2px !important; visibility:<?php echo $bool44; ?>;"><?php echo $alert44; ?></span> <span id="alertAnhang3" class="alert" style="padding: 0 0 4px 2px !important; display:none;">• Bitte nur PDF, Bild- oder Word-Datei anhängen</span> <span id="alertAnhang4" class="alert" style="padding: 0 0 4px 2px !important; display:none;">• Bitte nur PDF oder Word-Datei anhängen</span> <span id="alertAnhangX" class="alert" style="padding: 2px 0 !important; border:0px solid #f00;"> </span> <!-- --> </div> <p style="clear:left; padding:0; margin:0; font-size:8px;"></p> <div class="beschriftung"> <a class="img_href" href="./docs/AGB.htm" target="_blank"><span class="agb" style="top:1px; position:relative; cursor:help; padding-right:8px;"><img src="../img/icon_info_12px.png" width="12" height="12" alt="info" border="0" title="AGB lesen: Bitte hier klicken" /></span></a>AGB:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span> </div> <div style="border:0px dotted grey;"> <input type="checkbox" id="cbxAGB" name="agb" onclick="$(alertAGB).style.visibility='hidden';" class="cb" style="display:none;" <?php echo $checkedAGB; ?> /><label class="cbl" for="cbxAGB"></label><span style="display:inline-block; font-size:90%; position: relative; top: -10px;">Datenschutzvereinbarung gelesen und akzeptiert</span> </div> <div id="alertAGB" class="alert" style="visibility:<?php echo $bool5; ?>;">• Bitte AGB bestätigen</div> <p style="clear:left; padding:0; margin:0; font-size:6px;"> </p> <input type="hidden" name="ok" id="ok" value="yes" /> <input type="hidden" name="code" id="code" value="<?php echo $code; ?>"/> <div class="beschriftung" style="text-align:left;"> <span style="font-size:90%; color:#b00; padding:0 2pt; cursor:help; position:relative; top:10px;" title="Pflichtfeld">*</span><span style="font-size:84%; color:#b00; font-weight:normal; position:relative; top:12px;">Pflichtfeld</span></div> <input class="sub" style="margin-left:1px;" type="submit" name="abschicken" value="senden" title="E-Mail abschicken" onfocus="if(this.blur)this.blur();" onclick="" /> <p> </p> </form> </fieldset> <img src="./img/blind.gif" alt="" width="10" height="5" border="0" /> </div> <!-- END formular --> <span style="float:left; color:#a00; font-weight:bold; font-size:1em;"><?php echo $meldung; ?></span> <!-- --> <div style="clear:left; padding:0.25em;"> </div> <script type="text/javascript"> var bool; var ctr = 0; function slide(id) { console.log(bool); console.log(' *** '); if(id=='more') { ctr++; console.log(ctr); Effect.SlideDown('more['+ctr+']', { duration: 0.75 }); if(ctr==2) { $('moreTxt').style.display='none'; } return false; } } /*********** imgChange **********/ function eXT(num) { var a = ((document.feedback.elements.length)-3); //console.log(a); // 3 x input, 1 x textarea, 3 x attachment = 7 //console.log(' ### ' + num); for(var i=0; i<a; i++) { if(document.feedback.elements['inp'+i].value.length > 3) { document.feedback.elements['inp'+i].style.borderColor = '#c2c6ca'; document.feedback.elements['inp'+i].style.backgroundColor = 'transparent'; } else { document.feedback.elements['inp'+i].style.borderColor = '#2175bc'; document.feedback.elements['inp'+i].style.borderWidth = '1pt'; document.feedback.elements['inp'+i].style.borderStyle = 'solid'; document.feedback.elements['inp'+i].style.backgroundColor = '#fff'; } } } function iXT(num) { document.feedback.elements['inp'+num].style.borderColor = '#555'; document.feedback.elements['inp'+num].style.borderWidth = '1pt'; document.feedback.elements['inp'+num].style.borderStyle = 'solid'; document.feedback.elements['inp'+num].style.backgroundColor = '#f8f8ff'; } /** * 21.12.2019: * Kontrollfunktion Pflichtfelder, um angehaengte Dateien * nicht zu verlieren falls AGB!=checked **/ function getFilePathExtension(path) { var filename = path.split('\\').pop().split('/').pop(); var lastIndex = filename.lastIndexOf("."); if (lastIndex < 1) return ""; return filename.substr(lastIndex + 1); } function checkExtension(a,b) { const allowedExtension = ['pdf','odt','doc','docx','rtf']; aLC = a.toLowerCase(); resA = allowedExtension.indexOf(aLC); bLC = b.toLowerCase(); resB = allowedExtension.indexOf(bLC); if(resA != -1 && resB != -1) { return true; } else { return false; } } function checkDocument(ext) { const allowedExtension = ['pdf','odt','doc','docx','rtf']; extLC = ext.toLowerCase(); res = allowedExtension.indexOf(extLC); if(res == -1) { return true; } else { $('alertAnhang4').style.display='none'; return false; } } function checkPicture(ext) { const allowedExtension = ['png','gif','jpg','jpeg','pdf','tif','tiff','bmp','doc','docx','odt']; extLC = ext.toLowerCase(); res = allowedExtension.indexOf(extLC); if(res == -1) { return true; } else { $('alertAnhang3').style.display='none'; return false; } } document.getElementById('feedback').onsubmit = function(evt) { let inp1 = document.feedback.elements['inp1'].value; let inp2 = document.feedback.elements['inp2'].value; let inp3 = document.feedback.elements['inp3'].value; let inp5 = document.feedback.elements['inp5'].value; let inp6 = document.feedback.elements['inp6'].value; let ext5 = getFilePathExtension(inp5); let ext6 = getFilePathExtension(inp6); result = checkExtension(ext5,ext6); let agb = document.getElementById('cbxAGB').checked; if (agb==false && inp1!='' && inp2!='' && inp3!='' && inp5!='' && inp6!='' && result==true) { //console.log('Please confirm »AGB«'); $('alertAGB').style.visibility='visible'; //evt.preventDefault(); (evt.preventDefault) ? evt.preventDefault() : evt.returnValue = false; // older Browsers < IE8 } } function chkDoc(str_value, num_label) { if(str_value) { ext=getFilePathExtension(str_value); if( checkDocument(ext) ) { $('alertAnhang4').style.display='block'; $('alertAnhang1').style.display='none'; $('alertAnhang2').style.display='none'; $('alertAnhang3').style.display='none'; $('label'+num_label).style.backgroundColor='#ffb8b8'; $('label'+num_label).style.display='inline'; $('inp'+num_label).style.visibility='hidden'; document.feedback.elements['inp'+num_label].value=null; } } } function chkImg(str_value, num_label) { console.log('path :: ' + str_value); if(str_value) { ext=getFilePathExtension(str_value); console.log(ext); if( checkPicture(ext) ) { console.log(num_label); $('alertAnhang3').style.display='block'; $('alertAnhang1').style.display='none'; $('alertAnhang2').style.display='none'; $('alertAnhang4').style.display='none'; $('label7').style.backgroundColor='#ffb8b8'; $('label7').style.display='inline'; $('inp7').style.visibility='hidden'; $('inp'+num_label).value=null; } } } </script>