Understanding #Laravel Middleware

HTTP Middlewares provide a convenient mechanism for filtering HTTP requests entering your application. Laravel, for example, has a middleware for verifying a user’s authentication.

Some Middleware Use-Cases

  • Using a middleware to confirm the incoming route request API key. Assuming you are building an API.
  • Rate-limiting a service call.
  • Change the site language based on locale.
  • Enable site-wide maintenance.
  • Sniffing bot traffic.
  • Logging.

Linkhttps://scotch.io/tutorials/understanding-laravel-middleware

Cross-Site Request Forgery (CSRF) #podcasts

Cross-Site Request Forgery (CSRF) are a type of security attacks that may cause user accounts to be abused, so attackers can make users perform actions inadvertently in a vulnerable site and cause serious problems to the users and the sites.

There is a new proposal for PHP 7.1 to provide built-in semi-automatic protection against CSRF attacks, so it will be easier for PHP developers to protect the sites they develop against this type of exploit.

Podcasthttp://www.phpclasses.org/blog/post/401-Builtin-Protection-Against-CSRF-Security-Attacks-in-PHP-71–Lately-in-PHP-podcast-episode-72.html

JavaScript Rounding

Very often calculations in javascript produce results that don’t quite fall within the ranges we want, or generate numbers that need to be “cleaned up” before use. Exactly what happens to those numbers – rounding up or down, set within a range, or being “clipped” to a certain number of decimal places – depends on what you want to use them for.

Link: http://thenewcode.com/895/JavaScript-Rounding-Recipes