<?php
/*
 Author:XM
 Compeny:Spiders Travel
 */
require_once   __DIR__.'/Config.php';
require_once __DIR__.'/Function.php';
require_once __DIR__.'/sinaAPI.php';
function conn1(){
	$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){
		writeLog('new PDO failed:'.$e->getMessage());
	}
}
function conn(){
	$port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
	try {
		$pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=ctsdata", MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
		return $pdo;
	}catch (PDOException $e){
		writeLog('new PDO failed:'.$e->getMessage());
	}
}
function conn2(){
	$port=defined('MYSQL_PORT2')?MYSQL_PORT2:3306;
	try {
		$pdo=new PDO("mysql:host=".MYSQL_HOST2.";port=".$port.";dbname=".MYSQL_DB2, MYSQL_USER2, MYSQL_PASSWORD2,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
		return $pdo;
	}catch (PDOException $e){
		writeLog('new PDO failed:'.$e->getMessage());
	}
}