<?php
session_start();
session_destroy(); // Destroy the current session

$file = 'remote_data.txt';

// Reset the file with a header line to maintain structure
if (file_exists($file)) {
    file_put_contents($file, "user_id\ttimestamp\tname\tphone\twhatsapp\temail\taddress\tstate\tgender\tpackage\tsource\tsent_to_google\n");
    echo "All data has been cleared, and the session has been reset.";
} else {
    echo "File not found.";
}

// Redirect back to view_remote.php after 1 second
header("Refresh:1; url=view_remote.php");
exit();
?>
