Sanitize User Input Text with PHP
When you prompt user to input text (e.g. username, lastname etc), you may use Regular expressions to sanitize User Input, for example: allow space, any unicode letter if(preg_match("/[^\040\pL]/u", $term)) {…
When you prompt user to input text (e.g. username, lastname etc), you may use Regular expressions to sanitize User Input, for example: allow space, any unicode letter if(preg_match("/[^\040\pL]/u", $term)) {…
Getting file extension and basename is a common development task. PHP internal function pathinfo is very useful. But, Windows paths will not work correctly on Linux servers and vice versa.…
http is a stateless protocol. A way to remember information from page to page is to use cookies. According to Wikipedia: A cookie, also known as an HTTP cookie, web…
It is useful to prevent direct access of AJAX calls (from browser address bar). A solution could be the following simple function check_is_ajax(): /** * Check if request is an…
The term "localization" is used as a synonym of "internationalization", which is the most proper term. Sometimes, internationalization is shortened to "i18N" (meaning "i - eighteen letters -n"). gettext is…