Пример #1
0
function fs_botlist_import($file, $remove_existing)
{
    $lines = @file($file);
    if ($lines === false) {
        return sprintf(fs_r('Error opening file : %s'), "<b>{$file}</b>");
    }
    return fs_botlist_import_array($lines, $remove_existing);
}
Пример #2
0
} else {
    if (!is_uploaded_file($_FILES['bots_list']['tmp_name'])) {
        echo "<span class='error'>Possible file upload attack</span><br/>";
        return;
    }
    $file = $_FILES['bots_list']['tmp_name'];
    $lines = file($file);
    if (trim($lines[0]) != '# FireStats bots list') {
        echo "<span class='notice'>" . fs_r('Incorrect file format') . "</span><br/>";
        echo "<a href='javascript:history.go(-1)'>Back</a>";
    } else {
        require_once dirname(__FILE__) . '/db-sql.php';
        $ok = true;
        $type = $_POST['import_type'];
        $remove_existing = $type == 'replace';
        $res = fs_botlist_import_array($lines, $remove_existing);
        if ($res != '') {
            echo "<span class='notice'>" . sprintf(fs_r('Error importing bots list : %s'), $res) . "</span><br/>";
            echo "<a href='javascript:history.go(-1)'>Back</a>";
        } else {
            echo fs_r("bots list imported successfully") . "<br/>";
            // update botlist and num excluded
            ?>
			<script language="javascript">
				window.close();
			</script>
			<?php 
        }
    }
}
?>