private function __construct() { //-----------需要页面显示调试信息, 注释掉下面两行即可--- //------------------------------------------------------- set_error_handler(array("Core", 'appError')); set_exception_handler(array("Core", 'appException')); date_default_timezone_set("Asia/Shanghai"); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @set_magic_quotes_runtime(0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False); } if (!defined('WEB_PATH')) { //define("WEB_PATH","D:/wamp/www/pc2.valsun.cn/"); define("WEB_PATH", "/data/web/erpNew/pc.valsun.cn/"); } include WEB_PATH . "lib/common.php"; //加载全局配置信息 C(include WEB_PATH . 'conf/common.php'); include WEB_PATH . "lib/auth.php"; //鉴权 include WEB_PATH . "lib/authuser.class.php"; //新鉴权 //Auth::setAccess(include WEB_PATH.'conf/access.php'); include WEB_PATH . "lib/log.php"; //加载数据接口层及所需支撑 include WEB_PATH . "lib/service/http.php"; //网络接口 include WEB_PATH . "lib/functions.php"; include WEB_PATH . "lib/page.php"; include WEB_PATH . "lib/template.php"; //PHPLIB 的模板类 include WEB_PATH . "lib/cache/cache.php"; //memcache include WEB_PATH . "lib/PHPExcel.php"; //PHPExcel //include WEB_PATH."lib/rabbitmq/rabbitmq.class.php"; //加载语言包 //$lang = WEB_PATH."lang/".C("LANG").".php"; //memcache if (file_exists($lang)) { //echo $lang; //C(include $lang); } if (C("DATAGATE") == "db") { $db = C("DB_TYPE"); include WEB_PATH . "lib/db/" . $db . ".php"; //db直连 if ($db == "mysql") { global $dbConn; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); } if (DB_TYPE == "mongodb") { //....... } } //自动加载类 spl_autoload_register(array('Core', 'autoload')); }
function process_message($msg) { echo "\n############ 信息日志开始 ###############\n"; echo date('Y-m-d H:i:s') . "=====" . $msg->body; echo "\n############ 信息日志结束 ###############\n"; //执行SQL语句 $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], ''); $dbConn->select_db($db_config["master1"][4]); $sql = $msg->body; $query = $dbConn->query($sql); if (!$query) { Log::write($sql, Log::ERR); } else { echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n"; //确认消费OK $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']); } $dbConn->close(); // Send a message with the string "quit" to cancel the consumer. if ($msg->body === 'quit') { $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']); } }
private function __construct() { //-----------需要页面显示调试信息, 注释掉下面两行即可--- //------------------------------------------------------- //set_error_handler(array("Core",'appError')); //set_exception_handler(array("Core",'appException')); date_default_timezone_set("Asia/Shanghai"); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @set_magic_quotes_runtime(0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False); } if (!defined('WEB_PATH')) { define("WEB_PATH", "/data/web/purchase.valsun.cn/"); } include WEB_PATH . "lib/common.php"; //加载全局配置信息 C(include WEB_PATH . 'conf/common.php'); include WEB_PATH . "lib/authuser.class.php"; //新鉴权 include WEB_PATH . "lib/log.php"; include WEB_PATH . "lib/page.php"; //分页类 include WEB_PATH . "lib/rabbitmq/rabbitmq.class.php"; //消息队列 //加载数据接口层及所需支撑 include WEB_PATH . "lib/service/http.php"; //网络接口 include WEB_PATH . "lib/functions.php"; //公共方法 include WEB_PATH . "lib/opensys_functions.php"; //开放系统方法 include WEB_PATH . "lib/cache/cache.php"; //memcache include WEB_PATH . "lib/memcachemodel.class.php"; //memcache include WEB_PATH . "lib/class.curl.php"; //memcache if (C("DATAGATE") == "db") { $db = C("DB_TYPE"); include WEB_PATH . "lib/db/" . $db . ".php"; //db直连 if ($db == "mysql") { global $dbConn, $dbconn, $rmqObj; $db_config = C("DB_CONFIG"); $rmq_config = C("RMQ_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); $dbconn = $dbConn; $rmqObj = new RabbitMQClass($rmq_config['user'], $rmq_config['passwd'], $rmq_config['vhost'], $rmq_config['ip']); //队列对象 } if ($db == "mongodb") { //....... } } //自动加载类 spl_autoload_register(array('Core', 'autoload')); }
function reconnect() { global $dbConn; if (mysql_ping()) { return; } $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); }
private function __construct() { //-----------需要页面显示调试信息, 注释掉下面两行即可--- set_error_handler(array("Core", 'appError')); set_exception_handler(array("Core", 'appException')); date_default_timezone_set("Asia/Shanghai"); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @set_magic_quotes_runtime(0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False); } //设置根目录 if (!defined('WEB_PATH')) { define("WEB_PATH", "/data/web/notice.valsun.cn/"); } //加载通用检测方法 include_once WEB_PATH . "lib/common.php"; //加载全局配置信息 C(include_once WEB_PATH . 'conf/common.php'); include_once WEB_PATH . "lib/auth.php"; //鉴权 //Auth::setAccess(include WEB_PATH.'conf/access.php'); include_once WEB_PATH . "lib/log.php"; include_once WEB_PATH . "lib/page.php"; include_once WEB_PATH . "lib/authuser.class.php"; include_once WEB_PATH . "lib/opensys_functions.php"; //加载数据接口层及所需支撑 include_once WEB_PATH . "lib/service/http.php"; //网络接口 include_once WEB_PATH . "lib/functions.php"; include_once WEB_PATH . "lib/cache/cache.php"; //memcache if (C("DATAGATE") == "db") { $db = C("DB_TYPE"); include_once WEB_PATH . "lib/db/" . $db . ".php"; //db直连 if ($db == "mysql") { global $dbConn; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); $dbConn->query('set names utf8'); } if ($db == "mongodb") { //....... } } //自动加载类 spl_autoload_register(array('Core', 'autoload')); }
function step3($data) { if (!isset($_POST['host']) || !isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['database']) || !isset($_POST['adress'])) { return "Es trat ein Fehler bei der �rmittlung der Daten auf."; } $mysql = new mysql(array()); if (!@$mysql->connect($_POST['host'], $_POST['username'], $_POST['password'])) { return "Es konnte keine Verbindung zum Server hergestellt werden.<br />Überprüfe bitte deine Angaben auf ihre Richtigkeit.<br />" . mysql_error(); } if (!@$mysql->select_db($_POST['database'])) { return "Die gewünschte Datenbank konnte nicht ausgewählt werden.<br />Entweder existiert diese nicht oder der gewählte Benutzer hat keine Zugriffsrechte.<br />" . mysql_error(); } $_SESSION['install']['mysql']['host'] = $_POST['host']; $_SESSION['install']['mysql']['username'] = $_POST['username']; $_SESSION['install']['mysql']['password'] = $_POST['password']; $_SESSION['install']['mysql']['database'] = $_POST['database']; $_SESSION['install']['tic_adress'] = $_POST['adress']; $tables = array("gn4accounts", "gn4allianzen", "gn4cron", "gn4flottenbewegungen", "gn4forum", "gn4gnuser", "gn4incplanets", "gn4log", "gn4nachrichten", "gn4nachtwache", "gn4meta", "gn4scans", "gn4attflotten", "gn4attplanung", "gn4vars", "gn4channels"); $mysql->query("SHOW TABLE STATUS") or die($mysql->error(__FILE__, __LINE__)); $tableexits = array(); while ($row = $mysql->fetch()) { $tableexits[$row['Name']] = 1; } echo "<div style=\"border:1px #000000 solid;width:400px;padding:3px;\"><b>Schritt 3: Überprüfe Tabellen</b>\n <form action=\"\" method=\"post\"><input type=\"hidden\" name=\"step\" value=\"4\" \\>\n <table style=\"text-align:left;\" cellspacing=\"0\" cellpadding=\"0\">\n <tr style=\"font-weight:bold;\"><td>Tabellenname</td><td>Installieren</td></tr>"; $showwarning = 0; foreach ($tables as $table) { if ($tableexits[$table]) { $color = "#800000"; $showwarning = 1; $input = "<input type=\"checkbox\" name=\"check[]\" value=\"" . $table . "\" checked=\"checked\"/>"; } else { $color = "#008000"; $input = "<input type=\"checkbox\" checked=\"checked\" disabled = \"disabled\" /><input type=\"hidden\" name=\"check[]\" value=\"" . $table . "\" />"; } echo "<tr style=\"color:" . $color . "\"><td>{$table}</td><td style=\"text-align:center\">" . $input . "</td></tr>"; } if ($showwarning) { echo "</table><br /><div style=\"text-align:left\"><b>ACHTUNG:</b> Rot makierte Tabellen existieren bereits und werden, sofern die Installation fortgesetzt wird, inklusive ihrer Daten berschrieben.</div>"; } echo "<input type=\"submit\" value=\"Weiter\" /></form>\n </div>"; return ""; }
function openConn() { global $conn; $conn = new mysql(); $conna = @mysql_connect($GLOBALS['dbhost'], $GLOBALS['dbuser'], $GLOBALS['dbpwd']); if (!$conna) { header('Location:' . $GLOBALS['webDir'] . '/phpinc/startInstall.php'); //ֱ����ת��װҳ exit('<a href="' . $GLOBALS['webDir'] . '/phpinc/startInstall.php" target="_blank">���ӷ�����ʧ�ܣ��������1</a>'); } if (!mysql_select_db($GLOBALS['dbname'], $conna)) { header('Location:' . $GLOBALS['webDir'] . '/phpinc/startInstall.php'); //ֱ����ת��װҳ exit('<a href="' . $GLOBALS['webDir'] . '/phpinc/startInstall.php" target="_blank">�������ݿ�ʧ�ܣ��������2</a>'); } mysql_query("set names 'utf-8'"); //���ݿ�������� $conn->connect($GLOBALS['dbhost'], $GLOBALS['dbuser'], $GLOBALS['dbpwd']); $conn->select_db($GLOBALS['dbname']); //$conn->select_db("phpcmsv9"); return $conn; }
function openConn() { global $conn; $conn = new mysql(); $dbhost = 'localhost'; $dbuser = '******'; $dbpwd = '123456'; $dbname = 'phpwebdata'; $conna = @mysql_connect($dbhost, $dbuser, $dbpwd); if (!$conna) { exit('<a href="PHP2/ImageWaterMark/Include/startInstall.php" target="_blank">连接服务器失败,点击配置</a>'); } if (!mysql_select_db($dbname, $conna)) { exit('<a href="PHP2/ImageWaterMark/Include/startInstall.php" target="_blank">连接数据库失败,点击配置</a>'); } mysql_query("set names 'gb2312'"); //数据库输出编码 $conn->connect($dbhost, $dbuser, $dbpwd); $conn->select_db($dbname); //$conn->select_db("phpcmsv9"); return $conn; }
$queue_name = 'dev_rabbitmq_getwhstatus_queue'; //$connection = new AMQPConnection('192.168.128.129', 5672, 'peter', 'peter','mq_vhost1');//5672是端口号,两个peter分别是用户名和密码 $channel = $connection->channel(); //$channel->exchange_declare('power', 'topic', false, false, false); //第三个参数 true 会检测交换器是否存在 ,第4个参数 true 表示 服务器重启时,交换器依然不会消失,第5个参数false 表示 如果交换器删掉,消息通道依然生效 $channel->exchange_declare($exchange_name, 'fanout', false, false, false); //list($queue_name, ,) = $channel->queue_declare($queue_name, false, false, false, false); $channel->queue_bind($queue_name, $exchange_name); //echo ' [*] Waiting for logs. To exit press CTRL+C', "\n"; $callback = function ($msg) { $tableName = "om_unshipped_order"; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], ''); $dbConn->select_db($db_config["master1"][4]); //echo ' [x] ', json_decode($msg->body), "\n"; //var_dump($msg->body); echo "\n"; $data = json_decode($msg->body, true); //var_dump($data); echo "\n"; $orderid = $data['originOrderId']; $orderStatus = $data['orderStatus']; $operateUserId = $data['operateUserId']; $operateTime = $data['operateTime']; $actualWeight = $data['actualWeight']; $tracknumber = trim($data['tracknumber']); $orderids = CombinePackageModel::selectAllRecordByOrderId($orderid); var_dump($orderid . "-------" . $orderStatus); echo "\n"; if (C($orderStatus) == 2) { //已发货状态
<? include "class.mysql.php"; $sql = new mysql; $sql->connect ( ); $sql->select_db ( "register" ); $rResult = $sql->query ( "SELECT * FROM genre" ); if ( $sql->num_rows ( $rResult ) > 0 ) { while ( $genre = $sql->fetch_assoc ( $rResult ) ) { echo $genre['genre'] . "<br>\n"; } } echo "<br>SQL time: " . $sql->getSqlTime ( ); ?>
<? include "class.mysql.php"; $sql = new mysql; $sql->connect ( "mysql", "user", "password" ); // localhost is hoogstwaarschijnlijk al goed $sql->select_db ( "dev" ); // deze is hoogstwaarschijnlijk 'register' $sql->query("SET NAMES utf8");
private function __construct() { //-----------需要页面显示调试信息, 注释掉下面两行即可--- //------------------------------------------------------- set_error_handler(array("Core", 'appError')); set_exception_handler(array("Core", 'appException')); date_default_timezone_set("Asia/Shanghai"); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @set_magic_quotes_runtime(0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False); } if (!defined('WEB_PATH')) { define("WEB_PATH", "/data/web/erpNew/iqc.valsun.cn/"); //define("WEB_PATH","E:/xampp/htdocs/erpNew/iqc.valsun.cn/"); } include WEB_PATH . "lib/common.php"; //加载全局配置信息 C(include WEB_PATH . 'conf/common.php'); include WEB_PATH . "lib/auth.php"; //鉴权 Auth::setAccess(include WEB_PATH . 'conf/access.php'); include WEB_PATH . "lib/log.php"; //加载数据接口层及所需支撑 include WEB_PATH . "lib/service/http.php"; //网络接口 include WEB_PATH . "lib/functions.php"; include WEB_PATH . "lib/template.php"; //PHPLIB 的模板类 include WEB_PATH . "lib/page.php"; //分页类 include WEB_PATH . "lib/cache/cache.php"; //memcache include WEB_PATH . 'lib/smarty' . DIRECTORY_SEPARATOR . 'Smarty.class.php'; $smarty = new Smarty(); $smarty->template_dir = DIR_WS_TEMPLATES; $smarty->compile_dir = DIR_WS_TEMPLATES_C; $smarty->compile_check = true; $smarty->debugging = false; $smarty->left_delimiter = '{'; $smarty->right_delimiter = '}'; $smarty->assign("template_dir", DIR_WS_TEMPLATES); //加载语言包 $lang = WEB_PATH . "lang/" . C("LANG") . ".php"; //memcache if (file_exists($lang)) { //echo $lang; C(include $lang); } if (C("DATAGATE") == "db") { $db = C("DB_TYPE"); include WEB_PATH . "lib/db/" . $db . ".php"; //db直连 if ($db == "mysql") { global $dbConn; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); } if (DB_TYPE == "mongodb") { //....... } } //自动加载类 spl_autoload_register(array('Core', 'autoload')); }
private function __construct() { //-----------需要页面显示调试信息, 注释掉下面两行即可--- //------------------------------------------------------- //set_error_handler(array("Core",'appError')); //set_exception_handler(array("Core",'appException')); date_default_timezone_set("Asia/Shanghai"); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @set_magic_quotes_runtime(0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? True : False); } if (!defined('WEB_PATH')) { define("WEB_PATH", str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)) . DIRECTORY_SEPARATOR); } include WEB_PATH . "lib/common.php"; //加载全局配置信息 C(include WEB_PATH . 'conf/common.php'); C(include WEB_PATH . 'conf/default_var.php'); //订单状态码列表定义 include WEB_PATH . "lib/auth.php"; //鉴权 //include WEB_PATH."lib/authuser.class.php"; //新鉴权 include WEB_PATH . "lib/php-export-data.class.php"; //excel //Auth::setAccess(include WEB_PATH.'conf/access.php'); include WEB_PATH . "lib/log.php"; include WEB_PATH . "conf/constant_order.php"; //加载数据接口层及所需支撑 include WEB_PATH . "lib/service/http.php"; //网络接口 include WEB_PATH . "lib/functions.php"; include WEB_PATH . "lib/page.php"; include WEB_PATH . "lib/template.php"; //PHPLIB 的模板类 include WEB_PATH . "lib/cache/cache.php"; //memcache include WEB_PATH . "lib/productstatus.class.php"; //加载语言包 $lang = WEB_PATH . "lang/" . C("LANG") . ".php"; //memcache if (file_exists($lang)) { //echo $lang; //C(include $lang); } if (C("DATAGATE") == "db") { $db = C("DB_TYPE"); include WEB_PATH . "lib/db/" . $db . ".php"; //db直连 if ($db == "mysql") { global $dbConn; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2]); $dbConn->select_db($db_config["master1"][4]); } if ($db == "mongodb") { //....... } } //自动加载类 spl_autoload_register(array('Core', 'autoload')); }