Welcome Guest, Not a member yet? Register   Sign In
Looking for security / performance experts
#10

(This post was last modified: 11-28-2016, 09:05 PM by nemeris.)

(11-28-2016, 08:53 PM)cartalot Wrote: I tried a bunch of different solutions for form double submissions - this jquery solution was the best i found - requires that you load the jquery library

Code:
      <script>
           jQuery.fn.preventDoubleSubmission = function () {
               $(this).on('submit', function (e) {
                   var $form = $(this);

                   if ($form.data('submitted') === true) {
                       e.preventDefault();
                   } else {
                       $form.data('submitted', true);
                   }
               });

               return this;
           };

           $('form').preventDoubleSubmission();

          $('form :submit').click(function () {
               $(this).prop("disabled", true).closest('form').append($('<input/>', {
                   type: 'hidden',
                   name: this.name,
                   value: this.value
               })).submit();
           });

</script>

Thank you, this will stop accidental double submitions by innocent users, but I was thinking about server side prevention to stop attackers, racing attacks etc (e.g. making sure an external API call doesn't get executed twice because of double submition or racing attacks)


(11-28-2016, 08:53 PM)cartalot Wrote: Best performance tip - Codeigniter Caching is amazing. Even if your content changes every 10 minutes , you just put this one line in the method that is calling the views:
PHP Code:
$this->output->cache(10); 

and now any simultaneous viewers of the page - are all hitting the cached version which comes back instantly. your database is completely untouched and its resources saved for the more critical tasks.

This performance tip was awesome thank you sir Heart basically even setting this to 1 will reduce the pressure on the database by a lot


Messages In This Thread
RE: Looking for security / performance experts - by nemeris - 11-28-2016, 09:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB