strict class, trying to figure out why edit account doesnt work
This commit is contained in:
parent
f21f05e874
commit
9dcb855b34
@ -9,6 +9,10 @@ if (empty($config['algorithm']) || $config['algorithm'] == 'scrypt') {
|
||||
} else {
|
||||
$config['target_bits'] = 32;
|
||||
}
|
||||
if ($config['strict']) {
|
||||
require_once(CLASS_DIR . '/strict.class.php');
|
||||
}
|
||||
|
||||
// Default classes
|
||||
require_once(CLASS_DIR . '/debug.class.php');
|
||||
require_once(INCLUDE_DIR . '/lib/KLogger.php');
|
||||
|
||||
45
public/include/classes/strict.class.php
Normal file
45
public/include/classes/strict.class.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class SessionManager {
|
||||
private $session_state = 0;
|
||||
|
||||
public function create_session($ip) {
|
||||
// TODO: put memcache rate limiting into here
|
||||
}
|
||||
}
|
||||
|
||||
class mysqli_strict extends mysqli {
|
||||
public function bind_param($paramTypes) {
|
||||
if (!is_string($paramTypes)) {
|
||||
return false;
|
||||
} else {
|
||||
$args = func_get_args();
|
||||
$acopy = $args;
|
||||
$nargs = count($args);
|
||||
for($i=1;$i<$nargs;$i++) {
|
||||
$pos = substr($paramTypes, ($i-1), 1);
|
||||
switch ($pos) {
|
||||
case 's':
|
||||
$return_str = filter_var($acopy[$i], FILTER_VALIDATE_STRING, FILTER_NULL_ON_FAILURE);
|
||||
return ($return_str !== null) ? (string)$return_str : false;
|
||||
break;
|
||||
case 'i':
|
||||
$return_int = filter_var($acopy[$i], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
|
||||
return ($return_int !== null) ? (int)$return_int : false;
|
||||
break;
|
||||
case 'd':
|
||||
$return_dbl = filter_var($acopy[$i], FILTER_VALIDATE_FLOAT, FILTER_NULL_ON_FAILURE);
|
||||
return ($return_dbl !== null) ? (double)$return_dbl : false;
|
||||
break;
|
||||
case 'b':
|
||||
$return_bool = filter_var($acopy[$i], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||
return ($return_bool !== null) ? (boolean)$return_bool : false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -5,7 +5,12 @@ if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
|
||||
// Instantiate class, we are using mysqlng
|
||||
$mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
||||
if ($config['strict']) {
|
||||
$mysqli = new mysqli_strict($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']) or die('couldnt load class');
|
||||
//$mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// Check if read-only and quit if it is on
|
||||
if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS read_only')->fetch_object()->read_only == 1) {
|
||||
@ -16,4 +21,5 @@ if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS r
|
||||
if (mysqli_connect_errno()) {
|
||||
die("Failed to connect to database");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user