• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

output every session in separate text file

Hi experts,

I need to save every session's data submitted by a form in separate text files. This is what i'm using now to save it in the same file:

$fp = fopen("data.txt","a");
fputs($fp, $data);
fclose($fp);

Please help.
0
gloriaewold41
Asked:
gloriaewold41
1 Solution
 
gr8gonzoConsultantCommented:
Try changing:
$fp = fopen("data.txt","a");
to:
$fp = fopen("data-".session_id().".txt","a");
0
 
gloriaewold41Author Commented:
It works. Thanks.
0
 
Julian HansenCommented:
Alternatively you can do it in one line like this

file_put_contents('session-' . session_id() . '.txt', $data);

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now