Going from a framework to no-framework [closed]

Current versions of PHP5 include much of the security framework you’re looking for as part of the standard library. Use filter_input_array to declaratively sanitize stuff coming in from the outside. Access your database via PDO with parameterized SQL to prevent SQL injection attacks. Use the following PHP settings to make your site more resistant to … Read more

explain $CI =& get_instance();

It’s basically a Singleton Design Pattern that uses a function instead of a static method. To look deeper, check out the source code So basically, it doesn’t enforce the singleton, but it’s a shortcut to a public function… Edit: Actually, now I understand. For PHP4 compatibility they had to do a double-global-variable-hack to get it … Read more

How to do error logging in CodeIgniter (PHP)

CodeIgniter has some error logging functions built in. Make your /application/logs folder writable In /application/config/config.php set $config[‘log_threshold’] = 1; or use a higher number, depending on how much detail you want in your logs Use log_message(‘error’, ‘Some variable did not contain a value.’); To send an email you need to extend the core CI_Exceptions class … Read more

PHP_SELF vs PATH_INFO vs SCRIPT_NAME vs REQUEST_URI

Some practical examples of the differences between these variables: Example 1. PHP_SELF is different from SCRIPT_NAME only when requested url is in form: http://example.com/test.php/foo/bar [PHP_SELF] => /test.php/foo/bar [SCRIPT_NAME] => /test.php (this seems to be the only case when PATH_INFO contains sensible information [PATH_INFO] => /foo/bar) Note: this used to be different in some older PHP … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)