Quelltext der Datei: http://www.michaelster.ch/lernen/__new__formular.php

Dateigrösse: 27.29 kb

[Anzeige ohne Zeilennummern]


  1 <?php
  2 $ok              = null;
  3 $nr            = 100;
  4 $wer         = '';
  5 $email         = '';
  6 $text         = '';
  7 $copyText     = '';
  8 $alert        = array('&bull; Bitte E-Mail-Adresse der Firma &uuml;berpr&uuml;fen',
  9                     '&bull; Bitte E-Mail-Adresse &uuml;berpr&uuml;fen',
 10                     '&bull; Bitte Betreff &uuml;berpr&uuml;fen',
 11                     '&bull; Bitte Mitteilung &uuml;berpr&uuml;fen',
 12                     '&bull; Bitte alle erforderlichen Dokumente anh&auml;ngen',
 13                     '&bull; Bitte AGB best&auml;tigen',
 14                     '&bull; Bitte nur PDF oder Word-Datei anh&auml;ngen'
 15                    );
 16 
 17 $allowed_attach = array( 'application/pdf',
 18                          'application/msword',
 19                          'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
 20                          'application/vnd.oasis.opendocument.text'
 21                         );
 22 $checkEmail = true;
 23 
 24 $style = 'block';
 25 
 26 $bool0  = 'hidden';
 27 $bool1  = 'hidden';
 28 $bool2  = 'hidden';
 29 $bool3  = 'hidden';
 30 $bool4  = 'hidden';
 31 $bool5  = 'hidden';
 32 $bool44 = 'hidden';
 33 
 34 $alert0  = '&nbsp;';
 35 $alert1  = '&nbsp;';
 36 $alert2  = '&nbsp;';
 37 $alert3  = '&nbsp;';
 38 $alert4  = '&nbsp;';
 39 $alert5  = '&nbsp;';
 40 $alert44 = '&nbsp;';
 41 $alert55 = '';
 42 $alert66 = '';
 43 
 44 $red_bg = false;
 45 
 46 /* */
 47 
 48 // Erzeuge einen zufaellig aussehenden Zugangscode aus dem Datum ...
 49 $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)));
 50 // ... den der Anwender mittels "hidden field" uebergibt. So laesst sich
 51 // das Gros der Skript gesteuerten Angriffe von vornherein abblocken.
 52 
 53 
 54 if ( isset($_POST['ok']) )
 55 {
 56       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>');
 57     
 58     $ok        = true;
 59     $anhang    = array();
 60     
 61     //print_r($_POST);
 62     $data   = array_map('_filterData', $_POST);
 63     //print_r($data);
 64     
 65     $wer     = "msteiner2015@bluewin.ch"; //$data['wer'];
 66     $email      = $data['email'];
 67     $betreff = $data['subject'];
 68     $text      = $data['text'];
 69     $copy      = isset($data['copy2me']);
 70     $anhang     = $_FILES['attach'];
 71     
 72     $anhang0  = $anhang['name'][0].$anhang['type'][0].$anhang['tmp_name'][0].$anhang['error'][0].$anhang['size'][0];
 73     /*
 74     foreach($anhang as $key => $value) {
 75         echo $key .' => '. count($value);
 76         print_r($value);
 77         echo '<br>';
 78         foreach($value as $k => $v) {
 79             echo $k .' => '. $v;
 80             echo '<br>';
 81         }
 82     }
 83     */
 84     $agb = isset($data['agb']);
 85     /* */
 86     if($agb!=true)
 87     {
 88         $ok         = false;
 89         $nr            = 5;
 90     }
 91     // $anhang['type'] != 'application/pdf' ...
 92     if(!in_array($anhang['type'][0], $allowed_attach) || !in_array($anhang['type'][1], $allowed_attach))
 93     {
 94         $ok         = false;
 95         $nr            = 44;
 96         $red_bg     = true;
 97     }
 98     // $anhang['error'] 0=Ja->OK!, 4=No->KO!
 99     if($anhang['error'][0] !=0 || $anhang['error'][1] !=0)
100     {
101         $ok         = false;
102         $nr            = 4;
103         $red_bg     = true;
104     }
105     if(strlen($text) <= 5)
106     {
107         $ok         = false;
108         $nr            = 3;
109         $red_bg     = false;
110     }
111     if(strlen($betreff) < 8)
112     {
113         $ok         = false;
114         $nr            = 2;
115         $red_bg     = false;
116     }
117     if($checkEmail && !checkEmail($email, true))
118     {
119         $ok         = false;
120         $nr            = 1;
121         $red_bg     = false;
122     }
123     if($checkEmail && !checkEmail($wer, true)) 
124     {
125         $ok         = false;
126         $nr            = 0;
127         $red_bg     = false;
128     }
129 }
130 
131 if($ok)
132 {
133     if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
134           $eol = "\r\n";
135     } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
136           $eol = "\r";
137     } else {
138           $eol = "\n";
139     }
140     
141     $zeit1     = date('d.m.Y');
142     $zeit2     = date('H:i');
143     
144     $msgHead = '<span style="color: #000;">'. $email .' schrieb am '. $zeit1 .' um '. $zeit2 .' Uhr: </span>'. $eol.$eol;
145     $msgText = utf8_decode($text);
146     $msgText = $msgText . $eol.$eol;
147     $msgMail = $email . $eol.$eol;
148     
149     $toName          = "Michaelis";
150     //$to        = "mistone@protonmail.com";
151      $to              = "msteiner2015@bluewin.ch";
152     //$fromName = "Contact-Formular";
153     //$from          = "no-reply@localhost";
154     $fromName     = $wer;
155     $from          = $email;
156     $subject      = utf8_decode($betreff); // "Bewerbungsformular"
157     $body          = $msgText; //$msgHead.$msgText;
158 
159     // Formular gegen Spam Injections ueberwachen, alle Zugriffe im Logfile »log.txt« protokollieren 
160        $logfile = "./js/log.txt";
161        $tmpfile = fopen($logfile, "a+");
162        fwrite($tmpfile, $zeit1 ." ". $zeit2 ." ### ". $subject ." ### ". $from ."\r\n"); 
163        fclose($tmpfile); 
164     
165     $subject = htmlspecialchars($subject);
166     
167     if ( preg_match( "/[\r\n]/", $from ) || substr_count( $from, '@' )>1 || preg_match( "/[\r\n]/", $subject ) || preg_match( "/[#,;]/", $subject ) ) {
168         mail( $to, 'Injection in picasso2', 'Ein neuer Versuch mein online Bewerbungsformular auszunutzen' );
169         die( '<h2 style="color:crimson; font-size:36pt;">f*** U ashole !!!</h2>' );
170         exit();
171     } 
172     
173     /********************** version 2.5 *********************/
174     require_once 'js/html_mime_mail_2.5/htmlMimeMail.php';
175     
176     $mail = new htmlMimeMail();
177     $mail->setFrom($from .' <'. $from .'>');
178     $mail->setSubject($subject);
179     
180     $add = '';
181     $mail->setHtml($add . $body);
182     
183     $msgAttach     = '';
184     $filename    = array();
185     $anlagen     = 0;
186     $pre        = '';
187     $allowed_mimetypes = array( 'image/gif',
188                                 'image/png',
189                                 'image/jpg',
190                                 'image/jpeg',
191                                 'application/pdf',
192                                 'application/msword',
193                                 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
194                                 'application/vnd.oasis.opendocument.text',
195                                 'text/plain'
196                               );
197     
198     for($i=0; $i < count($anhang); $i++)
199     {
200       if(is_uploaded_file($anhang['tmp_name'][$i]))
201       {
202         foreach($anhang as $key => $val) {
203             $pre .= $key.' => '.$val[$i];
204             $pre .= '<br />';
205         }
206         if(in_array($anhang['type'][$i], $allowed_mimetypes)) {
207           if($attach[$i] = $mail->getFile($anhang['tmp_name'][$i])) {
208             $mail->addAttachment($attach[$i], utf8_encode($anhang['name'][$i]), $anhang['type'][$i]);
209             //$filename[$anhang['type'][$i]][] = $anhang['name'][$i];
210             $filename[$anhang['type'][$i]][] = '<span title="'. $anhang['type'][$i] .'">'. $anhang['name'][$i] .'</span>';
211             $anlagen = 1;
212           } else {
213             $anlagen = 2;
214           }
215         } else {
216           //echo $anhang['type'][$i].'<br>';
217           $anlagen = 3;
218           $filename[$anhang['type'][$i]][] = '<span style="color:red;" title="'. $anhang['type'][$i] .'">'. $anhang['name'][$i] .' wurde gel&ouml;scht!</span>'; // -  - 
219           unset($anhang[$i]);
220         }
221       }
222     }
223     $mail->send(array($toName .' <'. $to .'>'));
224     
225     if($copy) {
226         $mail->send(array($fromName .' <'. $from .'>'));
227         $copyText  = '<br><h4>Eine Kopie wurde an '. $from .' gesendet.</h4>';
228         $copyText .= '<div style="width:77%; padding:0.5em 0 1em 0; margin:0px auto; border-top:1pt dashed black; text-align:center;"></div>';
229     }
230     else {
231         $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>';
232     }
233     
234     $msgAttach = '<br><div style="width:55%; padding:0.5em 0 1em 0; margin:0px auto; border-top:1pt dashed black; text-align:center;"></div>';
235     $ctr = 0;
236     
237     if($anlagen==1 || $anlagen==3) {
238         $clip  = '<img style="margin:0 10px -3px 0;" src="../img/paperclip.gif" alt="Attachment" width="15" height="15" border="0" />';
239         $alarm = '<img style="margin:0 10px -3px 0;" src="../img/icon_alarm.gif" alt="Alarm" width="15" height="14" border="0" />';
240         $error = '<img style="margin:0 8px  -3px 0;" src="../img/icon_error.png" alt="Error" width="16" height="16" border="0" />';
241         $img   = '<img style="margin:0 10px -2px 0;" src="../img/icon_image.gif" alt="Bild" width="16" height="16" border="0" />';
242         $pdf   = '<img style="margin:0 10px -2px 0;" src="../img/icon_pdf.gif" alt="PDF" width="16" height="16" border="0" />';
243         $odt   = '<img style="margin:0 10px -2px 0;" src="../img/icon_odt_16x14.png" alt="ODT" width="14" height="16" border="0" />';
244         //$odt   = '<img style="margin:0 10px -2px 0;" src="../img/icon-odt-16x16.gif" alt="ODT" width="16" height="16" border="0" />';
245         $doc   = '<img style="margin:0 10px -3px 0;" src="../img/icon-word-2010_16x16.png" alt="DOC" width="16" height="16" border="0" />';
246         $doc   = '<img style="margin:0 10px -2px 0;" src="../img/icon_word.gif" alt="DOC" width="16" height="16" border="0" />';
247         $docx  = '<img style="margin:0 10px -3px 0;" src="../img/icon_docx.gif" alt="DOCX" width="16" height="16" border="0" />';
248         $docx  = '<img style="margin:0 10px -4px 0;" src="../img/icon-word-18x18.gif" alt="DOCX" width="18" height="18" border="0" />';
249         $i=0;
250         foreach($filename as $key => $value)
251         {
252             foreach($value as $k => $v)
253             {
254                 $icon = stristr($v, 'wurde gel&ouml;scht!') ? $error : $clip;
255                 if($icon==$clip) {
256                     $ctr++;
257                     if($anhang['type'][$i]=='application/pdf') {
258                         $icon = $pdf;    
259                     }
260                     elseif($anhang['type'][$i]=='application/vnd.oasis.opendocument.text') {
261                         $icon = $odt;    
262                     }
263                     elseif($anhang['type'][$i]=='image/gif' || $anhang['type'][$i]=='image/png' || $anhang['type'][$i]=='image/jpg' || $anhang['type'][$i]=='image/jpeg') {
264                         $icon = $img;    
265                     }
266                     elseif($anhang['type'][$i]=='application/msword') {
267                         $icon = $doc;    
268                     }
269                     else {
270                         $icon = $docx;    
271                     }
272                 }
273                 $i++;
274                 $title = stristr($v, 'wurde gel&ouml;scht!') ? 'Sorry, falscher Dateityp' : 'Anhang '. $ctr;
275                 $msgAttach .= '<span title="'. $title .'">'. $icon .'</span><span style="color:#454545;" title="OOPS">'. $v .'</span>';
276                 $msgAttach .= '<p style="padding:0.25em; margin:0; border:0pt dotted #454545;"></p>';
277             }
278         }
279         //$msgAttach .= $pre;
280         $msgAttach .= '<div style="width:33%; padding:0.5em 0; margin:0px auto; border-bottom:1pt dashed black; text-align:center;"></div>';
281     }
282     if($anlagen==2) {
283         $msgHead   = '<span style="color:red;">Fehler beim Anhang</span>';
284         $msgText   = 'an error occured while reading attachment(s)!';
285     }
286     
287     $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&uuml;r deine Bewerbung.</span><br><br><span style="font-size:133%">Wir melden uns in den n&auml;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>';
288     
289     $style = 'none';
290 }
291 else
292 {
293     $action  = $_SERVER['PHP_SELF'] . '?nid=two';
294     $wer     = _filterData($_POST['wer']);
295     $email     = _filterData($_POST['email']);
296     $betreff = _filterData($_POST['subject']);
297     $text     = _filterData($_POST['text']);
298     
299     $check = $copy ? 'checked="checked"' : '';
300     $checked = $check;
301     
302     $checkAGB = $agb ? 'checked="checked"' : '';
303     $checkedAGB = $checkAGB;
304     
305     if($nr==1)
306     {    
307         $autofocus1 = 'autofocus';
308         $bg1 = 'background-color:#ffb8b8; border-color:#666;';
309         $bool1  = 'visible';
310         $alert1 = $alert[1];
311     } 
312     if($nr==2)
313     {    
314         $autofocus1 = '';
315         $autofocus2 = 'autofocus';
316         $bg2 = 'background-color:#ffb8b8; border-color:#666;';
317         $bool2  = 'visible';
318         $alert2 = $alert[2];
319     } 
320     if($nr==3)
321     {    
322         $autofocus3 = 'autofocus';
323         $bg3 = 'background-color:#ffb8b8; border-color:#666;';
324         $bool3  = 'visible';
325         $alert3 = $alert[3];
326     } 
327     if($nr==4)
328     {    
329         $bool4  = 'visible';
330         $alert4 = $alert[4];
331     } 
332     if($nr==5)
333     {    
334         $bool5  = 'visible';
335         $alert5 = $alert[5];
336     } 
337     if($nr==44)
338     {    
339         $bool44  = 'visible';
340         $alert44 = $alert[6];
341     } 
342     if($nr>3 && $nr<100)
343     {    
344         $autofocus1 = '';
345         $autofocus2 = '';
346         $autofocus3 = '';
347     }
348     if($red_bg)
349     {    
350         $alert55 = 'background-color:#ffb8b8;';
351         $alert66 = 'background-color:#ffb8b8;';
352     }
353     
354 }
355 ?>
356 
357 <div id="feedback" style="display:<?php echo $style; ?>">
358 
359   <fieldset class="fset">
360     <legend>Bewerbungsformular</legend>
361       <form class="fb" action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" name="feedback" id="feedback">
362 
363       <div style="display:none;">
364           <div class="beschriftung" title=""><span style="cursor:default;">An:</span><span style="font-size:95%; color:#b00; padding:0 2px; cursor:default;"></span></div>
365         <!-- title="Pflichtfeld (muss ausgef&uuml;llt werden)" -->
366           <input type="text" id="inp0" name="wer" placeholder="jobs@personalag.ch" onclick="$(inp0).value='Bitte nicht ausf&uuml;llen';" onblur="$(inp0).value='';" readonly="readonly" title="Dieses Feld nicht ausf&uuml;llen" size="25" maxlength="50" class="rand readonly" value="" /><br>
367           <div id="alertAn" class="alert" style="visibility:hidden">&nbsp;</div>
368           <p style="clear:left; padding:2px; margin:0;"></p>
369         </div>
370 
371         <div class="beschriftung" style="cursor:default;" title="Empf&auml;nger/in, Personalchef/in">An:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span></div>
372         <input type="text" id="inp1" name="email" placeholder="Empf&auml;nger" 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>
373         <div id="alertVon" class="alert" style="visibility:<?php echo $bool1; ?>"><?php echo $alert1; ?></div>
374         <!-- onclick="iXT(1); mandatoryClick(1,1)" onkeypress="mandatoryClick(1,0)"  -->
375         <p style="clear:left; padding:3px; margin:0;"></p>
376         
377           
378         <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>
379         <input type="text" id="inp2" name="subject" placeholder="Bewerbung als ..." 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>
380         <div id="alertBetreff" class="alert" style="visibility:<?php echo $bool2; ?>"><?php echo $alert2; ?></div>
381         <p style="clear:left; padding:3px; margin:0;"></p>
382         
383         
384         <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>    
385         <textarea id="inp3" name="text" onkeyup="$(alertMitteilung).style.visibility='hidden';this.style.backgroundColor='#fff';" onclick="this.style.backgroundColor='#fff';" placeholder="Sehr geehrte(r) ... ### 1 - 2 Sätze zum Inserat ### Freundliche Gr&uuml;sse und Name" rows="6" cols="" class="rand" style="<?php echo $bg3; ?>" <?php echo $autofocus3; ?>><?php echo $text; ?></textarea><br>
386         <div id="alertMitteilung" class="alert" style="visibility:<?php echo $bool3; ?>"><?php echo $alert3; ?></div>
387         <p style="clear:left; padding:2px; margin:0;"></p>
388         
389           
390         <div class="beschriftung" title="Sende eine Kopie dieser Bewerbung an dich selber">
391           <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>
392           <span style="cursor:default;">Kopie:&nbsp;</span>
393         </div>
394           <!--
395           <input type="checkbox" id="cb1" name="cbox1" onclick="try { document.getElementById('cb1').checked=false; } catch (e) {}" value="" />
396           -->
397         <div style="border:0px dotted grey;">
398           <input type="checkbox" id="cbx" name="copy2me" class="cb" style="display:none;" <?php echo $checked; ?> /><label class="cbl" for="cbx"></label>
399         </div>
400         
401         <p style="clear:left; padding:5px; margin:0; font-size: 8px;">&nbsp;</p>
402           
403           <div class="beschriftung" style="margin-top: -3px; padding-bottom: 50px;" title="PDF anh&auml;ngen &nbsp;>&nbsp; Symbol B&uuml;roklammer anklicken und Dokumente vom USB-Stick (D:) &ouml;ffnen">
404           <span style="cursor:default;">Anhang:&nbsp;</span>
405           </div>
406           
407           <div id="inpAtt" onclick="$('alertAnhang1').style.display='none';" style="display:inline-block; float:left; margin-left: 0px;">
408             <!--
409             <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;">
410                 <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>
411             </label>
412             <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;" />
413             <p style="padding:0.25em; margin:0;"></p>
414             -->
415             
416             <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; ?>">
417                 <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>
418             </label>
419             <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;" />
420             <p style="padding:0.25em; margin:0;"></p>
421               
422               
423             <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; ?>">
424                 <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>
425             </label>
426             <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;" />
427             <p style="padding:0.25em; margin:0;"></p>
428               
429               
430             <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;" >
431                 <img src="./img/paperclip.gif" alt="" width="15" height="15" border="0" style="margin:0 0 -2px 4px;" /> Foto&nbsp;/&nbsp;Diplome&nbsp;/&nbsp;Bewerbung
432             </label>
433             <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;" />
434             <!--
435             <input style="margin-left: -2px; padding:1pt 5pt 1pt 1pt; visibility:hidden; box-shadow:2px 2px 3pt #454545 !important; border-color:#fff !important;" />
436             -->
437             <p style="clear:left; padding:0.2em; margin:0;"></p> 
438             
439             
440             <span id="alertAnhang1" class="alert" style="padding: 0 0 4px 2px !important; visibility:<?php echo $bool4; ?>;"><?php echo $alert4; ?></span>
441             <span id="alertAnhang2" class="alert" style="padding: 0 0 4px 2px !important; visibility:<?php echo $bool44; ?>;"><?php echo $alert44; ?></span>
442             <span id="alertAnhang3" class="alert" style="padding: 0 0 4px 2px !important; display:none;">&bull; Bitte nur PDF, Bild- oder Word-Datei anh&auml;ngen</span>
443             <span id="alertAnhang4" class="alert" style="padding: 0 0 4px 2px !important; display:none;">&bull; Bitte nur PDF oder Word-Datei anh&auml;ngen</span>
444             <span id="alertAnhangX" class="alert" style="padding: 2px 0 !important; border:0px solid #f00;">&nbsp;</span>
445             <!--  
446             -->
447           </div>
448         
449         <p style="clear:left; padding:0; margin:0; font-size:8px;"></p>
450 
451         <div class="beschriftung">
452           <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 &nbsp;lesen: &nbsp;Bitte hier klicken" /></span></a>AGB:<span style="font-size:95%; color:#b00; padding:0 2px; cursor:help;" title="Pflichtfeld">*</span>
453         </div>
454         
455         <div style="border:0px dotted grey;">
456           <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>
457         </div>
458         
459         <div id="alertAGB" class="alert" style="visibility:<?php echo $bool5; ?>;">&bull; Bitte AGB best&auml;tigen</div>
460         <p style="clear:left; padding:0; margin:0; font-size:6px;">&nbsp;</p>
461           
462         <input type="hidden" name="ok" id="ok" value="yes" />
463         <input type="hidden" name="code" id="code" value="<?php echo $code; ?>"/>
464           
465         <div class="beschriftung" style="text-align:left;">&nbsp;<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>
466         
467         <input class="sub" style="margin-left:1px;" type="submit" name="abschicken" value="senden" title="E-Mail abschicken" onfocus="if(this.blur)this.blur();" onclick="" />
468           <p>&nbsp;</p>
469       </form>
470 </fieldset>
471 
472 <img src="./img/blind.gif" alt="" width="10" height="5" border="0" />
473 
474 </div>
475 
476 <!-- END formular -->
477 
478 <span style="float:left; color:#a00; font-weight:bold; font-size:1em;"><?php echo $meldung; ?></span>
479 <!-- -->
480 <div style="clear:left; padding:0.25em;">&nbsp;</div>
481 
482 
483 <script type="text/javascript">
484 var bool;
485 var ctr = 0;
486 function slide(id) {
487   console.log(bool);
488   console.log(' *** ');
489   if(id=='more') {
490       ctr++;
491       console.log(ctr);
492       Effect.SlideDown('more['+ctr+']', { duration: 0.75 }); 
493       if(ctr==2) {
494           $('moreTxt').style.display='none';
495       }
496       return false;
497   }
498 }
499 /*********** imgChange **********/
500 function eXT(num)
501 {
502     var a = ((document.feedback.elements.length)-3);    
503     //console.log(a); // 3 x input, 1 x textarea, 3 x attachment = 7
504     //console.log(' ### ' + num);
505     
506     for(var i=0; i<a; i++)
507       {
508         if(document.feedback.elements['inp'+i].value.length > 3) {
509             document.feedback.elements['inp'+i].style.borderColor      = '#c2c6ca';
510             document.feedback.elements['inp'+i].style.backgroundColor = 'transparent';
511         } else {
512             document.feedback.elements['inp'+i].style.borderColor      = '#2175bc'; 
513             document.feedback.elements['inp'+i].style.borderWidth      = '1pt'; 
514             document.feedback.elements['inp'+i].style.borderStyle      = 'solid'; 
515             document.feedback.elements['inp'+i].style.backgroundColor = '#fff';
516         }
517     }
518 }
519 
520 function iXT(num) {
521     document.feedback.elements['inp'+num].style.borderColor     = '#555';
522     document.feedback.elements['inp'+num].style.borderWidth          = '1pt'; 
523     document.feedback.elements['inp'+num].style.borderStyle          = 'solid'; 
524     document.feedback.elements['inp'+num].style.backgroundColor = '#f8f8ff';
525 }
526     
527 /** 
528  * 21.12.2019:
529  * Kontrollfunktion Pflichtfelder, um angehaengte Dateien
530  * nicht zu verlieren falls AGB!=checked  
531 **/
532 function getFilePathExtension(path) {
533     var filename  = path.split('\\').pop().split('/').pop();
534     var lastIndex = filename.lastIndexOf(".");
535     if (lastIndex < 1) return "";
536     return filename.substr(lastIndex + 1);
537 }
538 function checkExtension(a,b) {
539     const allowedExtension = ['pdf','odt','doc','docx','rtf'];
540     aLC  = a.toLowerCase();
541     resA = allowedExtension.indexOf(aLC);
542     bLC  = b.toLowerCase();
543     resB = allowedExtension.indexOf(bLC);
544     if(resA != -1 && resB != -1)  {
545         return true;
546     } else {
547         return false;
548     }
549 }
550 function checkDocument(ext) {
551     const allowedExtension = ['pdf','odt','doc','docx','rtf'];
552     extLC = ext.toLowerCase();
553     res = allowedExtension.indexOf(extLC);
554     if(res == -1)  {
555         return true;
556     } else {
557         $('alertAnhang4').style.display='none';
558         return false;
559     }
560 }
561 function checkPicture(ext) {
562     const allowedExtension = ['png','gif','jpg','jpeg','pdf','tif','tiff','bmp','doc','docx','odt'];
563     extLC = ext.toLowerCase();
564     res = allowedExtension.indexOf(extLC);
565     if(res == -1)  {
566         return true;
567     } else {
568         $('alertAnhang3').style.display='none';
569         return false;
570     }
571 }
572 document.getElementById('feedback').onsubmit = function(evt) {     
573    let inp1 = document.feedback.elements['inp1'].value;
574    let inp2 = document.feedback.elements['inp2'].value; 
575    let inp3 = document.feedback.elements['inp3'].value;
576    let inp5 = document.feedback.elements['inp5'].value;
577    let inp6 = document.feedback.elements['inp6'].value;
578    let ext5 = getFilePathExtension(inp5);
579    let ext6 = getFilePathExtension(inp6);
580      result = checkExtension(ext5,ext6);
581    let agb  = document.getElementById('cbxAGB').checked;
582    if (agb==false && inp1!='' && inp2!='' && inp3!='' && inp5!='' && inp6!='' && result==true) {
583       //console.log('Please confirm »AGB«');
584       $('alertAGB').style.visibility='visible';
585       //evt.preventDefault();
586       (evt.preventDefault) ? evt.preventDefault() : evt.returnValue = false; // older Browsers < IE8
587    } 
588 }
589 function chkDoc(str_value, num_label) {
590   if(str_value) {
591     ext=getFilePathExtension(str_value);
592     if( checkDocument(ext) ) {
593         $('alertAnhang4').style.display='block';
594         $('alertAnhang1').style.display='none';
595         $('alertAnhang2').style.display='none';
596         $('alertAnhang3').style.display='none';
597         $('label'+num_label).style.backgroundColor='#ffb8b8';
598         $('label'+num_label).style.display='inline';
599         $('inp'+num_label).style.visibility='hidden';
600         document.feedback.elements['inp'+num_label].value=null;
601         
602     }
603   }
604 }
605 function chkImg(str_value, num_label) {
606   console.log('path :: ' + str_value);
607   if(str_value) {
608     ext=getFilePathExtension(str_value);
609     console.log(ext);
610     if( checkPicture(ext) ) {
611         console.log(num_label);
612         $('alertAnhang3').style.display='block';
613         $('alertAnhang1').style.display='none';
614         $('alertAnhang2').style.display='none';
615         $('alertAnhang4').style.display='none';
616         $('label7').style.backgroundColor='#ffb8b8';
617         $('label7').style.display='inline';
618         $('inp7').style.visibility='hidden';
619         $('inp'+num_label).value=null;
620     }
621   }
622 }
623 
624 </script>
625