Database
/www/wwwroot/ on line 349
344. try {
345. if(!class_exists("PDO") || !in_array("mysql",PDO::getAvailableDrivers(), true)){
346. err('Database Err: PDO or PDO_MYSQL doesn't exist!');
347. }
348. $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'], arrayNAMES ''.$db_config['MYSQL_CHARSET'].'''));
349. }catch(PDOException $e){err('Database Err: '.$e->getMessage());}
350. }
351. return $GLOBALS['mysql_instances'][$db_config_key];
352. }
353.
354. private function _where($conditions){
/www/wwwroot/ on line 319
314.
315. if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
316. $slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
317. $sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
318. }else{
319. $sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
320. }
321.
322. if(is_array($params) && !empty($params)){
323. foreach($params as $k => &$v){
324. if(is_int($v)){
/www/wwwroot/ on line 311
306. }
307. }
308. return $this->page;
309. }
310.
311. public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
312. public function execute($sql, $params = array(), $readonly = false){
313. $this->sql = $sql;
314.
315. if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
316. $slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
/www/wwwroot/ on line 232
227. $limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
228. $limit = empty($limit) ? '' : ' LIMIT '.$limit['offset'].','.$limit['limit'];
229. }else{
230. $limit = !empty($limit) ? ' LIMIT '.$limit : '';
231. }
232. return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
233. }
234.
235. public function find($conditions = array(), $sort = null, $fields = '*'){
236. $res = $this->findAll($conditions, $sort, $fields, 1);
237. return !empty($res) ? array_pop($res) : false;
/www/wwwroot/ on line 236
231. }
232. return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
233. }
234.
235. public function find($conditions = array(), $sort = null, $fields = '*'){
236. $res = $this->findAll($conditions, $sort, $fields, 1);
237. return !empty($res) ? array_pop($res) : false;
238. }
239.
240. public function update($conditions, $row){
241. $values = array();
/www/wwwroot/ on line 71
66. $url=(arg("a"));
67. $this->url=$url;
68. $biao = new Model("lanmu_zp");
69. $resultid=(arg("id"));
70.
71. $result = $biao->find(array("id" => $resultid));
72. $resulta=$result['name'];
73.
74. if(empty($resulta) || !preg_match("#^d+$#",arg("id"))){
75. header("HTTP/1.0 404 Not Found");
76. $host='http://'.$_SERVER['HTTP_HOST'];
/www/wwwroot/ on line 88
83. if(!is_available_classname($__controller))_err_router("Err: Controller '$controller_name' is not correct!");
84. if(!class_exists($controller_name, true))_err_router("Err: Controller '$controller_name' is not exists!");
85. if(!method_exists($controller_name, $action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
86.
87. $controller_obj = new $controller_name();
88. $controller_obj->$action_name();
89.
90. if($controller_obj->_auto_display){
91. $auto_tpl_name = (empty($__module) ? '' : $__module.DS).$__controller.'_'.$__action.'.html';
92. if(file_exists(APP_DIR.DS.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
93. }
/www/wwwroot/ on line 12
7. define('SHIREN','shiren');
8. define('TABLY','lanmu_a');
9. define('ZAOJU','zaoju');
10. define('GUSHI','gushi');
11. define('CHENGYU','chengyu');
12. require(APP_DIR.'/lib/speed.php');
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权本站发表,未经许可,不得转载。