/** * Конструктор */ public function __construct() { //Получаем имя драйвера $db = Boot::getInstance()->config->db; $driver = $db->adapter; $host = $db->host; $port = $db->port; $user = $db->user; $pass = $db->password; $dbase = $db->dbase; //Инитим драйвер $this->_db = new $driver($host, $port, $user, $pass, $dbase); //Подключаемся к базе $this->_db->connect(); }
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']); } }
public function chk_login() { global $db, $config, $enterprisemodel; $r['err'] = ''; $db2 = new mysql($config["db2"]); $db2->connect(); $query = "SELECT * FROM `{$config['db'][0]['dbname']}`.`{$config['default_prefix']}enterprise` e\r\n\t\t JOIN `{$config['db'][0]['dbname']}`.`{$config['default_prefix']}enterprise_profile` ep\r\n\t\t\t\t ON e.enterpriseid=ep.enterpriseid and e.switch='Y'\r\n\t\t WHERE e.prefixid = '{$config['default_prefix_id']}' \r\n\t\t\t AND e.loginname = '{$_POST['loginname']}' \r\n\t\t\t AND e.switch = 'Y' \r\n\t\t LIMIT 1\r\n\t\t"; error_log("[ajax/enterprise.chk_login]" . $query); $table = $db2->getQueryRecord($query); if (empty($table['table']['record'])) { //'账号不存在' $r['err'] = 3; } else { $_SESSION['sajamanagement']['enterprise'] = ''; $enterprise = $table['table']['record'][0]; $passwd = $this->str->strEncode($_POST['passwd'], $config['encode_key']); if ($enterprise['passwd'] === $passwd) { $_SESSION['sajamanagement']['enterprise'] = $enterprise; setcookie("enterpriseid", $enterprise['enterpriseid'], time() + 43200, "/", COOKIE_DOMAIN); $r['err'] = ''; } else { //'密码不正确' $r['err'] = 5; } } return $r; }
/** * Main constructor function, used to initialize the models, connect to the DB and * route the user to where they need to go. */ public function __construct() { global $config, $db, $tpl, $bid, $deposit, $faq, $history, $mall, $member, $product, $user, $scodeModel, $oscode, $googlemap, $channel, $enterprise; // Connect to the database. try { // 初始化資料庫連結介面 $db = new mysql($config["db"]); // 20141128 disabled by Thomas, 因為進入首頁時不須連線DB, 暫時先移除 $db->connect(); } catch (Exception $e) { die($e); } // Create new models. $tpl = new TemplateModel(); $bid = new BidModel(); $channel = new ChannelModel(); $deposit = new DepositModel(); $faq = new FaqModel(); $history = new HistoryModel(); $mall = new MallModel(); $member = new MemberModel(); $product = new ProductModel(); //var_dump($product); $user = new UserModel(); $scodeModel = new ScodeModel(); $googlemap = new GoogleMapModel(); $enterprise = new EnterpriseModel(); $oscode = new OscodeModel(); // Figure out which controller the user is requesting and perform the correct actions. $this->router(); }
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')); }
private function init_db() { if ($this->is_init) { return; } $db = new mysql($this->_config); $db->connect(); DB::init($db, $this->_config['db']['tablepre']); $this->is_init = true; }
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]); }
public static function f($connection) { list($host, $user, $pass, $db) = explode(':', $connection); if (empty(self::$instance_f[$connection])) { $i = new mysql(); $i->connect($host, $user, $pass, $db, true); self::$instance_f[$connection] = $i; return $i; } else { return self::$instance_f[$connection]; } }
public function saja() { $time_start = $this->time_start; global $db, $config, $router; // 初始化資料庫連結介面 $db = new mysql($config["db"]); $db->connect(); $router = $this->time_start; $this->userid = empty($_SESSION['auth_id']) ? '' : $_SESSION['auth_id']; $ret['status'] = 0; $ret['winner'] = ''; $ret['rank'] = ''; //讀取商品資料 $query = "SELECT p.*, unix_timestamp(p.offtime) as offtime, unix_timestamp() as `now`\r\n\t\tFROM `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product` p \r\n\t\tWHERE \r\n\t\t\tp.prefixid = '{$config['default_prefix_id']}'\r\n\t\t\tAND p.productid = '{$_POST['productid']}'\r\n\t\t\tAND p.switch = 'Y'\r\n\t\tLIMIT 1\r\n\t\t"; $table = $db->getQueryRecord($query); unset($table['table']['record'][0]['description']); $product = $table['table']['record'][0]; if ($product['offtime'] == 0 && $product['locked'] == 'Y' || $product['offtime'] > 0 && $product['now'] > $product['offtime']) { //回傳: 本商品已结标 $ret['status'] = 2; } /* elseif($this->chk_time_limit() ) { //回傳: 下标时间间隔过短,请稍后再下标 $ret['status'] = 3; }*/ if ($_POST['type'] == 'single') { //單次下標 $chk = $this->chk_single($product); if ($chk['err']) { $ret['status'] = $chk['err']; } } elseif ($_POST['type'] == 'range') { //連續下標 $chk = $this->chk_range($product); if ($chk['err']) { $ret['status'] = $chk['err']; } } if (empty($ret['status'])) { //產生下標歷史記錄 $mk = $this->mk_history($product); //回傳: 下标完成 $ret['status'] = $mk['err'] ? $mk['err'] : 200; $ret['winner'] = $mk['winner']; $ret['rank'] = $mk['rank']; } $time_end = microtime(true); $time = number_format($time_end - $time_start, 10); echo "下標 {$time} 秒<br>"; echo json_encode($ret); }
/** * Country Method : get_country */ public function get_country() { // global $db, $config; global $config; $db = new mysql($config["db2"]); $db->connect(); $query = "SELECT *\n\t\tFROM `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}country` \n\t\tWHERE\n\t\t\tprefixid = '{$config['default_prefix_id']}'\n\t\t\tAND switch = 'Y'\n\t\t\tORDER BY countryid\n\t\t"; $table = $db->getQueryRecord($query); if (!empty($table['table']['record'])) { return $table['table']['record']; } return false; }
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')); }
/** * @descrpition 检测微信ACCESS_TOKEN是否过期 * -10是预留的网络延迟时间 * @return bool */ private static function _checkJsapiTicket() { //获取access_token。是上面的获取方法获取到后存起来的。 $db = new mysql(); $db->connect(DBHOST, DBUSER, DBPASSWORD, DBNAME); $tempJsapiTicket = $db->fetch_first("select * from jsapiticket"); $JsapiTicket['value'] = $tempJsapiTicket['ticket']; if (!empty($JsapiTicket['value'])) { $JsapiTicket = json_decode($JsapiTicket['value'], true); if (time() - $JsapiTicket['time'] < $JsapiTicket['expires_in'] - 20) { return $JsapiTicket; } } return false; }
/** * @descrpition 检测微信ACCESS_TOKEN是否过期 * -10是预留的网络延迟时间 * @return bool */ private static function _checkAccessToken() { //获取access_token。是上面的获取方法获取到后存起来的。 $db = new mysql(); $db->connect(DBHOST, DBUSER, DBPASSWORD, DBNAME); $tempaccessToken = $db->fetch_first("select * from accesstoken"); $accessToken['value'] = $tempaccessToken['access_token']; if (!empty($accessToken['value'])) { $accessToken = json_decode($accessToken['value'], true); if (time() - $accessToken['time'] < $accessToken['expires_in'] - 10) { return $accessToken; } } return false; }
public function home() { global $db, $config, $router; // 初始化資料庫連結介面 $db = new mysql($config["db"]); $db->connect(); $router = new Router(); $this->userid = empty($_SESSION['auth_id']) ? '' : $_SESSION['auth_id']; $ret['status'] = 0; // Check Variable Start if (empty($_GET['pgpid'])) { $ret['status'] = 0; } elseif (empty($_POST['name'])) { //('收件人姓名错误!!'); $ret['status'] = 2; } elseif (empty($_POST['zip'])) { //('收件人邮编错误!!'); $ret['status'] = 3; } elseif (empty($_POST['address'])) { //('收件人地址错误!!'); $ret['status'] = 4; } else { $query = "SELECT p.*, unix_timestamp(offtime) as offtime, unix_timestamp() as `now`, pgp.pgpid, pgp.price, pgp.complete \r\n\t\t\tFROM `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}pay_get_product` pgp \r\n\t\t\tLEFT OUTER JOIN `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product` p ON \r\n\t\t\t\tpgp.prefixid = p.prefixid\r\n\t\t\t\tAND pgp.productid = p.productid\r\n\t\t\t\tAND p.switch = 'Y' \r\n\t\t\tWHERE \r\n\t\t\t\tpgp.`prefixid` = '{$config['default_prefix_id']}' \r\n\t\t\t\tAND pgp.pgpid = '{$_GET["pgpid"]}'\r\n\t\t\t\tAND pgp.userid = '{$this->userid}'\r\n\t\t\t\tAND pgp.switch = 'Y'\r\n\t\t\t"; $table = $db->getQueryRecord($query); //if (empty($table['table']['record'])) { $this->jsPrintMsg('商品不存在!', $location_url); } $product = $table['table']['record'][0]; $product['price'] = round($product['price'] * $config['sjb_rate'], 2); $product['real_process_fee'] = round($product['retail_price'] * $product['process_fee'] / 100 * $config['sjb_rate'], 2); $product['total'] = $product['real_process_fee'] + $product['price']; $query = "select sum(amount) as total_amount\r\n\t\t\tfrom `{$config['db'][1]['dbname']}`.`{$config['default_prefix']}spoint` \r\n\t\t\twhere\r\n\t\t\t\tuserid = '{$this->userid}'\r\n\t\t\t\tand switch = 'Y'\r\n\t\t\tGROUP BY userid\r\n\t\t\t"; $table = $db->getQueryRecord($query); if ($table['table']['record'][0]['total_amount'] < $product['total']) { //餘額不足 $ret['status'] = 6; } if ($product['complete'] == 'Y') { //'已结账' $ret['status'] = 5; } } if (empty($ret['status'])) { //產生訂單記錄 $mk = $this->mk_order($product); //回傳: 完成 $ret['status'] = $mk['err'] ? $mk['err'] : 200; } echo json_encode($ret); }
public function faq_detail($id) { // global $db, $config; global $config; $db = new mysql($config["db2"]); $db->connect(); $query = "SELECT f.*, fc.name cname\n\t\tFROM `{$config["db"][0]["dbname"]}`.`{$config['default_prefix']}faq` f \n\t\tLEFT OUTER JOIN `{$config["db"][0]["dbname"]}`.`{$config['default_prefix']}faq_category` fc ON \n\t\t\tf.prefixid = fc.prefixid \n\t\t\tAND f.fcid = fc.fcid \n\t\t\tAND fc.`switch`='Y' \n\t\tWHERE \n\t\t\tf.prefixid = '{$config["default_prefix_id"]}' \n\t\t\tAND f.faqid ='{$id}' \n\t\t\tAND f.switch = 'Y'\n\t\t"; $table = $db->getQueryRecord($query); if (!empty($table['table']['record'][0])) { //简介 $description = !empty($table['table']['record'][0]['description']) ? $table['table']['record'][0]['description'] : '空白'; $table['table']['record'][0]['description'] = html_decode($description); return $table['table']['record'][0]; } return false; }
public function home() { global $db, $config; // 初始化資料庫連結介面 $db = new mysql($config["db"]); $db->connect(); $this->str = new convertString(); $ret['status'] = 0; $ret['pid'] = 0; $chk1 = $this->chk_nickname(); $chk2 = $this->chk_phone(); $chk3 = $this->chk_passwd(); $chk4 = $this->chk_product(); if ($_POST['type'] == 'flash') { if (!empty($chk4['err'])) { $ret['status'] = $chk4['err']; } } if ($_POST['type'] != 'flash') { if (!empty($chk1['err'])) { $ret['status'] = $chk1['err']; } if (!empty($chk3['err'])) { $ret['status'] = $chk3['err']; } } if (!empty($chk2['err'])) { $ret['status'] = $chk2['err']; } if (!empty($_POST['sso_uid'])) { $ret['status'] = $this->chk_sso(); } if (empty($ret['status'])) { //建立会员账号 $this->mk_user(); $ret['sessid'] = session_id(); if ($_POST['type'] == 'flash') { $ret['pid'] = $_POST['productid']; } //回傳: 完成 $ret['status'] = 200; } error_log("[ajax/user_register] home return :" . json_encode($ret)); echo json_encode($ret); }
public function home() { global $db, $config; // 初始化資料庫連結介面 $db = new mysql($config["db"]); $db->connect(); $ret['status'] = 0; $_SESSION['user'] = ''; $_SESSION['auth_id'] = ''; $_SESSION['auth_secret'] = ''; $_SESSION['auth_email'] = ''; setcookie("auth_id", "", time() - 3600, "/", COOKIE_DOMAIN); setcookie("auth_email", "", time() - 3600, "/", COOKIE_DOMAIN); setcookie("auth_secret", "", time() - 3600, "/", COOKIE_DOMAIN); //回傳: $ret['status'] = 200; echo json_encode($ret); }
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 languageDropdown($name, $selected = "", $attributes = "") { $lang = new lang(); $config = new KConfig(); if ($selected == "") { $selected = $config->language; } $qry = "SELECT * FROM `" . $config->dbprefix . "g_lang`"; mysql::connect(); $result = mysql_query($qry); $return = "<select size='1' name='" . $name . "' " . $attributes . ">"; while ($row = mysql_fetch_assoc($result)) { if ($row['code'] == $selected) { $return .= "<option selected='selected' value='" . $row['code'] . "'>" . $row['language'] . "</option>"; } else { $return .= "<option value='" . $row['code'] . "'>" . $row['language'] . "</option>"; } } $return .= "</select>"; return $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 getEnterprise($enterpriseid) { global $config; $ret = array(); $ret['code'] = 1; if ($enterpriseid == '') { $ret['code'] = -1; $ret['msg'] = '登入失败 : id缺误 !!'; } $query = "SELECT * FROM `saja_user`.`saja_enterprise` \r\n\t\t\tWHERE \r\n\t\t\tprefixid = 'saja' \r\n\t\t\tAND enterpriseid = '" . $enterpriseid . "' \r\n\t\t\tAND switch = 'Y' \r\n\t\t\t"; error_log($query); $model = new mysql($config["db"][0]); $model->connect(); $table = $model->getQueryRecord($query); if (empty($table['table']['record'])) { $ret['code'] = -2; $ret['msg'] = '登入失败 : 账戶不存在!!'; } $ret['code'] = 1; $ret['msg'] = $table['table']['record'][0]; return $ret; }
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; }
function set_login($user) { global $config; $_SESSION['user'] = ''; $_SESSION['auth_id'] = ''; $_SESSION['auth_email'] = ''; $_SESSION['auth_secret'] = ''; $query = "SELECT *\r\n\t\tFROM `{$config['db'][0]['dbname']}`.`{$config['default_prefix']}user_profile`\r\n\t\tWHERE `prefixid` = '{$config['default_prefix_id']}' \r\n\t\t\tAND `userid` = '{$user['userid']}'\r\n\t\t\tAND `switch` = 'Y'\r\n\t\t"; // error_log("[set_login]Query User : "******"db"][0]); $db->connect(); $table = $db->getQueryRecord($query); $user['profile'] = $table['table']['record'][0]; $_SESSION['user'] = $user; // Set session and cookie information. $_SESSION['auth_id'] = $user['userid']; $_SESSION['auth_email'] = ''; $_SESSION['auth_secret'] = md5($user['userid'] . $user['name']); setcookie("auth_id", $user['userid'], time() + 60 * 60 * 24 * 30, "/", COOKIE_DOMAIN); setcookie("auth_email", '', time() + 60 * 60 * 24 * 30, "/", COOKIE_DOMAIN); setcookie("auth_secret", md5($user['userid'] . $user['name']), time() + 60 * 60 * 24 * 30, "/", COOKIE_DOMAIN); }
public function act_osc() { global $db, $config; // 初始化資料庫連結介面 $db = new mysql($config["db"]); $db->connect(); $oscModel = new OscodeModel(); $this->str = new convertString(); $ret['status'] = 0; if (empty($_POST['scsn']) || empty($_POST['scpw'])) { //S码序号、S码密码不能空白 $ret['status'] = 2; } else { $query = "SELECT * \r\n\t\t\tFROM `{$config['db'][1]['dbname']}`.`{$config['default_prefix']}oscode` \r\n\t\t\tWHERE \r\n\t\t\t\tprefixid = '{$config['default_prefix_id']}' \r\n\t\t\t\tAND serial = '{$_POST['scsn']}' \r\n\t\t\t\tAND switch = 'Y' \r\n\t\t\t"; $table = $db->getQueryRecord($query); $scode_item = isset($table['table']['record'][0]) ? $table['table']['record'][0] : ''; if (empty($scode_item)) { //'不存在' $ret['status'] = 3; } elseif ($_POST['scpw'] !== $scode_item['pwd']) { //'密码错误' $ret['status'] = 4; } elseif ($scode_item['verified'] == 'Y') { //已激活 $ret['status'] = 5; } } if (empty($ret['status'])) { //限定S码激活 $query = "UPDATE `{$config['db'][1]['dbname']}`.`{$config['default_prefix']}oscode` \r\n\t\t\tSET `verified`='Y', userid='{$_SESSION['auth_id']}'\r\n\t\t\tWHERE \r\n\t\t\t\t`prefixid` = '{$config['default_prefix_id']}'\r\n\t\t\t\tAND serial = '{$_POST['scsn']}'\r\n\t\t\t"; $db->query($query); $query = "UPDATE `{$config['db'][1]['dbname']}`.`{$config['default_prefix']}scode_promote`\r\n\t\t\tSET\r\n\t\t\t `scode_sum`=`scode_sum` + 1,\r\n\t\t\t `amount`=`amount` + 1\r\n\t\t\tWHERE \r\n\t\t\t\t`prefixid` = '{$config['default_prefix_id']}' \r\n\t\t\t\tAND spid = '{$scode_item['spid']}' \r\n\t\t\t"; $db->query($query); //回傳: $ret['status'] = 200; } echo json_encode($ret); }
require classes . 'session.php'; require classes . 'template.php'; // start permanent session $session = new session(); if (!$session->started()) { $session->cronCheck = 0; $session->language = 'en'; $session->theme = 'light'; $session->lastpage = '/'; $session->admin = false; $session->translate = true; router::refresh(); } // connect to localhost:3306/root mysql::$models = root . 'models/'; mysql::connect('adm78', 'csodb'); // check cron but block spam if ($debug || $session->cronCheck < time() - 3) { cron::$crondir = root . 'cron/'; cron::$maxRuns = 16; cron::checkAll(); $session->cronCheck = time(); } // url routing router::$views = root . 'views/'; router::$index = 'index'; router::$error = '404'; $uri = $_SERVER['REQUEST_URI']; $page = router::path($uri); // auto-html template $tpl = new template();
$exchange_name = 'wh_status_exchange'; $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) {
<?php include './libs/model/db.class.php'; $db = new mysql(array("hostname" => '127.0.0.1', 'username' => 'root', 'password' => 'root', 'database' => 'blog')); $db->connect(); /*$flag = $db->excute("insert into blog_channel(ctitle,isshow) values ('1222','0')"); echo $flag; */ /*$result = $db->query("select * from blog_channel"); var_dump($result);*/ /*$result = $db->getTables('blog'); var_dump($result);*/ $flag = $db->replace(array('cid' => 2, 'ctitle' => 'kj'), array('table' => 'blog_channel')); echo $flag;
// and doesn't distinguish between _GET and _POST, so we have to do it here. fun $id = filter_int($_POST['id']); if ($id === null) { $id = filter_int($_GET['id']); } if ($id === null) { $id = 0; } // Wait for the midnight backup to finish... if ((int) date("Gi") < 5) { require "lib/downtime.php"; } require 'lib/config.php'; require 'lib/mysql.php'; $sql = new mysql(); $sql->connect($sqlhost, $sqluser, $sqlpass) or die("<title>Damn</title>\n\t\t\t<body style=\"background: #000 url('images/bombbg.png'); color: #f00;\">\n\t\t\t\t<font style=\"font-family: Verdana, sans-serif;\">\n\t\t\t\t<center>\n\t\t\t\t<img src=\"http://xkeeper.shacknet.nu:5/docs/temp/mysqlbucket.png\" title=\"bought the farm, too\">\n\t\t\t\t<br><br><font style=\"color: #f88; size: 175%;\"><b>The MySQL server has exploded.</b></font>\n\t\t\t\t<br>\n\t\t\t\t<br><font style=\"color: #f55;\">Error: " . mysql_error() . "</font>\n\t\t\t\t<br>\n\t\t\t\t<br><small>This is not a hack attempt; it is a server problem.</small>\n\t\t\t"); $sql->selectdb($dbname) or die("Another stupid MySQL error happened, panic<br><small>" . mysql_error() . "</small>"); if (file_exists("lib/firewall.php") && !filter_bool($disable_firewall)) { require 'lib/firewall.php'; } else { // Bad Design Decisions 2001. // :( if (!get_magic_quotes_gpc()) { $_GET = addslashes_array($_GET); $_POST = addslashes_array($_POST); $_COOKIE = addslashes_array($_COOKIE); } if (!ini_get('register_globals')) { $supers = array('_ENV', '_SERVER', '_GET', '_POST', '_COOKIE'); foreach ($supers as $__s) { if (is_array(${$__s})) {
<?php // a_authordetails.php -- Admin view Author Details include './functions.php'; require_once './config/auth.php'; require './config/config.php'; include "./classes/mysql.class.php"; $mysqldb = new mysql(); $mysqldb->connect(); $mysqldb->select(); $authorid = mifi($_REQUEST[aid]); $mysqldb->query("SELECT CONCAT(FirstName, ' ', LastName) AS name, Approved, UserName, Email, DATE_FORMAT(RegistrationDate, '%M %d, %Y') AS dr, (SELECT count(*) from articles WHERE Approved = 'N' AND AuthorID='{$authorid}') AS PendingArticles, (SELECT count(*) from articles WHERE Approved = 'Y' AND AuthorID='{$authorid}') AS ApprovedArticles, (SELECT count(*) from articles WHERE Approved = 'S' AND AuthorID='{$authorid}') AS SavedArticles FROM authors WHERE AuthorID='{$authorid}'"); $row = $mysqldb->fetchObject(); $totalarticles = $row->ApprovedArticles + $row->PendingArticles + $row->SavedArticles; if (isset($_REQUEST['newperms'])) { $title = 'Permissions Updated'; } else { $title = 'Author details for ' . $row->name . ' (' . $row->UserName . ')'; } $approved = $row->Approved; if ($approved != 'Y') { $approved = "<a href=\"aufe2a.php?aid={$authorid}\">{$row->Approved}</a>"; } head_page($title); menu_options($title, $vnum, $viewop, $pid, $keys, $adfl); contentinit($title); echo <<<_AUTHORDETAILS AuthorID : {$authorid}<br /> UserName : {$row->UserName}<br /> Full Name : {$row->name}<br /> Permissions : {$row->Approved}<br>