| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/themes/thevoux-wp/inc/ |
Upload File : |
<?php
function thb_csv_export() {
$download = isset($_GET['thb_download_emails']) ? $_GET['thb_download_emails'] : false;
if ($download && current_user_can( 'manage_options' ) ) {
$filename = 'thb_subcribed_emails_' . time(). '.csv';
// emails
$stack = get_option('subscribed_emails');
$fh = @fopen( 'php://output', 'w' );
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
header( 'Content-Description: File Transfer' );
header( 'Content-type: text/csv' );
header( "Content-Disposition: attachment; filename={$filename}" );
header( 'Expires: 0' );
header( 'Pragma: public' );
foreach ( $stack as $line ) {
$val = explode( ",",$line );
fputcsv( $fh, $val );
}
fclose( $fh );
die();
}
}
add_action( 'admin_init', 'thb_csv_export' );