###Simple Advice This is just a reminder. When setting environment variables through **.htaccess**, **CLI** or **dotenv** use `filter_var()` to evaluate a boolean. For example, start the built-in PHP server with these variables: DEBUG=FALSE LOG=TRUE SMS=1 SMTP=0 CONNECT=yes BACKUP=no php -d variables_order=EGPCS -S localhost:8000 And then test through `boolval()`: if you forget to use 1 and 0, then something can go wrong as the variable is evaluated like a string and will always return `TRUE`. By using `filter_var()`, with the appropriate filter to validate boolean, you get more flexibility as it: > returns TRUE for "1", "true", "on" and "yes". Returns …

Member Avatar
+0 forum 0

When using emails as usernames you want them to be unique over your table, but this can be a problem if you consider a GMail account, because of their [username](https://support.google.com/mail/answer/12096?hl=en) [policy](https://support.google.com/mail/answer/10313?hl=en). They allow: * dots * digits * letters * plus addressing text by using the `+` sign, i.e. `orange+juice@gmail.com` * length between 6 and 30 characters, excluding dots and the appended part But when resolving the username they do not consider: * dots * different capitalization * plus addressing So, when you write to: UserName@gmail.com u.sername@gmail.com user.name+forum@gmail.com .u.s.e.r.n.a.m.e.@gmail.com u.serName+doh@googlemail.com You will always match the same account: username@gmail.com This class …

Member Avatar
Member Avatar
+2 forum 1

#This is for Laravel 3.*# ## Hello, ## With this snippet I'm providing a simple way to automatically filter `Input::get()` and `Input::old()`. To achieve this result we need to make few changes: * extend Input and Redirect classes by creating new files in `application/libraries/`, the files are: **input.php** and **redirect.php**; * comment the aliases of these classes in `application/config/application.php` file, otherwise the application will ignore the extended libraries. The extended Input class overwrites `Input::query()` so it can use the new method `Input::sanitize()`, which is where you can place your filters, in this example I'm using `filter_var_array()`: public static function sanitize($array) …

Member Avatar
+1 forum 0

Hi! *Minimize HTTP requests*. One of the suggestion I always read is to combine files, so I made a little Class that merges files on the fly, the supported formats are CSS and Javascript. With little efforts, I think, it can work fine also with JSON and CSV. Usage is simple: * create a file that will serve data and in which the class is included * set config variables: method, path and type * use a link in this format: `/merge/?css&first.css&second.css&third.css` Basically: <?php $list = $_SERVER['QUERY_STRING']; $config['path']['css'] = '/css/'; $config['path']['js'] = '/js/'; include 'merger.class.php'; try { $z = new …

Member Avatar
Member Avatar
+1 forum 2

The End.