function page_cat($par, $tbname) { $p = explode("_", $par); //每页显示数量 $pagesize = $p[0]; //当前页数 $currenpage = $p[1]; //查询条件 $where = $p[2]; //获取总数 $totle = db_row_count($tbname, $where); //计算总页数 $pages = ceil($totle / $pagesize); //计算记录偏移量 $offset = $pagesize * ($currenpage - 1); //读取指定记录数 if ($where == "") { $sql = "SELECT * FROM {$tbname} "; } else { $sql = "SELECT * FROM {$tbname} where {$where} "; } if ($currenpage > $pages) { $sql = $sql . " limit 0,{$pagesize}"; } else { $sql = $sql . "limit {$offset},{$pagesize}"; } $db = array('cutpage' => $currenpage, 'totle' => $totle, 'pages' => $pages, 'pagesize' => $pagesize, 'where' => $where, 'sql' => $sql); return $db; }
header('Content-type: text/xml'); echo $ret; exit; } //TODO: V4 if ($action == "create_account") { $instance_name = POSTGET("instance_name"); $crawler_engine_id = POSTGET("engine_id"); $user_name = POSTGET("user_name"); $target_name = POSTGET("target_name"); $target_parameter = POSTGET("target_parameter"); $debug_msg = ""; $db = db_connect($config, "", "", ""); if ($db) { // l'engine existe-t-il ? if (db_row_count($db, "engines", "id = " . $crawler_engine_id) == 0) { $ret = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result>"; $ret .= "<status>ko</status></result>"; echo $ret; $debug_msg .= "Error engine doesn't exist [" . $crawler_engine_id . "]"; if ($debug) { print "</br>" . $debug_msg; } exit; } // Create account $stmt = new db_stmt_insert("accounts"); $stmt->addColumnValue("id_engine", intval($crawler_engine_id)); $stmt->addColumnValue("createtime", "", NOW); $stmt->addColumnValue("name", $instance_name, ""); $stmt->addColumnValue("enabled", "1", "");
function decrypt($value) { $crypt = new encryption_class(); return $crypt->decrypt("mysolrserver", $value); } $user_name = ""; $action = ""; if (isset($_POST["action"])) { $action = $_POST["action"]; if ($action == "login") { if ($user->login($config, $_POST["user_name"], $_POST["user_password"], encrypt($_POST["user_password"]), 'login')) { $count = 0; $db = db_connect($config, "", "", "", 'login'); if ($db) { $Where = "id_user = '******' and deleted = '0' and enabled = '1'"; $count = db_row_count($db, "instances", $Where); if ($count == 1) { db_get_value($db, "instances", "solr_url_root", $Where, $solr_core); if (!empty($solr_core)) { $_SESSION["core"] = $solr_core; header("Status: 301 Moved Permanently", false, 301); header("Location: index.php"); exit; } } } $action_message = "Login successful !"; } else { $action_message = "Login failed !"; $user_name = $_POST["user_name"]; }