It would be something like this

Code: PHP
<?
$username = $_SESSION['usr'];
$pwd = $_SESSION['pwd'];

$h = fopen("userdata.txt");
fwrite($h,"$username\n$pwd\n\n");
fclose($h);
?>