NOTICE: Undefined index: MYSQL_DB in /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 329
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 495
490.
$msg = "ERROR";
491.
if($errno == E_WARNING)$msg = "WARNING";
492.
if($errno == E_NOTICE)$msg = "NOTICE";
493.
if($errno == E_STRICT)$msg = "STRICT";
494.
if($errno == 8192)$msg = "DEPRECATED";
495.
496.
err("$msg: $errstr in $errfile on line $errline");
}
497.
function err($msg){
498.
$msg = htmlspecialchars($msg);
499.
$traces = debug_backtrace();
500.
if(!$GLOBALS['debug']){
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 329
324.
}
325.
326.
public function dbInstance($db_config, $db_config_key, $force_replace = false){
327.
if($force_replace || empty($GLOBALS['mysql_instances'][$db_config_key])){
328.
try {
329.
330.
$GLOBALS['mysql_instances'][$db_config_key] = new PDO('mysql:dbname='.$db_config['MYSQL_DB'].';host='.$db_config['MYSQL_HOST'].';port='.$db_config['MYSQL_PORT'], $db_config['MYSQL_USER'], $db_config['MYSQL_PASS'], array(PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES \''.$db_config['MYSQL_CHARSET'].'\''));
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
331.
}
332.
return $GLOBALS['mysql_instances'][$db_config_key];
333.
}
334.
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 303
298.
299.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
300.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
301.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
302.
}else{
303.
304.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
305.
306.
if(is_array($params) && !empty($params)){
307.
foreach($params as $k => &$v){
308.
if(is_int($v)){
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 295
290.
}
291.
}
292.
return $this->page;
293.
}
294.
295.
296.
public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false){
297.
$this->sql[] = $sql;
298.
299.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
300.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
- /data1/www/htdocs/569/speedphp/1/protected/controller/DbController.php on line 75
70.
$sql = "SELECT * FROM test_user WHERE uid > :uid";
71.
72.
// query第一个参数是SQL语句,第二个参数是绑定参数的列表
73.
$this->findall = $user->query($sql, array(
74.
":uid" => $uid, // 注意这种绑定参数的做法,可以防止SQL注入
75.
76.
));
$this->display("db/query.html");
77.
}
78.
79.
// SQL执行execute
80.
function actionExecute(){
- /data1/www/htdocs/569/speedphp/1/protected/lib/speed.php on line 80
75.
if(!is_available_classname($__controller))_err_router("Err: Controller '$controller_name' is not correct!");
76.
if(!class_exists($controller_name, true))_err_router("Err: Controller '$controller_name' is not exists!");
77.
if(!method_exists($controller_name, $action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
78.
79.
$controller_obj = new $controller_name();
80.
81.
$controller_obj->$action_name();
82.
if($controller_obj->_auto_display){
83.
$auto_tpl_name = (empty($__module) ? '' : $__module.DS).$__controller.'_'.$__action.'.html';
84.
if(file_exists(APP_DIR.DS.'protected'.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
85.
}
- /data1/www/htdocs/569/speedphp/1/index.php on line 3
1.
<?php
2.
define('APP_DIR', realpath('./'));
3.
require(APP_DIR.'/protected/lib/speed.php');