Write to a text file.

Started by MrLeN, August 11, 2012, 11:00:46 AM

Previous topic - Next topic

MrLeN

If someone updates their profile on my SMF 2.0.2, how can I have the password written to a text file?

Well, I know how to write to a text file, (with fwrite)..

..but, specifically, if I write some code to be called when someone submits the profile page (to change the password), where can I place that code?

the code I will make will be something like:


$myFile = "user.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $_SESSION['forum_password'];
fwrite($fh, $stringData);
fclose($fh);


I know someone is going to say: "MAN, THAT'S DODGY! WHY DO YOU WANT TO DO {{{THAT}}}FOR????".

It's a long story, and I don't think anyone would be satisfied with any version of my answer, but in short (for the curious), it has something to do with impregnating a separate database with the same password for the same username :)

If it's any consolation (to the pedantic), the file will be deleted, immediately after I have accessed it, for what I want to access it for.

I just need to know where I can put that code for it to be called (and what the specific session call is for the users password).

Advertisement: