You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
911 B

  1. <?php
  2. define("MYSQL_HOST", "106.14.56.77");
  3. define("MYSQL_USER", "spider");
  4. define("MYSQL_PASSWORD", "PjGPWNUgOYe6i1Ef");
  5. define("MYSQL_DB", "ctsdata");
  6. define("MYSQL_DB_CTSDATA", "ctsdata");
  7. define("MYSQL_PORT", 3306);
  8. function conn(){
  9. $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
  10. try {
  11. $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"));
  12. return $pdo;
  13. }catch (PDOException $e){
  14. write_log('ctsdata new PDO failed:'.$e->getMessage());
  15. }
  16. }
  17. function conn_ctsdata(){
  18. $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
  19. try {
  20. $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"));
  21. return $pdo;
  22. }catch (PDOException $e){
  23. write_log('ctsdata new PDO failed:'.$e->getMessage());
  24. }
  25. }
  26. ?>