.:: :[ AK-74 Security Team Web-shell ]: ::.
phpinfo()
PHP
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Add more fields using jQuery</title> <style type="text/css"> input[type="text"]{height:18px;width:220px;vertical-align:top;} .field_wrapper div{ margin-bottom:10px;} .add_button{ margin-top:10px; margin-left:10px;vertical-align: text-bottom;} .removeBtn{ margin-top:10px; margin-left:10px;vertical-align: text-bottom;} </style> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var maxCount = 5; var addButton = $('.add_button'); var wrapper = $('.field_wrapper'); var AddBox = '<div><input type="text" name="kordiv[]" value=""/><a href="#" class="removeBtn" title="제거"><img src="remove-icon.png"/></a></div>'; var x = 1; $(addButton).click(function(e){ e.preventDefault(); if(x < maxCount){ x++; $(wrapper).append(AddBox); }else{ alert('최대 '+maxCount+'개까지 허용합니다'); return false; } }); $(wrapper).on('click', '.removeBtn', function(e){ e.preventDefault(); $(this).parent('div').remove(); x--; }); $("#submit1").click(function(){ // 폼 요소 내부의 입력값만을 찾기 위해서 폼 요소에서 find()를 호출 var xyz = $("#myform").find('[name=xyz]').val(); if(xyz =='') { alert('xyz 값이 입력되지 않았습니다.'); return false; } // 배열로 된 값이 제대로 입력되었는지 체크 var cnt = 0; $('input[name^="kordiv"]').each(function() { //alert($(this).val()); if($(this).val() === '') { cnt++; } }); if(cnt > 0){ alert('kordiv 에 입력되지 않는 필드가 '+cnt+'개 있습니다'); return false; } var formData = $("#myform").serialize(); var URL = $("#myform").attr("action"); $.post(URL, formData, function(data, textStatus, jqXHR){ alert(data); var data = jQuery.parseJSON(data); $.each(data, function(index, value) { alert(value); }); }).fail(function(jqXHR, textStatus, errorThrown) { console(errorThrown); }); }); }); </script> </head> <body> <form name="frm" id="myform" action="result.php" method="POST"> <input type="hidden" name="xyz" value="123" /> <div class="field_wrapper"> <div> <input type="text" name="kordiv[]" value=""/> <a href="#" class="add_button" title="추가"><img src="add-icon.png"/></a> </div> </div> <input type="hidden" name="submit" value="true" /> </form> <br/> <input type="button" id="submit1" value="전송" /> </body> </html> 출처: https://link2me.tistory.com/1161 [소소한 일상 및 업무TIP 다루기]
Rename:
-