function get_view_from_mysql() { $masks = array(); $connection = new mysqlconnection(DB_SERVER, DB_USERNAME, DB_PASSWORD); $connection->useDB(DB_DB); $statement = "select `network`,`viewid` from `view_mask`"; $result = $connection->query($statement); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $ipaddr = trim($row[0]); $id = trim($row[1]); $masks[$ipaddr] = $id; } return $masks; }
function get_view_file() { $connection = new mysqlconnection(DB_SERVER, DB_USERNAME, DB_PASSWORD); $connection->useDB(DB_DB); $statement = "select `id`,`view_ip`,`view_action` from `view_index` where `status`='true'"; $result = $connection->query($statement); $output = ""; file_put_contents(INDEX_NEW_FILENAME, $output); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $output = sprintf("id:%s|view_ip:%s|view_action:%s|\n", $row[0], $row[1], $row[2]); file_put_contents(INDEX_NEW_FILENAME, $output, FILE_APPEND); //echo $output; } }
function get_view_from_mysql() { $views = array(); $view_ips = array(); $connection = new mysqlconnection(DB_SERVER, DB_USERNAME, DB_PASSWORD); $connection->useDB(DB_DB); $statement = "select `index_id`,`ip` from `view_index_ip` where `status`='true'"; $result = $connection->query($statement); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $view_ips[$row[0]][$row[1]] = 1; } $statement = "select `id` from `view_index` where `status`='true'"; $result = $connection->query($statement); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { if (isset($view_ips[$row[0]])) { $views[$row[0]] = $view_ips[$row[0]]; } else { $views[$row[0]] = array(); } } return $views; }