rubo77

Untitled

Sep 30th, 2013
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html><head>
  2. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  3. <title>circumvent max_input_vars limit in PHP</title></head>
  4. <body>
  5. <a href="max_input_vars3.php">restart</a><br>
  6. <?php
  7. if(!empty($_REQUEST)) {
  8.     echo count($_REQUEST,1)." num request variables
  9.     <pre>";
  10.    
  11.     if(isset($_REQUEST['serialized_data'])){
  12.         $params = array();
  13.         parse_str(urldecode($_REQUEST['serialized_data']), $params);
  14.         echo count($params,1)." serialized variables:";
  15.         var_export($params);
  16.     }else var_export($_REQUEST);
  17.     echo "</pre>";
  18. }else {
  19.     ?><h1>visible post form 1</h1>
  20.     <form method="post" id="f" action=""><?
  21.         for($i=0;$i<10;$i++) echo '<input type="hiddden" value="v'.$i.'<" name="v'.$i.'">';
  22.         ?><input type="submit" name="sadosa">
  23.     </form>
  24.     <h1>hidden form 2 1100 vars</h1>
  25.     <form method="post" id="f2">
  26.         <input type="text" value="v&quot;a" name="somequote"><?
  27.         for($i=0;$i<1100;$i++) echo '<input type="hidden" value="v'.$i.'" name="v'.$i.'">';
  28.         ?><textarea name="bla">blubb</textarea>
  29. <select name="bla"><option>test</select>
  30. <input type="submit">
  31.     </form>
  32.     <h1>multidimensional form</h1>
  33.     <form method="post" id="m"><?
  34.         for($i=0;$i<5;$i++){
  35.             for($k=0;$k<2;$k++){
  36.                 echo '<input type="hidden" value="m'.$i.'_'.$k.'" name="m['.$i.']['.$k.']">';
  37.             }
  38.         }?><input type="submit">
  39.     </form>
  40.     <h1>get form</h1>
  41.     <form method="get" id="g"><?
  42.         for($i=0;$i<10;$i++) echo '<input type="hidden" value="v'.$i.'" name="v'.$i.'">';
  43.         ?><input type="submit">
  44.     </form>
  45.     <?
  46.  
  47.  
  48. }
  49. ?>
  50.     <script>
  51.     // this disables all form elements and creates only one new element that contains all data serialized
  52.     $('form[method=post]').click(function() {
  53.         var data=$(this).serialize();
  54.         var num_form_elements=$(this).find('input, select, textarea').not('[type="submit"]').length;
  55.         var num_elements_already_disabled=$(this).find('input:disabled, select:disabled, textarea:disabled').length;
  56.         $(this).find('input, select, textarea').not('[type="submit"]').attr("disabled", true);
  57.         $(this).append('    <input type="hidden" name="num_form_elements" value="'+num_form_elements+'">');  // to mark request
  58.         $(this).append('    <input type="hidden" name="num_elements_already_disabled" value="'+num_elements_already_disabled+'">');  // to mark request
  59.         $(this).append('    <textarea style="display:true" name="serialized_data">'+(data)+'</textarea>'); // maybe .replace(/</g,'&lt;')
  60.         // or use instead of a hidden input:
  61.         //$(this).append('  <input type="hidden" name="serialized_data" value="'+data+'">');  // maybe .replace(/"/g,'&quot;')
  62.        
  63.         /*
  64.  
  65.         TODO: find submitbutton and clone it, somehow like var submitbutton = $(this).find("input[type=submit]").first();
  66.        
  67.         $( "form[method=post]" ).each(function( index ) {
  68.             $(this).attr("uniqueID",index)
  69.         });
  70.         ...
  71.         var uniqueID=$(this).attr("uniqueID");
  72.         //var uniqueID = Math.floor( Math.random()*99999 );
  73.  
  74.         var action=$(this).attr("action");
  75.         var actionstr='';
  76.         if(action!=undefined) actionstr=' action="'+action+'"';
  77.         alert($(this).attr("id"));
  78.         $(this).append('<form method="post"'+actionstr+' id="generatedform'+uniqueID+'">');
  79.         $(this).append('    <input type="submit">');
  80.         $(this).append('</form>');
  81.         */
  82.         //t=setTimeout("$('#generatedform'+uniqueID).submit();",500);
  83.        
  84.         //return false;
  85.     });
  86.     </script>
  87. </body></html><?
Advertisement
Add Comment
Please, Sign In to add comment