function print_import() { global $self, $xurl, $DB; print_header(); ?> <center> <h3>Import DB</h3> <div class="frm"> <b>.sql</b> or <b>.gz</b> file: <input type="file" name="file1" value="" size=40><br> <input type="hidden" name="doim" value="1"> <input type="submit" value=" Upload and Import " onclick="return ays()"><input type="button" value=" Cancel " onclick="window.location='<?php eo($self . '?' . $xurl . '&db=' . $DB['db']); ?> '"> </div> <br><br><br> <!-- <h3>Import one Table from CSV</h3> <div class="frm"> .csv file (Excel style): <input type="file" name="file2" value="" size=40><br> <input type="checkbox" name="r1" value="1" checked> first row contain field names<br> <small>(note: for success, field names should be exactly the same as in DB)</small><br> Character set of the file: <select name="chset"><?php echo chset_select('utf8'); ?> </select> <br><br> Import into:<br> <input type="radio" name="tt" value="1" checked="checked"> existing table: <select name="t"> <option value=''>- select -</option> <?php echo sel(db_array('show tables', NULL, 0, 1), 0, ''); ?> </select> <div style="margin-left:20px"> <input type="checkbox" name="ttr" value="1"> replace existing DB data<br> <input type="checkbox" name="tti" value="1"> ignore duplicate rows </div> <input type="radio" name="tt" value="2"> create new table with name <input type="text" name="tn" value="" size="20"> <br><br> <input type="hidden" name="doimcsv" value="1"> <input type="submit" value=" Upload and Import " onclick="return ays()"><input type="button" value=" Cancel " onclick="window.location='<?php eo($self); ?> '"> </div> --> </center> <?php print_footer(); exit; }
function chset_select($sel = '') { $result = ''; if ($_SESSION['sql_chset']) { $arr = $_SESSION['sql_chset']; } else { $arr = db_array("show character set", NULL, 1); $_SESSION['sql_chset'] = $arr; } return @sel($arr, 'Charset', $sel); }
$decode_uinfo = json_decode($uinfo, true); $secod = $decode_uinfo['se']; unset($_SESSION['uid']); unset($_SESSION['username']); } if ($secod == 1) { $url3 = "http://" . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . "/baji/?/account/ajax/register_process/"; $post_data3 = array('_post_type' => 'ajax', 'agreement_chk' => "agree", 'email' => '', 'job_id' => "", 'password' => $decode_uinfo['openid'], 'sex' => 3, 'signature' => "", 'user_name' => $decode_uinfo['user_name'], 'yqm' => 9001); $info = request_by_curl($url3, $post_data3); print_r($info); $decode_info = json_decode($info, true); insert($decode_uinfo['user_name'], $decode_uinfo['openid']); $user_name = $decode_uinfo['user_name']; $pass = $decode_uinfo['openid']; } elseif ($secod == 0) { $ro = sel($decode_uinfo['openid']); $user_name = $ro['user_name']; $pass = $ro['password']; $url4 = "http://" . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . "/baji/?/account/ajax/login_process/"; $rurl = utf8_encode("http://" . $_SERVER['SERVER_NAME'] . "/baji/?/topic/"); $post_data4 = array('_post_type' => 'ajax', 'agreement_chk' => "agree", 'code_typ' => "0", 'password' => $pass, 'user_name' => $user_name, 'return_url' => "http://" . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . "/baji/?/topic/"); $info = request_by_curl($url4, $post_data4); print_r($info); $decode_info = json_decode($info, true); # $url5="http://".$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"]."/baji/?/account/login/"; # header("location:".$url5); } } else { echo 'error the oauth data is not in data base.'; } } else {
# # # # # # # # # require "../settings.php"; if (isset($_POST["sum"])) { $OUTPUT = sum($_POST); } elseif (isset($_POST["all"])) { $OUTPUT = all($_POST); } else { $OUTPUT = sel(); } $OUTPUT .= "\n\t\t\t\t\t<p>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>"; require "../template.php"; function sel() { $out = "\n\t\t\t\t<h3>Sales Report (POS Invoices Only)</h3>\n\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th colspan='2'>Date Range</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td align='center' colspan='2'>\n\t\t\t\t\t\t\t<input type=text size=2 name=fday maxlength=2 value='1'>-\n\t\t\t\t\t\t\t<input type=text size=2 name=fmon maxlength=2 value='" . date("m") . "'>-\n\t\t\t\t\t\t\t<input type=text size=4 name=fyear maxlength=4 value='" . date("Y") . "'>\n\t\t\t\t\t\t\t TO \n\t\t\t\t\t\t\t<input type='text' size='2' name='today' maxlength='2' value='" . date("d") . "'>-\n\t\t\t\t\t\t\t<input type=text size=2 name=tomon maxlength=2 value='" . date("m") . "'>-\n\t\t\t\t\t\t\t<input type=text size=4 name=toyear maxlength=4 value='" . date("Y") . "'>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><input type='submit' name='sum' value='Summary'></td>\n\t\t\t\t\t\t<td align='right'><input type='submit' name='all' value='All Pos Sales'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</form>\n\t\t\t\t</table>"; return $out; } function sum($_POST) { extract($_POST); # Validate input require_lib("validate"); $v = new validate(); $v->isOk($fday, "num", 1, 2, "Invalid from Date day.");
function get_db_select($sel = '') { global $DB; if (is_array($_SESSION['sql_sd']) && $_REQUEST['db'] != '*') { //check cache $arr = $_SESSION['sql_sd']; } else { $arr = db_array("show databases", NULL, 1); if (!is_array($arr)) { $arr = array(0 => array('Database' => $DB['db'])); } $_SESSION['sql_sd'] = $arr; } return @sel($arr, 'Database', $sel); }
function chset_select($sel = '') { global $DBDEF; $result = ''; if (isset($_SESSION['sql_chset'])) { $arr = $_SESSION['sql_chset']; } else { $arr = db_array("show character set", NULL, 1); if (!is_array($arr)) { $arr = array(array('Charset' => $DBDEF['chset'])); } $_SESSION['sql_chset'] = $arr; } return @sel($arr, 'Charset', $sel); }
/** * Verifica se o USUÁRIO está autenticado * * @name is_on * @return bool */ function is_on() { $login = str($_SESSION["login"]); $senha = str($_SESSION["senha"]); $sel = sel("usuarios", "usuario = '{$login}' and senha = '{$senha}'", "", ""); if (total($sel) == 0) { return false; } else { $ids = $_SESSION["idsession"]; $sel = sel("sessoes", "ids = '{$ids}' and usuario = '{$usuario} and senha = '{$senha}'", "", ""); if (total($sel) == 0) { return false; } else { return true; } } }