Search code examples
phpflood-fillflooding

Flood Data in PHP form


I want to flood some random data in a PHP form. Can I do it?

I want to actually test my website and database ofcourse. All I want to know that is it capable of handling if multiple registration is done at same time.


Solution

  • First, create pages that echo data from source.

    data1.php
    data2.php
    data3.php
    data4.php
    

    Second create a php page that will do the following:

    1. Create variables from data sources.
    2. Pass variables into array.
    3. Randomly select a specific variable.
    4. Echo results into page.

      // variables from data
      $var1 = file_get_contents('data1.php');
      $var2 = file_get_contents('data2.php');
      $var3 = file_get_contents('data3.php');
      $var4 = file_get_contents('data4.php');

      // pass variables into array
      $data = array($var1, $var2, $var3, $var4,);

      $dkey = array_rand($data); // random selection
      echo 'Data: '.$data[$dkey]; // echo selection

    Your finished code will look like this:

    <?php
    $var1 = file_get_contents('data1.php');  
    $var2 = file_get_contents('data2.php');   
    $var3 = file_get_contents('data3.php');   
    $var4 = file_get_contents('data4.php');   
    
    $arr = array($var1, $var2, $var3, $var4,);  
    
    $key = array_rand($arr);    
    echo 'Data: '.$arr[$key];   
    ?>