|
- <?php
- define("MYSQL_HOST", "106.14.56.77");
- define("MYSQL_USER", "spider");
- define("MYSQL_PASSWORD", "PjGPWNUgOYe6i1Ef");
- define("MYSQL_DB", "ctsdata");
- define("MYSQL_DB_CTSDATA", "ctsdata");
- define("MYSQL_PORT", 3306);
- function conn(){
- $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
- try {
- $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=".MYSQL_DB, MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
- return $pdo;
- }catch (PDOException $e){
- write_log('ctsdata new PDO failed:'.$e->getMessage());
- }
- }
-
-
- function conn_ctsdata(){
- $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
- try {
- $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=".MYSQL_DB_CTSDATA, MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
- return $pdo;
- }catch (PDOException $e){
- write_log('ctsdata new PDO failed:'.$e->getMessage());
- }
- }
-
- ?>
|