if (isset ( $_POST ['contato'] )) $txtcontato = strtoupper ( $validations->validStringForm ( $_POST ['contato'] ) ); if (isset ( $_POST ['email'] )) $txtemail = strtolower ( $validations->validStringForm ( $_POST ['email'] ) ); if (isset ( $_POST ['telefone'] )) $txttelefone = $validations->validNumeric ( $_POST ['telefone'] ); if (isset ( $_POST ['fax'] )) $txtfax = $validations->validNumeric ( $_POST ['fax'] ); if (isset ( $_POST ['idenest'] )) $ie = $validations->validNumeric ( $_POST ['idenest'] ); if (isset ( $_POST ['cep'] )) $txtcep = $validations->validNumeric ( $_POST ['cep'] ); if (isset ( $_POST ['bairro'] )) $txtbairro = strtoupper ( $validations->validStringForm ( $_POST ['bairro'] ) ); if (isset ( $_POST ['pais'] )) $pais = $validations->validNumeric ( $_POST ['pais'] ); $sql = "SELECT idfornecedor FROM fornecedor WHERE nome='" . $txtnome . "'"; $query = $db->query ( $sql ); if ($db->num_rows ( $query )) { $row = $db->fetch_assoc ( $query ); $id = $row ['idfornecedor'] . '|1'; } else { echo $sql = "INSERT INTO fornecedor ( nome, cnpj, uf, cidade, endereco, contato, email, telefone, fax, ie, cep, bairro, idpais ) VALUES ( '" . strtoupper ( $txtnome ) . "', '" . $cnpj . "', '" . $txtuf . "', '" . $txtcidade . "', '" . $txtendereco . "', '" . $txtcontato . "', '" . $txtemail . "', '" . $txttelefone . "', '" . $txtfax . "', '" . $ie . "', '" . $txtcep . "', '" . $txtbairro . "', '" . $pais . "' )"; $db->query ( $sql ); $id = $db->insert_id () . '|0'; } echo $id; ?>
$member['cookietime'] = $member['cktime'] ? $member['cktime'] - TIME : 0; if ($action == 'login') { $member['username'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $member['username']); if (strlen($member['username']) > 20) { $member['username'] = substr($member['username'], 0, 20); } if (empty($member['time']) || empty($member['username']) || empty($member['password'])) { exit('Lack of required parameters!'); } elseif ($setting['passport_expire'] && TIME - $member['time'] > $setting['passport_expire']) { exit('Request expired!'); } $user = $db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "user WHERE username='******'username'] . "'"); if ($user) { $uid = $user['uid']; // $user->edit($member); } else { $credit1 = $setting['credit1_register']; $credit2 = $setting['credit2_register']; $db->query("INSERT INTO " . DB_TABLEPRE . "user(username,password,email,credit1,credit2) values ('{$member['username']}','{$member['password']}','{$member['email']}',{$credit1},{$credit2})"); $uid = $db->insert_id(); $db->query("INSERT INTO " . DB_TABLEPRE . "credit(uid,time,operation,credit1,credit2) VALUES ({$uid}," . TIME . ",'user/register',{$credit1},{$credit2}) "); } $forward = empty($forward) ? $setting['passport_server'] : $forward; $auth = strcode("{$uid}\t" . $member['password'], $setting['auth_key'], 'ENCODE'); tcookie('auth', $auth, 24 * 3600 * 365); } elseif ($action == 'logout' || $action == 'quit') { tcookie('sid', ''); tcookie('auth', ''); $forward = empty($forward) ? $setting['passport_server'] : $forward; } header('location:' . $forward);
if (! isset ( $_SESSION ['turno'] )) { $turno = 0; } else { $turno = $_SESSION ['turno']; } $sync_timestamp = strtotime ( 'now' ); $estornado = 0; $diaatual = date ( 'd' ); $sql = "INSERT INTO mv_vendas_vip ( controle, data_venda, id_cliente, cad_login_id, sync_timestamp ) VALUES ( " . $_SESSION ['controlevenda'] . ", '" . date ( 'Y-m-d' ) . "', " . $idcliente . ", " . $idlogin . ", '" . $sync_timestamp . "' )"; $query = $db->query ( $sql ); $venda_vip_id = $db->insert_id (); $lista_carrinho = $_SESSION ['carrinho_venda']; $num_lista = 0; foreach ( $lista_carrinho ['produto_nome'] as $key => $value ) { $sql = "SELECT vlcusto FROM produto WHERE idproduto=" . $key . ""; $query = $db->query ( $sql ); $row = $db->fetch_array ( $query ); if (isset ( $lista_carrinho ['grade_nome'] [$key] )) { $quantidade = array_sum ( $lista_carrinho ['grade_qtd'] [$key] ); $grade = true; } else { $quantidade = $lista_carrinho ['produto_quantidadetotal'] [$key];
private function GoForum() { $news_id = intval($_REQUEST['postid']); if (!$news_id) { die("Hacking attempt!"); } $post = $this->db->super_query("SELECT * FROM " . PREFIX . "_post p\n INNER JOIN " . PREFIX . "_post_extras e\n ON e.news_id=p.id\n WHERE id='{$news_id}'"); $category_id = intval($post['category']); $this->_db_connect(); switch ($this->config['link_title']) { case "old": $title_forum = preg_replace('/{Post_name}/', stripslashes($post['title']), $this->config['vb_link_name_post_on_forum']); break; case "title": $title_forum = stripslashes($post['title']); break; default: break; } if (empty($title_forum)) { die('Unknow title post'); } $title_forum = $this->db->safesql($this->_convert_charset($title_forum)); $isset_post = $this->db->super_query("SELECT threadid FROM " . VB_PREFIX . "thread WHERE title='{$title_forum}' AND visible='1' AND open=1"); if (!empty($isset_post['threadid'])) { header("Location:{$this->vb_config['bburl']}/showthread.php?goto=newpost&t={$isset_post['threadid']}"); exit; } switch ($this->config['link_text']) { case "full": if (iconv_strlen($post['full_story'], DLE_CHARSET) > 10) { $text_forum = $post['full_story']; } else { $text_forum = $post['short_story']; } $text_forum = preg_replace('#(\\A[\\s]*<br[^>]*>[\\s]*|' . '<br[^>]*>[\\s]*\\Z)#is', '', $text_forum); $text_forum = stripslashes($text_forum); $news_seiten = explode("{PAGEBREAK}", $text_forum); if (count($news_seiten) > 1) { $text_forum = $news_seiten[0]; $text_forum .= "<br/><a href=\"" . $this->_get_news_link($post, $category_id) . "\" >" . $this->lang['view_full'] . "</a>"; } $text_forum = $this->_parseBB($text_forum, $post['id'], 'post'); if ($this->config['link_on_news'] && count($news_seiten) <= 1) { $this->config['text_post_on_forum'] = preg_replace('/{post_name}/is', $post['title'], $this->config['text_post_on_forum']); $this->config['text_post_on_forum'] = preg_replace('/{post_link}/is', $this->_get_news_link($post, $category_id), $this->config['text_post_on_forum']); $text_forum .= "\n" . $this->config['text_post_on_forum']; } break; case "short": if (iconv_strlen($post['short_story'], DLE_CHARSET) < 10) { $text_forum = $post['full_story']; } else { $text_forum = $post['short_story']; } $text_forum = preg_replace('#(\\A[\\s]*<br[^>]*>[\\s]*|' . '<br[^>]*>[\\s]*\\Z)#is', '', $text_forum); $text_forum = stripslashes($text_forum); $news_seiten = explode("{PAGEBREAK}", $text_forum); if (count($news_seiten) > 1) { $text_forum = $news_seiten[0]; $text_forum .= "<br/><a href=\"" . $this->_get_news_link($post, $category_id) . "\" >" . $this->lang['view_full'] . "</a>"; } $text_forum = $this->_parseBB($text_forum, $post['id'], 'post'); if ($this->config['link_on_news'] && count($news_seiten) <= 1) { $this->config['text_post_on_forum'] = preg_replace('/{post_name}/is', $post['title'], $this->config['text_post_on_forum']); $this->config['text_post_on_forum'] = preg_replace('/{post_link}/is', $this->_get_news_link($post, $category_id), $this->config['text_post_on_forum']); $text_forum .= "\n" . $this->config['text_post_on_forum']; } break; case "old": $text_forum = preg_replace('/{post_name}/i', $post['title'], $this->config['text_post_on_forum']); $text_forum = preg_replace('/{post_link}/i', $this->_get_news_link($post, $category_id), $text_forum); break; default: return false; } if (empty($text_forum)) { die('Unknow post text'); } $user_id = 0; switch ($this->config['link_user']) { case "author": $author = $this->db->safesql($this->_convert_charset($post['autor'])); $user_info = $this->db->super_query("SELECT userid FROM " . VB_PREFIX . "user WHERE username='******' LIMIT 1"); $user_id = $user_info['userid']; $user = $this->_convert_charset($post['autor']); break; case "cur_user": if ($GLOBALS['member_id']['name']) { $user_name = $this->db->safesql($this->_convert_charset($GLOBALS['member_id']['name'])); $user_info = $this->db->super_query("SELECT userid FROM " . VB_PREFIX . "user WHERE username='******' LIMIT 1"); $user = $this->_convert_charset($GLOBALS['member_id']['name']); $user_id = $user_info['userid']; break; } case "old": $user_id = intval($this->config['postuserid']); if ($user_id && ($user = $this->db->super_query("SELECT username FROM " . VB_PREFIX . "user WHERE userid=" . $user_id))) { $user = $user['username']; } else { $user = $this->config['postusername']; $user_id = 0; } break; default: break; } if (empty($user)) { die('Unknow post user name'); } $categories = explode(",", $post['category']); foreach ($categories as $category) { if (intval($this->config['vb_link_forumid'][$category])) { $forum_id = $this->config['vb_link_forumid'][$category]; break; } } if (!$forum_id || !$this->db->super_query("SELECT forumid FROM " . VB_PREFIX . "forum WHERE parentid!=-1 AND forumid=" . $forum_id)) { die('Unknow forumid for current category'); } $user = $this->db->safesql($user); $text_forum = $this->db->safesql($this->_convert_charset($text_forum)); if ($user_id) { $this->db->query('UPDATE ' . VB_PREFIX . "user SET posts=posts+1 WHERE userid={$user_id}"); } $this->db->query("INSERT INTO " . VB_PREFIX . "thread (title, lastpost, forumid, open, postusername, postuserid, lastposter, dateline, visible) VALUES ('{$title_forum}', '" . TIMENOW . "', '{$forum_id}', '1', '{$user}', '{$user_id}', '{$user}', '" . TIMENOW . "', '1')"); $th_id = $this->db->insert_id(); $this->db->query("INSERT INTO " . VB_PREFIX . "post (threadid, username, userid, title, dateline, pagetext, allowsmilie, ipaddress, visible, showsignature) VALUES ('{$th_id}', '{$user}', '{$user_id}', '{$title_forum}', '" . TIMENOW . "', '{$text_forum}', '1', '" . $this->db->safesql(IPADRESS) . "', '1', 1)"); $post_id = $this->db->insert_id(); $this->db->query("UPDATE " . VB_PREFIX . "thread SET firstpostid='{$post_id}', lastpostid='{$post_id}' WHERE threadid='{$th_id}'"); $this->db->query("UPDATE " . VB_PREFIX . "forum SET lastpost='" . TIMENOW . "', lastposter='{$user}', lastpostid='{$post_id}', lastthread='{$title_forum}', lastthreadid='{$th_id}', threadcount=threadcount+1 WHERE forumid='{$forum_id}'"); header("Location:{$this->vb_config['bburl']}/showthread.php?t={$th_id}"); exit; }
/** * Insert new client to database */ public function Insert() { $this->db->query("INSERT INTO \n\t\t\t`" . TABLE_FROXLOR_CLIENTS . "` \n\t\tSET\n\t\t\t`name` = '" . $this->db->escape($this->Get('name')) . "', \n\t\t\t`desc` = '" . $this->db->escape($this->Get('desc')) . "', \n\t\t\t`enabled` = '" . (int) $this->Get('enabled') . "';\n\t\t"); $this->cid = $this->db->insert_id(); return $this->cid; }
$char = chr ( ord ( $char ) - ord ( $keychar ) ); $result .= $char; } return $result; } $id_desenvolvedor = 1; $db = new db ( ); $db->connect (); $timestamp = strtotime ( 'now' ); $sql = "INSERT INTO atualizacao (timestamp) VALUES (" . $timestamp . ")"; $db->query ( $sql ); $id_atualizacao = $db->insert_id (); $arquivo = Array (); $i = 0; if ($handle = opendir ( $diretorio )) { while ( false !== ($file = readdir ( $handle )) ) { if ($file != "." && $file != "..") { $file_ext = explode ( '.', $diretorio . '/' . $file ); if (! is_numeric ( $file_ext [1] ) || (isset ( $file_ext [2] ) && $file_ext [2] != 'rvs')) { $nome_arquivo_simples = $file; $file_ext = explode ( '.', $nome_arquivo_simples ); $nome_arquivo_novo_simples = $file_ext [0] . '.' . $timestamp . '.rvs'; $nome_arquivo = $diretorio . '/' . $nome_arquivo_simples;
// // //////////////////////////////////////////////////////////////////////////////////////// if (! isset ( $_CONF ['PATH'] )) { require "../../config/default.php"; } $validations = new validations ( ); $db = new db ( ); $db->connect (); $login = strtoupper ( $validations->validStringForm ( $_POST ['login'] ) ); $sql = "SELECT id FROM cad_login WHERE login='******'"; $query = $db->query ( $sql ); if (! $db->num_rows ( $query )) { $nome = strtoupper ( $validations->validStringForm ( $_POST ['nome'] ) ); $senha = md5 ( $_POST ['senha'] ); $permissao = $validations->validNumeric ( $_POST ['permissao'] ); $sql = "INSERT INTO cad_login ( login, senha, autoriza, ativo, nome ) VALUES ( '" . $login . "', '" . $senha . "', " . $permissao . ", 'ativo', '" . $nome . "' )"; $db->query ( $sql ); echo $db->insert_id (); } else { echo '-'; } ?>
<?php function __autoload($classname) { if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) { } else { if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) { } else { if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) { } else { echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>'; } } } include_once $filename; } \db::connect(); $res = \db::query('SELECT DISTINCT(mid) FROM glider'); $insert_statement = \db::prepare('INSERT INTO manufacturer SET title=:title'); $update_statement = \db::prepare('UPDATE glider SET manufacturer =:mid WHERE manufacturer = :title'); while ($row = \db::fetch($res)) { $insert_statement->execute(array('title' => $row->manufacturer)); $id = \db::insert_id(); $update_statement->execute(array('title' => $row->manufacturer, 'mid' => $id)); }
function doucenter() { $d_url = 'index.php?admin_setting-ucenter'; if (isset($this->post['submit'])) { $settings['ucopen'] = $this->post['ucopen']; $settings['feed'] = serialize($this->post['feed']); $setting = $_ENV['setting']->update_setting($settings); $this->cache->removecache('setting'); $this->message('UCenter设置成功!', $d_url); } elseif (isset($this->post['ucsubmit'])) { $ucopen = 1; $ucapi = $this->post['ucapi']; $ucpassword = $this->post['ucpassword']; $ucip = $this->post['ucip']; $ucapi = preg_replace("/\\/\$/", '', trim($ucapi)); $ucip = trim($ucip); if (empty($ucapi) || !preg_match("/^(http:\\/\\/)/i", $ucapi)) { $this->message('您输入的URL地址不正确!', $d_url); } if (!$ucip) { $temp = @parse_url($ucapi); $ucip = gethostbyname($temp['host']); if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) { $ucip = ''; } } define('UC_API', true); if (!@(include_once HDWIKI_ROOT . '/api/uc_client/client.php')) { $this->message('uc_client目录不存在。', $d_url); } $ucinfo = uc_fopen($ucapi . '/index.php?m=app&a=ucinfo&release=' . UC_CLIENT_RELEASE, 500, '', '', 1, $ucip); list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo); if ($status != 'UC_STATUS_OK') { $this->message('uc_url_unreachable', $d_url); } else { $dbcharset = strtolower(str_replace('-', '', trim(WIKI_CHARSET))); $ucdbcharset = strtolower(str_replace('-', '', $ucdbcharset)); if (UC_CLIENT_VERSION > $ucversion) { $this->message('uc_version_incorrect', $d_url); } elseif ($dbcharset && $ucdbcharset != $dbcharset) { $this->message('uc_dbcharset_incorrect', $d_url); } $tagtemplates = ''; $app_url = WIKI_URL; $postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucpassword) . "&apptype=" . urlencode('OTHER') . "&appname=" . urlencode('HDWIKI') . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $dbcharset . '&appdbcharset=' . $dbcharset . '&' . $tagtemplates . '&release=' . UC_CLIENT_RELEASE; $s = uc_fopen($ucapi . '/index.php', 500, $postdata, '', 1, $ucip); if (empty($s)) { $this->message('不能连接到 UCenter 服务端。', $d_url); } elseif ($s == '-1') { $this->message('UCenter 密码错误。', $d_url); } else { $ucs = explode('|', $s); if (empty($ucs[0]) || empty($ucs[1])) { $this->message('UCenter 不能返回数据。', $d_url); } } $ucdata = "<?php\r\n\t\t\t\t\tdefine('UC_OPEN','{$ucopen}');\r\n\t\t\t\t\tdefine('UC_CONNECT', 'uc_api_post');\r\n\r\n\t\t\t\t\tdefine('UC_DBHOST', '{$ucs[2]}');\r\n\t\t\t\t\tdefine('UC_DBUSER', '{$ucs[4]}');\r\n\t\t\t\t\tdefine('UC_DBPW', '{$ucs[5]}');\r\n\t\t\t\t\tdefine('UC_DBNAME', '{$ucs[3]}');\r\n\t\t\t\t\tdefine('UC_DBCHARSET', '{$ucs[6]}');\r\n\t\t\t\t\tdefine('UC_DBTABLEPRE', '{$ucs[7]}');\r\n\r\n\t\t\t\t\tdefine('UC_KEY', '{$ucs[0]}');\r\n\t\t\t\t\tdefine('UC_API', '{$ucapi}');\r\n\t\t\t\t\tdefine('UC_CHARSET', '{$ucs[8]}');\r\n\t\t\t\t\tdefine('UC_IP', '{$ucip}');\r\n\t\t\t\t\tdefine('UC_APPID', '{$ucs[1]}');\r\n\t\t\t\t\t?>"; $byte = file::writetofile(HDWIKI_ROOT . '/api/ucconfig.inc.php', $ucdata); if ($byte == 0) { $this->message('不能写ucconfig.inc.php文件。', $d_url); } $this->message('UCenter 设置成功!', $d_url); } } elseif (isset($this->post['import'])) { set_time_limit(0); $url = HDWIKI_ROOT . '/api/ucconfig.inc.php'; if (!file_exists($url)) { $this->message('您还没有设置过UCenter!', 'BACK'); } else { include $url; if (!(UC_OPEN && isset($this->setting['ucopen']) && $this->setting['ucopen'])) { $this->message('您还没有开通ucenter!', 'BACK'); } $url = HDWIKI_ROOT . "/data/import_uc.lock"; if (file_exists($url)) { $this->message('您已经导入过用户,想重新导入请删除' . $url . '文件。', 'BACK'); } } #包含uc相应文件。 require_once HDWIKI_ROOT . '/api/uc_client/client.php'; require_once HDWIKI_ROOT . '/api/uc_client/lib/db.class.php'; # #实例uc数据类 $ucdb = new db(); $ucdb->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE); # $this->load('user'); $ucuserlist = ''; $usercount = $_ENV['user']->get_total_num('', 0); for ($i = 0; $i < $usercount; $i = $i + 100) { $userlist = $_ENV['user']->get_list('', 0, $i, 100); foreach ($userlist as $temUser) { if (uc_get_user($temUser['username'])) { $ucuserlist .= "username:"******"\tuser_email:" . $temUser['email'] . "\r\n"; } else { $salt = substr(uniqid(rand()), -6); $password = md5($temUser['password'] . $salt); $ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "members SET username='******'username'] . "', password='******', email='" . $temUser['email'] . "', regip='" . $temUser['regip'] . "', regdate='" . time() . "', salt='" . $salt . "'"); $uid = $ucdb->insert_id(); $ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "memberfields SET uid='{$uid}'"); } } } $mes = "import complate!"; if (empty($ucuserlist)) { $ucuserlist = $mes; } file::writetofile(HDWIKI_ROOT . "/data/hdwiki_user_uc.txt", $ucuserlist); file::writetofile(HDWIKI_ROOT . "/data/import_uc.lock", $mes); $this->message('导入用户数据成功!', $d_url); } else { $this->view->assign('ucopen', $this->setting['ucopen']); $url = "./api/ucconfig.inc.php"; if (!file_exists($url)) { $iscon = 1; } else { include $url; if (UC_OPEN && $this->setting['uc']) { $isopen = 1; } $url = HDWIKI_ROOT . "/data/import_uc.lock"; if (file_exists($url)) { $islock = 1; } $this->view->assign('uc_api', UC_API); } $feed = unserialize($this->setting['feed']); $this->view->assign('create', @in_array('create', $feed)); $this->view->assign('edit', @in_array('edit', $feed)); $this->view->assign('iscon', $iscon); $this->view->assign('isopen', $isopen); $this->view->assign('islock', $islock); $this->view->display("admin_ucenter"); } }
$cel2 = $validations->validNumeric ( $_POST ['cel2'] ); $cep = $validations->validNumeric ( $_POST ['cep'] . $_POST ['cepdv'] ); $email = strtolower ( $validations->validStringForm ( $_POST ['email'] ) ); $cpf = $validations->validStringForm ( $_POST ['cpf'] ); $cpf = str_replace ( '.', '', str_replace ( '-', '', $cpf ) ); $identidade = $validations->validStringForm ( $_POST ['identidade'] ); $infoadd = strtoupper ( $validations->validStringForm ( $_POST ['infoadd'] ) ); if ($_POST ['mes'] > 0) { $dataniver = date ( 'Y' ) . '-' . $_POST ['mes'] . '-' . $_POST ['dia']; } else { $dataniver = ''; } $telefone = str_pad ( str_replace ( '-', '', $dddtel . $tel1 . $tel2 ), 10, '0', STR_PAD_LEFT ); $celular = str_pad ( str_replace ( '-', '', $dddcel . $cel1 . $cel2 ), 10, '0', STR_PAD_LEFT ); $dtcadastro = date ( 'Y-m-d' ); $sql = "INSERT INTO cliente ( txtcep, txtnome, txtendereco, txtbairro, txtcidade, txtuf, txttelefone, txtcelular, txtemail, txtcpf, dtaniversario, txtrg, txtinf_adicional, dtcadastro) VALUES ( '" . $cep . "', '" . $nome . "', '" . $endereco . "', '" . $bairro . "', '" . $cidade . "', '" . $estado . "', '" . $dddtel . $tel1 . $tel2 . "', '" . $dddcel . $cel1 . $cel2 . "', '" . $email . "', '" . $cpf . "', '" . $dataniver . "', '" . $identidade . "', '" . nl2br ( $infoadd ) . "', '" . $dtcadastro . "') "; if ($db->query ( $sql )) { echo "CLIENTE ADICIONADO COM SUCESSO|" . $db->insert_id (); } else { echo "Ocorreu um erro, por favor tente novamente"; } } ?>
} else { $vr_creditototal = 0; } $total_temp = ($vr_dinheiro+$vr_chequetotal+$vr_creditototal+$vr_debito+$vr_outro)-$vr_totalvenda; //if ($total_temp>0){ $vr_dinheiro = $vr_dinheiro-$total_temp; //} $sql = "INSERT INTO mv_vendas ( controle, data_venda, id_cliente, id_login, vr_totalvenda, vr_opcionalvenda, parcelas, vr_dinheiro, vr_cheque, vr_cartao, vr_debito, vr_outro, terminal, turno, credit_id, debit_id, sync_timestamp ) VALUES ( " . $_SESSION ['controlevenda'] . ", '" . date ( 'Y-m-d' ) . "', " . $idcliente . ", " . $idlogin . ", '" . $vr_totalvenda . "', '" . $vr_opcionalvenda . "', " . $parcelas . ", '" . $vr_dinheiro . "', '" . $vr_chequetotal . "', '" . $vr_creditototal . "', '" . $vr_debito . "', '" . $vr_outro . "', '" . $terminal . "', '" . $turno . "', " . $credit_id . ", " . $debit_id . ", " . $sync_timestamp . " )"; $query = $db->query($sql); $sql = "UPDATE mv_financeiro SET venda_id=".$db->insert_id()." WHERE controle=".$_SESSION ['controlevenda'].""; $query = $db->query ( $sql ); $lista_carrinho = $_SESSION['carrinho_venda']; $num_lista = 0; $totalitens = count($lista_carrinho ['produto_nome']); foreach ( $lista_carrinho['produto_nome'] as $key => $value ) { $sql = "SELECT vlcusto FROM produto WHERE idproduto=" . $key . ""; $query = $db->query ( $sql ); $row = $db->fetch_array ( $query ); $quantidade = $lista_carrinho['produto_quantidadetotal'][$key];
$vltotal = ($_POST ['vltotal']) ? $validations->validStringForm ( $_POST ['vltotal'] ) : 0; $dtnota = $validations->validNumeric ( $_POST ['anonota'] ) . '-' . $validations->validNumeric ( $_POST ['mesnota'] ) . '-' . $validations->validNumeric ( $_POST ['dianota'] ); if ($fornecedor == 0) $fornecedor = $validations->validNumeric ( $_POST ['fornecedor'] ); if (isset ( $_SESSION ['gradeproduto'] )) $grade = 1; else $grade = 0; $sql = "INSERT INTO produto ( cod_interno, txtproduto, vlcusto, vlprontaentrega, vlatacado, vlvarejo, qtdestoque, produtotipo_idprodutotipo, fornecedor_idfornecedor, colecao_idcolecao, cod_barra, dtcadastro, grade, stcontroleestoque, sync_timestamp ) VALUES ( '" . $codigo . "', '" . $nome . "', '" . $vlcusto . "', '" . $vlpentrega . "', '" . $vlatacado . "', '" . $vlvarejo . "', " . $qtdestoque . ", " . $categoria . ", " . $fornecedor . ", " . $colecao . ", " . $codbarra . ", '" . strtotime ( 'now' ) . "', " . $grade . ", 1, " . strtotime ( 'now' ) . " )"; if ($db->query ( $sql )) { $idproduto = $db->insert_id (); if ($grade == 1) { $arraygrade = ''; $total = count ( $_SESSION ['gradeproduto'], COUNT_RECURSIVE ) / 3; for($i = 1; $i < $total; $i ++) { $descricao_grade = strtoupper ( $validations->validStringForm ( $_SESSION ['gradeproduto'] ['descricao'] [$i] ) ); $quantidade_grade = $validations->validNumeric ( $_SESSION ['gradeproduto'] ['quantidade'] [$i] ); $vlprodgrade_grade = $validations->validStringForm ( $_SESSION ['gradeproduto'] ['vlprodgrade'] [$i] ); $sql = "INSERT INTO cad_produtos_grade ( id_produto, descricao, quantidade, vlprodgrade ) VALUES ( " . $idproduto . ", '" . $descricao_grade . "', '" . $quantidade_grade . "', '" . $vlprodgrade_grade . "' )"; $db->query ( $sql ); $arraygrade .= '#|#' . $descricao_grade . '+-+' . $quantidade_grade . '+-+' . $vlprodgrade_grade; }
public function show() { $progressPath = CACHE_DIR . 'progress.txt'; $totalPath = CACHE_DIR . 'total.txt'; $is_next = true; if (file_exists($progressPath) && file_exists($totalPath)) { $progress = file_get_contents($progressPath); $total = file_get_contents($totalPath); } else { file_put_contents($progressPath, 0); $sql = 'SELECT max(member_id) as max,min(member_id) as min FROM ' . DB_PREFIX . 'member'; $max_min = $this->db->query_first($sql); file_put_contents($totalPath, $max_min['max']); file_put_contents($progressPath, $max_min['min']); $progress = $max_min['min'] - 1; $total = $max_min['max']; } $newlegth = intval($progress + LENGTH); if ($newlegth > intval($total)) { $newlegth = $total; $is_next = false; } $sql = 'SELECT * FROM ' . DB_PREFIX . 'member where ( member_id >' . $progress . ') AND ( member_id <= ' . $newlegth . ') order by member_id asc '; $query = $this->db->query($sql); $member = array(); $member_id = array(); while ($row = $this->db->fetch_array($query)) { $member[$row['member_id']] = $row; $member_id[] = $row['member_id']; } if ($member_id) { $sql = 'SELECT * FROM ' . DB_PREFIX . 'member_bind where member_id IN (' . implode(',', $member_id) . ') order by member_id asc '; $query = $this->db->query($sql); $member_bind = array(); while ($row = $this->db->fetch_array($query)) { $member_bind[$row['member_id']][] = $row; } } if (!empty($member)) { $source_db = array('host' => 'localhost', 'user' => 'root', 'pass' => 'hogesoft', 'database' => 'jn_members2', 'charset' => 'utf8', 'pconncet' => '0', 'dbprefix' => 'm2o_'); $_sourceDB = new db(); $_sourceDB->connect($source_db['host'], $source_db['user'], $source_db['pass'], $source_db['database'], $source_db['charset'], $source_db['pconnect'], $source_db['dbprefix']); foreach ($member as $key => $val) { $insertData = $val; if (!$val['guid']) { $insertData['guid'] = guid(); } $sql = 'SELECT count(*) as total FROM ' . DB_PREFIX . 'member where member_name = \'' . $insertData['member_name'] . '\' AND type = \'' . $insertData['type'] . '\''; $isInsert = $_sourceDB->query_first($sql); if ($isInsert['total'] > 0) { file_put_contents(CACHE_DIR . 'error_member.txt', var_export($insertData, 1), FILE_APPEND); continue; } unset($insertData['member_id']); $cmd = $replace ? 'REPLACE INTO ' : 'INSERT INTO '; $sql = $cmd . DB_PREFIX . 'member SET ' . $this->setField($insertData); $_sourceDB->query($sql); $iid = $_sourceDB->insert_id(); if (!$iid) { break; } $sql = 'INSERT INTO ' . DB_PREFIX . 'member_count ( u_id ) VALUES( ' . $iid . ' )'; $_sourceDB->query($sql); if ($_member_bind = $member_bind[$val['member_id']]) { foreach ($_member_bind as $k => $v) { $inuc = 0; $v['member_id'] = $iid; if ($v['type'] == 'm2o' && $v['inuc'] == 0) { $v['platform_id'] = $iid; } if ($v['type'] == 'uc') { $inuc = $v['platform_id']; } else { if ($v['inuc'] != 0) { $inuc = $v['inuc']; } } $sql = 'SELECT count(*) as total FROM ' . DB_PREFIX . 'member_bind where member_id = ' . $v['member_id'] . ' AND platform_id = \'' . $v['platform_id'] . '\' AND type = \'' . $v['type'] . '\''; $isInsertBind = $_sourceDB->query_first($sql); if ($isInsertBind['total'] > 0) { file_put_contents(CACHE_DIR . 'error_memberbind.txt', var_export($v, 1), FILE_APPEND); continue; } $cmd = $replace ? 'REPLACE INTO ' : 'INSERT INTO '; $sql = $cmd . DB_PREFIX . 'member_bind SET ' . $this->setField($v); $_sourceDB->query($sql); if ($inuc) { $sql = 'UPDATE ' . DB_PREFIX . 'member_bind SET inuc =\'' . $inuc . '\' WHERE member_id = ' . $iid; $_sourceDB->query($sql); } } } } $_sourceDB->close(); file_put_contents($progressPath, $newlegth); if ($is_next) { $percent = round(intval($newlegth) / intval($total) * 100, 2) . "%"; echo $message = '系统正在合并数据,别打扰唉...' . $percent; $this->redirect('membersDataMerge.php'); } echo "数据合并完成"; exit; } else { echo "已经合并完成,请勿重复合并数据"; } exit; }
$item_img = $find_list_img[$j]->src; } $version = $itemhtml->find('div[class=meta-info] div[itemprop="softwareVersion"]')[0]->plaintext; $manufacture = $itemhtml->find('a[class="document-subtitle primary"] span')[0]->plaintext; $post_meta['_infomation_name'] = $title; $post_meta['_infomation_version'] = $version; $post_meta['_infomation_manufacturers'] = $manufacture; $post_meta['snap_isAutoPosted'] = 1; $post_meta['_internal_link_exist'] = "yes"; // Lay thong tin bai viet $content_ = $itemhtml->find("div[class=show-more-content]"); $content .= $content_[0]->innertext; if ($images != "") { $post = array('post_title' => $title, 'post_content' => $content, 'post_status' => 'publish', 'post_author' => 1, 'post_date' => date("Y-m-d H:i:s"), 'post_date_gmt' => date("Y-m-d H:i:s"), 'post_name' => vnit_change_title($title), 'post_modified' => date("Y-m-d H:i:s"), 'post_modified_gmt' => date("Y-m-d H:i:s"), 'id_com' => $id_com, 'guid' => 'http://masterapk.com/dungml/' . vnit_change_title($title) . '/'); $db->insert("wp_posts", $post); $post_id = $db->insert_id(); // Tang so luong category $db->query("UPDATE wp_term_taxonomy SET count = count + 1 WHERE term_id = " . $row->term_id); // Insert wp_term $term['name'] = $title; $term['slug'] = vnit_change_title($title); $db->insert("wp_terms", $term); $term_id = $db->insert_id(); // insert wp_term_taxonomy $term_taxo['term_id'] = $term_id; $term_taxo['taxonomy'] = 'post_tag'; $term_taxo['count'] = '0'; $db->insert("wp_term_taxonomy", $term_taxo); $term_taxonomy_id = $db->insert_id(); //insert wp_term_relationships $term_re['object_id'] = $post_id;
$validations = new validations ( ); $db = new db ( ); $db->connect (); if ($_REQUEST ['fluxo'] == 'receita') { $tipo_lancamento = "E"; } elseif ($_REQUEST ['fluxo'] == 'despesa') { $tipo_lancamento = "S"; } $novo_favorecido = utf8_decode ( $_REQUEST ['novo_favorecido'] ); $sql = "INSERT INTO fornecedor ( nome , tipo_lancamento ) VALUES ( '{$novo_favorecido}', '{$tipo_lancamento}' );"; $db->query ( $sql ); $new_id = $db->insert_id (); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<plano>\n"; echo "<id>" . $new_id . "</id>\n"; echo "<nome>" . $novo_favorecido . "</nome>\n"; echo "</plano>\n"; ?>
public function show() { $progressPath = CACHE_DIR . 'progress.txt'; $totalPath = CACHE_DIR . 'total.txt'; if (file_exists($progressPath)) { $progress = file_get_contents($progressPath); } else { file_put_contents($progressPath, 0); $sql = 'SELECT COUNT(*) AS total FROM ' . DB_PREFIX . 'member'; $total = $this->db->query_first($sql); $total = $total['total']; file_put_contents($totalPath, $total); $progress = 0; } $newlegth = $progress + LENGTH; $sql = 'SELECT * FROM ' . DB_PREFIX . 'member where id >' . $progress . ' AND id <= ' . $newlegth . ' order by id asc '; $query = $this->db->query($sql); $arr = array(); $ids = array(); while ($row = $this->db->fetch_array($query)) { $ids[] = $row['id']; $arr[$row['id']] = array('id' => $row['id'], 'uc_id' => $row['uc_id'], 'member_name' => $row['member_name'], 'nick_name' => $row['nick_name'], 'password' => $row['password'], 'email' => $row['email'], 'appid' => $row['appid'], 'appname' => $row['appname'], 'salt' => $row['salt'], 'mobile' => $row['mobile'], 'avatar' => $row['filename'] ? serialize(array('host' => $row['host'], 'dir' => $row['dir'], 'filepath' => $row['filepath'], 'filename' => $row['filename'])) : '', 'create_time' => $row['create_time'], 'update_time' => $row['update_time'], 'ip' => $row['ip']); } if (!empty($ids)) { $sql = 'SELECT * FROM ' . DB_PREFIX . 'member_bound WHERE member_id IN (' . implode(',', $ids) . ')'; $query = $this->db->query($sql); $bound = array(); while ($row = $this->db->fetch_array($query)) { $arr[$row['member_id']]['avatar_url'] = $row['avatar_url']; $arr[$row['member_id']]['platform_id'] = $row['platform_id']; $arr[$row['member_id']]['nick_name'] = $row['plat_member_name']; $platform_id[] = $row['platform_id']; } } if ($platform_id && $this->settings['App_share']) { $platform_id_str = implode(',', $platform_id); //$access_plat_token_str .= ',d4cf3e1c11842fc401dac4785fc7cb74,4161492c9e237fc3a6a33b6420fdbb73'; $this->curl->setSubmitType('post'); $this->curl->initPostData(); $this->curl->addRequestData('a', 'get_user_by_id'); $this->curl->addRequestData('id', $platform_id_str); $ret = $this->curl->request('get_user.php'); $ret = $ret[0]; } if (!empty($arr)) { foreach ($arr as $key => $val) { if (!empty($ret[$val['platform_id']])) { $arr[$key]['type'] = $this->plat_maps[$ret[$val['platform_id']]['plat_type']]['type']; $arr[$key]['type_name'] = $this->plat_maps[$ret[$val['platform_id']]['plat_type']]['type_name']; $arr[$key]['platform_id'] = $ret[$val['platform_id']]['uid']; } else { $arr[$key]['type'] = 'm2o'; $arr[$key]['type_name'] = 'M2O'; } } $source_db = array('host' => 'localhost', 'user' => 'root', 'pass' => 'hogesoft', 'database' => 'jn_members', 'charset' => 'utf8', 'pconncet' => '0', 'dbprefix' => 'm2o_'); $sourceDB = new db(); $sourceDB->connect($source_db['host'], $source_db['user'], $source_db['pass'], $source_db['database'], $source_db['charset'], $source_db['pconnect'], $source_db['dbprefix']); foreach ($arr as $key => $val) { $sql = 'INSERT INTO ' . DB_PREFIX . 'member ( guid, member_name, password, salt, type, type_name, avatar, email, status, appid, appname, mobile, create_time, update_time, ip) VALUES( "' . guid() . '", "' . $val['member_name'] . '", "' . $val['password'] . '", "' . $val['salt'] . '", "' . $val['type'] . '", "' . $val['type_name'] . '", "' . addslashes($val['avatar']) . '", "' . $val['email'] . '", "1", "' . $val['appid'] . '", "' . $val['appname'] . '", "' . $val['mobile'] . '", "' . $val['create_time'] . '", "' . $val['update_time'] . '", "' . $val['ip'] . '" )'; $sourceDB->query_first($sql); $iid = $sourceDB->insert_id(); if (!$iid) { break; } $val['platform_id'] = !empty($val['platform_id']) ? $val['platform_id'] : (empty($val['uc_id']) ? $iid : $val['uc_id']); $sql = 'INSERT INTO ' . DB_PREFIX . 'member_bind ( member_id, platform_id, nick_name, type, type_name, avatar_url, bind_time, inuc, is_primary ) VALUES( ' . $iid . ', "' . $val['platform_id'] . '", "' . $val['nick_name'] . '", "' . $val['type'] . '", "' . $val['type_name'] . '", "' . $val['avatar_url'] . '", "' . TIMENOW . '", "' . $val['uc_id'] . '", 1 )'; $sourceDB->query($sql); $sql = 'INSERT INTO ' . DB_PREFIX . 'member_count ( u_id ) VALUES( ' . $iid . ' )'; $sourceDB->query($sql); } file_put_contents($progressPath, $progress + LENGTH); $total = file_get_contents($totalPath); if (intval($progress + LENGTH) < intval($total)) { $percent = round(intval($progress + LENGTH) / intval($total) * 100, 2) . "%"; echo $message = '正在更新数据...' . $percent; $this->redirect('export2members.php'); } echo "数据更新完成"; exit; } else { echo "已经导入完成,请勿导入重复数据"; } exit; }
/** * Insert data to database. */ public function Insert() { $this->db->query('INSERT INTO `' . TABLE_PANEL_TICKETS . "` \n (`customerid`, \n `adminid`,\n `category`, \n `priority`, \n `subject`, \n `message`, \n `dt`, \n `lastchange`, \n `ip`, \n `status`, \n `lastreplier`, \n `by`,\n `answerto`) \n VALUES \n ('" . (int) $this->Get('customer') . "', \n '" . (int) $this->Get('admin') . "',\n '" . (int) $this->Get('category') . "', \n '" . (int) $this->Get('priority') . "', \n '" . $this->db->escape($this->Get('subject')) . "', \n '" . $this->db->escape($this->Get('message')) . "', \n '" . (int) $this->Get('dt') . "', \n '" . (int) $this->Get('lastchange') . "', \n '" . $this->db->escape($this->Get('ip')) . "', \n '" . (int) $this->Get('status') . "',\n '" . (int) $this->Get('lastreplier') . "',\n '" . (int) $this->Get('by') . "',\n '" . (int) $this->Get('answerto') . "');"); $this->tid = $this->db->insert_id(); return true; }
} elseif ($webserver == 'lighttpd') { $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/conf-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'"); $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/syscp-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'"); $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/syscp-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'"); $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'"); $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'"); } // insert the lastcronrun to be the installation date $query = 'UPDATE `%s` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'lastcronrun\''; $query = sprintf($query, TABLE_PANEL_SETTINGS); $db->query($query); // and lets insert the default ip and port $query = 'INSERT INTO `%s` SET `ip` = \'%s\', `port` = \'80\' '; $query = sprintf($query, TABLE_PANEL_IPSANDPORTS, $db->escape($serverip)); $db->query($query); $defaultip = $db->insert_id(); // insert the defaultip $query = 'UPDATE `%s` SET `value` = \'%s\' WHERE `settinggroup` = \'system\' AND `varname` = \'defaultip\''; $query = sprintf($query, TABLE_PANEL_SETTINGS, $db->escape($defaultip)); $db->query($query); status_message('green', 'OK'); //last but not least create the main admin status_message('begin', $lng['install']['adding_admin_user']); $db->query('INSERT INTO `' . TABLE_PANEL_ADMINS . "` SET\n\t\t`loginname` = '" . $db->escape($admin_user) . "',\n\t\t`password` = '" . md5($admin_pass1) . "',\n\t\t`name` = 'Siteadmin',\n\t\t`email` = 'admin@" . $db->escape($servername) . "',\n\t\t`customers` = -1,\n\t\t`customers_used` = 0,\n\t\t`customers_see_all` = 1,\n\t\t`caneditphpsettings` = 1,\n\t\t`domains` = -1,\n\t\t`domains_used` = 0,\n\t\t`domains_see_all` = 1,\n\t\t`change_serversettings` = 1,\n\t\t`edit_billingdata` = 1,\n\t\t`diskspace` = -1024,\n\t\t`diskspace_used` = 0,\n\t\t`mysqls` = -1,\n\t\t`mysqls_used` = 0,\n\t\t`emails` = -1,\n\t\t`emails_used` = 0,\n\t\t`email_accounts` = -1,\n\t\t`email_accounts_used` = 0,\n\t\t`email_forwarders` = -1,\n\t\t`email_forwarders_used` = 0,\n\t\t`email_quota` = -1,\n\t\t`email_quota_used` = 0,\n\t\t`ftps` = -1,\n\t\t`ftps_used` = 0,\n\t\t`tickets` = -1,\n\t\t`tickets_used` = 0,\n\t\t`subdomains` = -1,\n\t\t`subdomains_used` = 0,\n\t\t`traffic` = -1048576,\n\t\t`traffic_used` = 0,\n\t\t`deactivated` = 0,\n\t\t`aps_packages` = -1"); status_message('green', 'OK'); //now we create the userdata.inc.php with the mysql-accounts status_message('begin', $lng['install']['creating_configfile']); $userdata = "<?php\n"; $userdata .= "//automatically generated userdata.inc.php for SysCP\n"; $userdata .= "\$sql['host']='" . addcslashes($mysql_host, "'\\") . "';\n"; $userdata .= "\$sql['user']='******'\\") . "';\n";
public static function insert_id() { return parent::insert_id(); }