title: php prevent csrf attacks in mutiple submit
body: <p>I work with this PHP <a href="https://github.com/BKcore/NoCSRF" rel="nofollow">class</a> for prevent CSRF from attack.</p>
  
  <p>CODE:</p>
  
  <pre><code>$token = NoCSRF::generate( 'csrf_token' );
  
  &lt;form name="csrf_form" action="#" method="post"&gt;
      &lt;input type="hidden" name="csrf_token" value="&lt;?php echo $token; ?&gt;"&gt;
      ...Other form inputs...
      &lt;input type="submit" value="Send form"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>for check csrf:</p>
  
  <pre><code>try
  {
      // Run CSRF check, on POST data, in exception mode, with a validity of 10 minutes, in one-time mode.
      NoCSRF::check( 'csrf_token', $_POST, true, 60*10, false );
      // form parsing, DB inserts, etc.
  }
  catch ( Exception $e )
  {
      // CSRF attack detected
  }
  </code></pre>
  
  <p>this worked for me when i have one from in my page But when i have two form in my page only work with one form and in other form submit always show <code>CSRF attack detected</code>.</p>
  
  <p>php check FORM 1:</p>
  
  <pre><code>if($_POST['submit'] == "from") &amp;&amp; !empty($_POST['username'])){
  
     try
        {
          // Run CSRF check, on POST data, in exception mode, with a validity of 10 minutes, in one-time mode.
          NoCSRF::check( 'csrf_token', $_POST, true, 60*10, false );
          // form parsing, DB inserts, etc.
      }
      catch ( Exception $e )
      {
          // CSRF attack detected
      }
  }
  </code></pre>
  
  <p>php check FORM 2:</p>
  
  <pre><code>if($_POST['submit'] == "from2") &amp;&amp; !empty($_POST['username'])){
  
     try
        {
          // Run CSRF check, on POST data, in exception mode, with a validity of 10 minutes, in one-time mode.
          NoCSRF::check( 'csrf_token', $_POST, true, 60*10, false );
          // form parsing, DB inserts, etc.
      }
      catch ( Exception $e )
      {
          // CSRF attack detected
      }
  }
  </code></pre>
  
  <p>HTML FORM:</p>
  
  <pre><code> &lt;form name="csrf_form" action="#" method="post"&gt;
               &lt;?PHP $token = NoCSRF::generate( 'csrf_token' );?&gt;
              &lt;input type="hidden" name="csrf_token" value="&lt;?php echo $token; ?&gt;"&gt;
              &lt;input type="text" name="username"&gt;
              &lt;input type="submit" value="form"&gt;
          &lt;/form&gt;
      &lt;form name="csrf_form" action="#" method="post"&gt;
               &lt;?PHP $token = NoCSRF::generate( 'csrf_token' );?&gt;
              &lt;input type="hidden" name="csrf_token" value="&lt;?php echo $token; ?&gt;"&gt;
              &lt;input type="text" name="badname"&gt;
              &lt;input type="submit" value="form2"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>how do fix this OR how do work this class for multiple form?!</p>
  
  <p>class source <a href="https://raw.githubusercontent.com/BKcore/NoCSRF/master/nocsrf.php" rel="nofollow">here</a></p>