2603.0 - First effort...

This commit is contained in:
2026-03-16 02:27:59 -04:00
parent c1b2c187e4
commit baed29d0fa
27 changed files with 2300 additions and 0 deletions

38
export.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
// output headers so that the file is downloaded rather than displayed
include('conn.php');
date_default_timezone_set("America/Montreal");
$datetime=date('Ymdhis');
header('Content-Type: text/csv; charset=utf-8');
if (isset($_POST['sql_find_b'])&&!empty($_POST['sql_find_b'])){
$sql_find=$_POST['sql_find_b'];
header("Content-Disposition: attachment; filename=ipban_blacklist_".$datetime.".csv");
}
elseif (isset($_POST['sql_find_w'])&&!empty($_POST['sql_find_w'])){
$sql_find=$_POST['sql_find_w'];
header("Content-Disposition: attachment; filename=ipban_whitelist_".$datetime.".csv");
}
else{
$_SESSION['ret_link']="index.php";
$_SESSION['rezult_msg']="There aren't any values available to export.";
header("location:index.php?var=2");
return false;
}
//echo $sql_find;
//exit;
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('IP','Type','Add Date','End Date','Reason','Type-Label'));
// fetch the data
$sql_rez = mysqli_query($con,$sql_find);
// loop over the rows, outputting them
while ($row = mysqli_fetch_assoc($sql_rez)) fputcsv($output, $row);
?>