public function bindPhoneCode($param = null) { if (isset($param)) { $post_data = $param; $exit_type = 'array'; } else { $post_data = I('post.'); $exit_type = 'json'; } wlog('/share/weixinLog/artisans/58_phone.log', $post_data['phone']); $access_token = $post_data['access_token']; $this->_checkToken($access_token); if (!$this->_access_token) { return $this->returnJsonData($exit_type, 10002); //没有权限 } $phone = $post_data['phone']; if (empty($phone)) { return $this->returnJsonData($exit_type, 300); } if (!check_phone($phone)) { return $this->returnJsonData($exit_type, 10003); //手机号格式有误 } $now_time = date('Y-m-d H:i:s'); $rand_code = mt_rand('100000', '999999'); $data['CouponsId'] = 1; $data['Phone'] = $phone; $data['CodeNum'] = $rand_code; $data['Source'] = 1; $data['IsUse'] = 0; $data['CreateTime'] = $now_time; $where = array('Source' => 1, 'Phone' => $phone); }
public function GetResponse() { wlog(get_class($this), "I Requests sent. Reading responses..."); $reply = ""; // MAIN PROGRAM LOOP while ($reply .= $this->oApi->readRequestBinary()) { // append to data left from previous request // if the last character isn't the EOT character, then this contains a part response //print "."; if ($reply[strlen($reply) - 1] != chr(10)) { $nlpos = strrpos($reply, chr(10)); if ($nlpos !== false) { // has a full response plus a part response // process the full response sub string $aResponses = explode(chr(10), trim(substr($reply, 0, $nlpos + 1))); $reply = substr($reply, $nlpos + 1); // keep the part response } // else it is only part of another response so leave $reply set } else { // is simply a full response, so process it $aResponses = explode(chr(10), trim($reply)); $reply = ""; } // now parse each message one at a time foreach ($aResponses as $response) { $rid = substr($response, 0, strpos($response, chr(31))); $response = substr($response, strpos($response, chr(31)) + 1); $this->ParseResponse($rid, $response); } } // while }
/** * 数据列表 */ public function lists() { if (IS_POST) { $username = PUT('username'); $map = array(); $map['username'] = array('like', "%{$username}%"); $map['b.realname'] = array('like', "%{$username}%"); $map['b.nickname'] = array('like', "%{$username}%"); $map['b.id_number'] = array('like', "%{$username}%"); $map['b.company'] = array('like', "%{$username}%"); $map['_logic'] = 'or'; $size = PUT('size', 10); $page = PUT('p'); $count = $this->model->alias('a')->join('__USER_INFO__ b on a.id=b.user_id', 'LEFT')->where($map)->where($map)->count(); $items = $this->model->alias('a')->join('__USER_INFO__ b on a.id=b.user_id', 'LEFT')->field('a.id,username,login_count,last_login_time,register_time,updated,status,portrait,realname,nickname,cat_id,name_cert,sex,age,birthday,id_number,email,company,work_status,alternative_phone')->where($map)->page($page, $size)->order('id desc')->select(); $result['status'] = true; $result['count'] = $count; $result['size'] = $size; $result['page'] = $page; $result['items'] = $items; wlog('user', $result); $this->ajaxReturn($result); } else { $this->display(); } }
/** * 跳转 */ public function jump() { $p = I('p'); $url = U('Log/jump', '', false); wlog('url', $url); $this->redirect($url, array('p' => $p)); }
public function DecodeResponse(&$sMessage) { $aMessage = explode(chr(31), $sMessage); $key = "fid_exchange_id"; for ($i = 0; $i < count($aMessage); $i++) { switch ($this->aFieldTypes[$aMessage[$i]]) { case $key: case "fid_exchange_symbol": case "fid_exchange_country": case "fid_text": $aFields[$this->aFieldTypes[$aMessage[$i]]] = $aMessage[++$i]; break; default: $i++; break; } } // check that key exists if (array_key_exists($key, $aFields)) { // It exists $this->aaExchanges[$aFields[$key]] = $aFields; } else { // THIS SHOULD NEVER HAPPEN! wlog(get_class($this), "W Exchange message failed to decode. Response was: " . $sMessage); } }
/** * 执行mysql query()操作 * @param string $sql * @return mixed */ public function query($sql) { // 是否记录 SQL log if (true == C('sql_log')) { wlog('SQL-Log', $sql); } $error_msg = ''; $_key = strtolower(substr($sql, 0, 6)); if ($_key == 'select') { $rs = sqlite_query($this->db, $sql, SQLITE_BOTH, $error_msg); } else { $rs = sqlite_exec($this->db, $sql, $error_msg); } if (!empty($rs)) { $GLOBALS['run_dbquery_count']++; return $rs; } else { if (C('show_errors')) { show_error('执行sqlite_query()出现错误: ' . $error_msg . '<br />原SQL: ' . $sql); } else { exit('db_sqlite2::query() error.'); } } //return false; }
function connect($name, $db_type, $params) { global $g_db; //try to connect one of connection parameter that works.. $exceptions = array(); foreach ($params as $param) { try { $db = Zend_Db::factory($db_type, $param); $db->setFetchMode(Zend_Db::FETCH_OBJ); $db->getConnection(); //profile db via firebug if (config()->debug) { $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); $profiler->setEnabled(true); $db->setProfiler($profiler); } //slog("success $name"); $g_db[$name] = $db; return; } catch (Zend_Db_Adapter_Exception $e) { // perhaps a failed login credential, or perhaps the RDBMS is not running wlog("Couldn't connect to {$name} (trying another connection - if available):: " . $e->getMessage()); $exceptions[] = $e; } catch (Zend_Exception $e) { // perhaps factory() failed to load the specified Adapter class wlog("Couldn't connect to {$name} (trying another connection - if available):: " . $e->getMessage()); $exceptions[] = $e; } } $msg = ""; foreach ($exceptions as $e) { $msg .= $e->getMessage() . "\n"; } throw new Exception("Failed to connect to {$name}"); }
protected function after_select(&$items) { foreach ($items as &$value) { $msg_id = $value['id']; $map['status'] = array('in', '1,3,5,7,9,11,13,15'); if ($value['msg_cat'] == 0) { $total = M('User')->where($map)->count(); } else { $map['cat_id'] = $value['msg_cat']; $total = M('UserInfo')->where($map)->count(); } $where['status'] = 1; $where['msg_id'] = $msg_id; $read = M('Msg_read')->where($where)->select(); $read_count = 0; if ($read) { foreach ($read as $v) { unset($map); $map = array(); $map['user_id'] = $v['user_id']; $map['cat_id'] = $value['msg_cat']; $res = M('UserInfo')->where($map)->find(); if ($res) { ++$read_count; wlog('count', $read_count); } } } $value['read'] = $read_count; $value['unread'] = $total - $read_count; if ($value['unread'] == 0) { $value['disable'] = true; } } }
public function comWlog($log_data = array(), $log_url = '') { if (empty($log_url)) { $log_url = C('WWW_LOG_URL') . ACTION_NAME . date(Ymd) . '.log'; } $this->log_url = $log_url; $this->log_dat = $log_data; if ($this->log_status) { wlog($this->log_url, $this->log_data); } }
/** * 获取用户中心token * @access public * @param string $url * @return mixed */ public function getUserCenterToken($url) { if (!$url) { return false; } $post_data = json_encode(array('realm' => 'XXX')); $receive = send_curl($url, $post_data); $parse_data = json_decode($receive, true); if (is_array($parse_data['data']) && $parse_data['data']['access_token']) { $token = $parse_data['data']['access_token']; } else { wlog('/share/weixinLog/artisans/user_center_api/user_center_token' . date('Ymd') . '.log', $parse_data); } return $token; }
/** * 连接数据库 * @access protected * @param string $db_config_name 使用那个数据库连接 */ protected function conn($db_config_name = '') { $db_config_name = $db_config_name ? $db_config_name : $this->db_config_name; if (!isset(self::$_db_handle[$db_config_name])) { if (true == C('sql_log')) { wlog('SQL-Log', '#' . $db_config_name); } $dbdriver = 'db_' . C('dbdriver'); include_once FW_PATH . '/dbdrivers/' . $dbdriver . '.class.php'; self::$_db_handle[$db_config_name] = $this->db = new $dbdriver($db_config_name); } else { $this->db = self::$_db_handle[$db_config_name]; } return $this->db; }
public function __toString() { if (C('exception_log')) { $str = "\n异常信息:{$this->getMessage()}\n错误文件:{$this->getFile()}\n错误行数:{$this->getLine()}\n异常代码:{$this->getCode()}\n------------------------------"; wlog('ExceptionLog', $str); } //ob_start(); $tpl = C('tpl_exception'); if (!$tpl) { include FW_PATH . '/tpl/ephpException.tpl.php'; } else { include APP_PATH . '/views/public/' . $tpl; } //return ob_get_clean(); return ''; }
function __construct(array &$settings) { $this->aaSettings = $settings; wLog(get_class($this), " \n--- Loading ---"); // Check DB Clear settings if (!isset($this->aaSettings["DB"]["HOST"], $this->aaSettings["DB"]["USERNAME"], $this->aaSettings["DB"]["PASSWORD"])) { wlog(get_class($this), "E Arggghhhh DB settings not found in INI file!!! Blowing up ungracefully..."); exit; } $this->oDatabase = new CDbMssql($this->aaSettings["DB"]["HOST"], $this->aaSettings["DB"]["USERNAME"], $this->aaSettings["DB"]["PASSWORD"]); // Check TRADE (P&L) settings if (!isset($this->aaSettings["RTDHOST"]["IP"], $this->aaSettings["RTDHOST"]["PORT"])) { wlog(get_class($this), "E Arggghhhh RTDHOST settings not found in INI file!!! Blowing up ungracefully..."); exit; } $this->oApi = new CSocketStream($this->aaSettings["RTDHOST"]["IP"], $this->aaSettings["RTDHOST"]["PORT"]); }
/** * MYSQL query * @param string $sql * @return mixed */ function query($sql) { #是否记录 SQL log if (true == C('sql_log')) { wlog('SQL-Log', $sql); } if (true == ($rs = $this->db->query($sql))) { $GLOBALS['run_dbquery_count']++; return $rs; } else { if (C('show_errors')) { throw new ephpException('执行mysqli::query()出现错误: ' . $this->db->error . '<br />原SQL: ' . $sql, 2045); } else { exit('db_mysqli::query() error.'); } } }
public function select_redbag() { if (I("code")) { $code = I("code"); $shop = D("WeiXinApi"); $userinfo = $shop->getOAuthAccessToken($code); $openid = $userinfo["openid"]; if (!$openid) { wlog('/share/weixinLog/artisans/user_center_api/no_find_openid.log', $userinfo); //auth验证没有获取到openid } } else { $openid = $this->reGetOAuthDebug(U('Redbag/' . ACTION_NAME)); } $info = M('ord_submit_info')->where("UserOpenid='%s'", $openid)->order('InfoId desc')->find(); $pro_id = $info['ProductId']; //用户卡券 $transfer_data['city_id'] = $this->_city_id; $transfer_data['pro_id'] = $pro_id; $transfer_data['uid'] = $uid; $user_card_info = send_curl($this->_user_coupons_url, $transfer_data); $parse_data = json_decode($user_card_info, true); if ($parse_data['code'] == 200 && $parse_data['code']['data']) { $data = $parse_data['code']['data']; } else { $data = array(); } //卡券列表 $cardid = $this->_card[$pro_id]; $num = count($cardid); $cardinfo = array(); for ($i = 0; $i < $num; $i++) { $cardinfo = $this->getcard_info($cardid[$i], $openid); } $card_num = count($cardinfo); if ($card_num > 0) { $this->assign('status', 200); } else { $this->assing('status', 500); } $this->assign('list', array($cardinfo)); //跳转链接 $jump_url = U('Craft/selectCard') . '?haoren=1'; $this->assign('jump_url', $jump_url); $this->display(T('Craft/qcs_card')); }
public function indexAction() { $q = $this->clean($_REQUEST["q"]); $this->view->query = $q; $recs = array(); if (isset($_REQUEST["type"])) { $type = $_REQUEST["type"]; } else { $type = "all"; } if (isset($_REQUEST["q"]) && $q != "") { $recs = $this->dosearch($type, 999, $q, false); if (count($recs) == 0) { wlog("No search results for query: {$q}"); } $this->view->recs = $recs; } }
/** * 执行mysql query()操作 * @param string $sql * @return object */ public function query($sql) { // 是否记录 SQL log if (true == C('sql_log')) { wlog('SQL-Log', $sql); } if (true == ($rs = mysql_query($sql, $this->db))) { $GLOBALS['run_dbquery_count']++; return $rs; } else { if (C('show_errors')) { throw new ephpException('执行mysql::query()出现错误: ' . mysql_error($this->db) . '<br />原SQL: ' . $sql, 2045); } else { exit('db_mysql::query() error.'); } } //return false; }
/** * 上传文件 */ public function upload($time, $md5, $path, $data, $range, $size, $chunk, $chunks) { wlog("上传文件", $path . ' ' . json_encode($range) . ' ' . $size); if ($this->md5($time, $md5)) { if ($data) { $paths = dirname($path); if (!is_dir($paths)) { mkdirs($paths); } // $fp = fopen($path,"wb"); // fseek($fp,$range[0]); // fwrite($fp,$data,$range[1] - $range[0]); // fclose($fp); } return true; } else { return false; } }
/** * 管理员登陆 */ public function login() { if (IS_POST) { $username = PUT('username'); $password = PUT('password'); $verify = PUT('verify'); $result = array(); // if(!check_verify($verify)){ // $this->error('验证码输入错误!'); // }else $err = Auth::login($username, $password); // wlog('err', $err); if ($err < 5) { switch ($err) { case 1: $this->error('用户不存在'); break; case 2: $this->error('用户已禁用'); break; case 3: $this->error('角色已禁用'); break; case 4: $this->error('密码错误'); break; } } else { $user = $_SESSION['user_auth']; action_log('user_login', 'Admin', $user['id'], $user['id']); wlog('PUT', PUT()); $this->success('登陆成功!', U('index')); // $this->redirect('Index/index','','','登陆成功!'); } } else { layout('Common/layout'); $this->display(); } }
/** * 执行mysql query()操作 * @param String $sql * @return mixed */ public function query($sql) { // 是否记录 SQL log if (true == C('sql_log')) { wlog('SQL-Log', $sql); } $_key = strtolower(substr($sql, 0, 6)); if ($_key == 'select') { $qt = 'query'; } else { $qt = 'exec'; } if (true == ($rs = $this->db->{$qt}($sql))) { $GLOBALS['run_dbquery_count']++; return $rs; } else { if (C('show_errors')) { show_error('执行sqlite_query()出现错误: ' . $this->db->lastErrorMsg() . '<br />原SQL: ' . $sql); } else { exit('db_sqlite3::query() error.'); } } //return false; }
if (empty($check_user)) { echo '<h1>错误:用户【' . $fileinfo['linkusername'] . '】未添加进数据库!</h1>'; } elseif (count($fileinfo['file_list']['list']) > 1) { echo '<h1>错误:该分享有多个文件。当前暂未支持多文件补档……</h1>'; } else { if ($check_user['newmd5'] == '') { echo '<font color="red"><b>因为没有设置MD5,无法启用换MD5补档模式。</b>请在“浏览文件”模式添加一个小文件(几字节即可),并在添加时输入提取码为“md5”。</font><br />'; } $check_file = $mysql->query("select * from watchlist where fid='{$fileinfo['file_list']['list'][0]['fs_id']}'")->fetch(); if (!empty($check_file)) { echo '<h1>错误:此文件已添加过,地址是:<a href="' . $jumper . $check_file[0] . '" target="_blank">' . $jumper . $check_file[0] . '</a></h1>'; } else { $mysql->prepare('insert into watchlist values(null,?,?,?,0,?,?,0)')->execute(array($fileinfo['file_list']['list'][0]['fs_id'], $fileinfo['file_list']['list'][0]['path'], $_POST['link'], $_POST['code'], $check_user['ID'])); $id = $mysql->lastInsertId(); //这里因为没读block_list需要的相关内容,暂时先不写入block_list,第一次访问会自动写入 wlog('添加链接记录:用户名:' . $fileinfo['linkusername'] . ',文件完整路径:' . $fileinfo['file_list']['list'][0]['path'] . ',文件fs_id:' . $fileinfo['file_list']['list'][0]['fs_id'] . ',文件访问地址为:' . $jumper . $id); echo '<h1>添加成功!<br />用户名:' . $fileinfo['linkusername'] . '<br />文件完整路径:' . $fileinfo['file_list']['list'][0]['path'] . '<br />文件fs_id:' . $fileinfo['file_list']['list'][0]['fs_id'] . '<br />文件访问地址为:<a href="' . $jumper . $id . '" target="_blank">' . $jumper . $id . '</a></h1>'; } } } } } } } ?> <h1>添加要补档的文件</h1> <form method="post" action="addlink.php"> 请输入分享链接,分享必须由已添加的用户创建:<input type="text" name="link" /><br /> 要添加用户,请在主页中选择“浏览文件”,在出现的“选择用户”页面中添加。<br /> 请输入提取码,公开分享不用输入:<input type="text" name="code" /><br /> 现在换MD5补档模式为全局启用状态,所有文件强制换MD5补档。请不要添加txt等在结尾连接内容后影响使用的格式!<br />
/** * TODO Bootstrap分页 * 可以通过url参数传递where条件,例如: index.html?name=asdfasdfasdfddds * 可以通过url空值排序字段和方式,例如: index.html?_field=id&_order=asc * 可以通过url参数r指定每页数据条数,例如: index.html?r=5 * * @param sting|Model $model 模型名或模型实例 * @param array $where where查询条件(优先级: $where>$_REQUEST>模型设定) * @param array|string $order 排序条件,传入null时使用sql默认排序或模型属性(优先级最高); * 请求参数中如果指定了_order和_field则据此排序(优先级第二); * 否则使用$order参数(如果$order参数,且模型也没有设定过order,则取主键降序); * * @param array $base 基本的查询条件 * @param boolean $field 单表模型用不到该参数,要用在多表join时为field()方法指定参数 * @return array|false 返回数据集 */ protected function pagination($model, $where = array(), $order = '', $base = array('status' => array('egt', 0)), $field = true) { $options = array(); $REQUEST = (array) PUT('request.'); wlog('request', $REQUEST); if (is_string($model)) { $model = M($model); } $OPT = new \ReflectionProperty($model, 'options'); $OPT->setAccessible(true); $pk = $model->getPk(); if ($order === null) { //order置空 } else { if (isset($REQUEST['_order']) && isset($REQUEST['_field']) && in_array(strtolower($REQUEST['_order']), array('desc', 'asc'))) { $options['order'] = '`' . $REQUEST['_field'] . '` ' . $REQUEST['_order']; } elseif ($order === '' && empty($options['order']) && !empty($pk)) { $options['order'] = $pk . ' desc'; } elseif ($order) { $options['order'] = $order; } } unset($REQUEST['_order'], $REQUEST['_field']); $options['where'] = array_filter(array_merge((array) $base, (array) $where), function ($val) { if ($val === '' || $val === null) { return false; } else { return true; } }); if (empty($options['where'])) { unset($options['where']); } $options = array_merge((array) $OPT->getValue($model), $options); $total = $model->where($options['where'])->count(); if (isset($REQUEST['r'])) { $listRows = (int) $REQUEST['r']; } else { $listRows = C('LIST_ROWS') > 0 ? C('LIST_ROWS') : 10; } $page = new \Think\Page($total, $listRows, $REQUEST); if ($total > $listRows) { $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'); } $p = $page->show(); $this->assign('_page', $p ? $p : ''); $this->assign('_total', $total); $options['limit'] = $page->firstRow . ',' . $page->listRows; $model->setProperty('options', $options); return $model->field($field)->select(); }
function getListMailbox() { try { $userAccounts = array(); $regexpUsuario = '/^[a-z0-9]+([\\._\\-]?[a-z0-9]+[_\\-]?)*@[a-z0-9]+([\\._\\-]?[a-z0-9]+)*(\\.[a-z0-9]{2,6})+$/'; $arrDBConn = parseDSN(generarDSNSistema("asteriskuser", "elxpbx")); $conn = new PDO($arrDBConn["dsn"], $arrDBConn["user"], $arrDBConn["passwd"]); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sqlEmailInfo = <<<EMAIL_INFO SELECT username FROM acl_user EMAIL_INFO; foreach ($conn->query($sqlEmailInfo) as $row) { if (preg_match($regexpUsuario, $row['username'])) { $userAccounts[] = $row['username']; } } return $userAccounts; } catch (PDOException $e) { wlog("ERR: failed to read account information - " . $e->getMessage() . "\n"); return false; } }
$mysql = new PDO("mysql:host={$host};dbname={$db}", $user, $pass); $mysql->query('set names utf8'); if (isset($_POST['delete'])) { $data = $mysql->query('select * from watchlist where id=' . $_POST['delete'])->fetch(); if (empty($data)) { echo '{"ret":"找不到要删除的记录!"}'; die; } $mysql->query('delete from watchlist where id=' . $_POST['delete']); $mysql->query('delete from block_list where id=' . $_POST['delete']); wlog('删除记录:' . $_POST['delete'], 1); echo '{"ret":"删除成功!"}'; die; } print_header('一键补档管理后台'); wlog('访问主页'); ?> <script> function dlt(id) { if(confirm('确认要删除这条记录吗?')) { var xmlHttp=new XMLHttpRequest(); xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4){ var ret; try{ ret=JSON.parse(xmlHttp.responseText); } catch(e) { alert('后台返回错误,请重试'); } if(ret!==false) { alert(ret.ret);
function getDownloadLink($file, $token, $cookie) { global $ua, $mysql; $ret = request("http://pcs.baidu.com/rest/2.0/pcs/file?method=locatedownload&bdstoken={$token}&app_id=250528&path=" . urlencode($file), $ua, $cookie); $ret = json_decode($ret['body'], true); if (isset($ret['errno'])) { wlog('文件 ' . $file . ' 获取下载地址失败:' . $ret['errno'], 2); return false; } if (strpos($ret['path'], 'wenxintishi') !== false) { $mysql->exec('update watchlist set failed=2 where id=' . $_SERVER['QUERY_STRING']); wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '被温馨提示'); return false; } foreach ($ret['server'] as &$v) { $v = 'http://' . $v . $ret['path']; } return $ret['server']; }
private function ProcessQuicktick() { if ($this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_total_volume"] < $this->aPrice["fid_total_volume"]) { // Update this contracts total volume $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_total_volume"] = $this->aPrice["fid_total_volume"]; // Get symbol depending on contract type // get the SYMBOLOGY switch ($this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_contract_type"]) { case "1": $symbol = $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_symbol"]; break; case "7": $symbol = $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_symbol"] . " " . $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_expiration_month"]; break; case "8": case "10": $symbol = ${$this}->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_symbol"] . " " . $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_expiration_month"] . " " . $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_strike"] . " " . ($this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_contract_id"]]["fid_put_call"] == 1 ? "P" : "C") . ","; break; default: wlog(get_class($this), "E Contract types not found in price message!!! FREAKING OUT!!!! Can't continue, blowing up ungracefully..."); exit(1); } $data["symbol"] = $symbol; $data["tickTime"] = date("Y-m-d H:i:s", $this->aPrice["tickTime"]); $data["tickMicroTime"] = $this->aPrice["tickMicroTime"]; $data["exchangeId"] = $this->aPrice["fid_exchange_id"]; $data["currency"] = $this->oRequestRTD->oContracts->aaContracts[$this->aPrice["fid_currency_id"]]["fid_symbol"]; $data["lastQty"] = $this->aPrice["fid_last_qty"]; $data["lastPrice"] = $this->aPrice["fid_last"]; $data["bidQty"] = $this->aPrice["fid_bid_qty"]; $data["bidPrice"] = $this->aPrice["fid_best_bid"]; $data["askQty"] = $this->aPrice["fid_ask_qty"]; $data["askPrice"] = $this->aPrice["fid_best_ask"]; $data["totalVolume"] = $this->aPrice["fid_total_volume"]; $data["phaseId"] = $this->aPrice["fid_phase"]; // select the TRADE database $this->oRequestRTD->oDatabase->SelectDatabase($this->oRequestRTD->aaSettings["QUICKTICK"]["DATABASE"]); // send trade to the database $this->oRequestRTD->oDatabase->InsertQuery($this->oRequestRTD->aaSettings["QUICKTICK"]["TABLE"], $data); //print_r($data); } }
$_POST['link'] = '/s/fakelink'; } } elseif ($_POST['link'] == '') { $_POST['link'] = substr(createShare($_POST['fid'], $_POST['code'], $_SESSION['bds_token'], $_SESSION['cookie'], 'browse.php'), 20); } elseif (substr($_POST['link'], 0, 20) == 'http://pan.baidu.com') { $_POST['link'] = substr($_POST['link'], 20); } elseif (substr($_POST['link'], 0, 13) == 'pan.baidu.com') { $_POST['link'] = substr($_POST['link'], 13); } else { $_POST['link'] = false; echo '<h1>错误:地址输入有误。</h1>'; } if ($_POST['link']) { $mysql->prepare('insert into watchlist values(null,?,?,?,0,?,?,0)')->execute(array($_POST['fid'], $_POST['filename'], $_POST['link'], $_POST['code'], $_SESSION['user_id'])); $id = $mysql->lastInsertId(); wlog('在文件浏览页添加记录:用户名:' . $_SESSION['username'] . ',文件完整路径:' . $_POST['filename'] . ',文件fs_id:' . $_POST['fid'] . ',文件访问地址为:' . $jumper . $id); echo '<h1>添加成功!文件访问地址为:<a href="' . $jumper . $id . '" target="_blank">' . $jumper . $id . '</a><br />'; echo '<a href="browse.php">返回</a></h1>'; die; } } } $test = $mysql->prepare('select * from watchlist where fid=? and name=? and user_id=?'); $test->execute(array($_POST['fid'], $_POST['filename'], $_SESSION['user_id'])); $test = $test->fetch(); if (!empty($test)) { echo "<p>这个文件已经添加过啦!<br />文件名:{$test[2]}<br />访问地址:<a href=\"{$jumper}" . $test[0] . "\" target=\"_blank\">{$jumper}" . $test[0] . "</a><br />分享地址:<a href=\"http://pan.baidu.com{$test[3]}\" target=\"_blank\">http://pan.baidu.com{$test[3]}</a><br />提取码:{$test[5]}<br />补档次数:{$test['count']}<br />百度用户名:{$_SESSION['username']}<br /><a href=\"browse.php\">返回</a></p></body></html>"; die; } echo "<h2>您将添加文件:{$_POST['filename']}(fs_id:{$_POST['fid']})至 {$_SESSION['username']} 的自动补档列表中。</h2>"; ?>
function getDownloadLinkLocatedownloadV10($file) { global $bdstoken; $ret = request("http://pcs.baidu.com/rest/2.0/pcs/file?method=locatedownload&bdstoken={$bdstoken}&app_id=250528&path=" . urlencode($file)); $ret = json_decode($ret['body'], true); if (isset($ret['errno'])) { wlog('文件 ' . $file . ' 获取下载地址失败[API: locatedownload 1.0] ' . $ret['errno'], 2); return false; } foreach ($ret['server'] as &$v) { $v = 'http://' . $v . $ret['path']; } return $ret['server']; }
echo '<h1>补档娘更名失败错误代码:' . $json->errno . '</h1>'; wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '重命名失败', 2); $mysql->exec('update watchlist set failed=1 where id=' . $_SERVER['QUERY_STRING']); die; } $mysql->prepare('update watchlist set name=? where id=?')->execute(array($newfullpath, $res['id'])); } $result = createShare($res['fid'], $res['pass'], $token, $res['cookie']); if (!$result) { echo '<h1>补档娘分享失败</h1>'; wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '补档失败:分享失败', 2); $mysql->exec('update watchlist set failed=1 where id=' . $_SERVER['QUERY_STRING']); die; } echo '<script>alert("您访问的文件已经失效,但是我们进行了自动补档,提取码不变。\\n本文件已自动补档' . ($res['count'] + 1) . '次,本次补档方式:' . ($need_rename ? '重命名' : (isset($change_md5) ? '救活温馨提示' : '更换MD5')) . '补档");window.location="' . $result . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '";</script>'; echo '若没有自动跳转, <a href="' . $check['url'] . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '">点我手动跳转</a>。'; $result = substr($result, 20); $mysql->prepare('update watchlist set count=count+1,link=? where id=?')->execute(array($result, $res['id'])); wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '补档成功'); $mysql->exec('update watchlist set failed=0 where id=' . $_SERVER['QUERY_STRING']); } } } else { ?> <h2>未指定要提取的文件!</h2> <?php } ?> </body> </html>
} elseif (isset($_GET['add_user'])) { print_header('添加用户'); if (isset($_POST['create_user'])) { if (!isset($_POST['name']) || $_POST['name'] == '') { echo '<h1>错误:请输入用户名</h1>'; } elseif (!isset($_POST['password']) || $_POST['password'] == '') { echo '<h1>错误:请输入密码</h1>'; } else { if (isset($_POST['code_string'])) { $result = baidu_login($_POST['name'], $_POST['password'], $_POST['code_string'], $_POST['captcha']); } else { $result = baidu_login($_POST['name'], $_POST['password']); } if (!$result['errno']) { $mysql->prepare('insert into users values (null,?,?,?,"") on duplicate key update cookie=?, bduss=?')->execute(array($_POST['name'], $result['cookie'], $result['bduss'], $result['cookie'], $result['bduss'])); wlog('添加用户:' . $_POST['name']); alert_error('用户【' . $_POST['name'] . '】添加成功!', 'switch_user.php'); } if ($result['errno'] == 2) { echo '<h1>密码错误</h1>'; } elseif ($result['errno'] == 5) { echo '<h1>请输入验证码</h1>'; } else { echo '<h1>错误编号:' . $result['errno'] . '</h1>'; } } } ?> <h1>添加用户</h1> <h2>注意:您的密码将被明文传输到本服务器。然后再从本服务器明文传输到百度服务器(因为用了贴吧客户端API,服务器到百度也没有RSA加密)。<br />建议建立补档专用的百度ID而非使用常用ID,且不要使用常用密码</h2> <form method="post" action="switch_user.php?add_user=1">