{ return mysql_real_escape_string($expression); } /* * Sets the client character set (requires MySQL 5.0.7+). * * @param string $encoding the charset encoding to set */ function set_charset($encoding) { if (function_exists('mysql_set_charset')) { //>=PHP 5.2.3 mysql_set_charset($encoding, $this->id); } else { //Old PHP version $this->sql_query("SET NAMES '{$encoding}'"); } } } /** * The main sql_db instance * * @global sql_db $db */ $db = new sql_db($Config['sql']['host'], $Config['sql']['username'], $Config['sql']['password'], $Config['sql']['database']); $db->set_charset('utf8'); //By security, we unset the SQL parameters, so you can safely output Zed //config parts (there's still the problem of the secret key, but it's less //a security problem than database password) unset($Config['sql']); }