Whats the Php Code for Saving as .txt?

Discussion in 'PHP' started by Knight1234, May 23, 2008.

  1. #1
    As the title asks,
    Can any1 tell me the code for saving the Login Info as a Txt File?
    It should automatically create that file too.

    Thanks In Adv!! +Rep will be given.
     
    Knight1234, May 23, 2008 IP
  2. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <?PHP
    $fHandle=fopen("file.txt","w+");//Write...Ensure the file/dir has permissions
    fwrite($fHandle,'User:Pass\r\n');
    fclose($fHandle);
    ?>
    
    PHP:
    Not sure if thats you mean, but that writes a file.
     
    NatalicWolf, May 23, 2008 IP
  3. Chris_sRPG

    Chris_sRPG Peon

    Messages:
    186
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thats about right but dont have w+ just have w
     
    Chris_sRPG, May 24, 2008 IP
  4. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The W+ creates a file if it doesn't exist already, so. but if he is saving into a file, he wants a+. That will append.
     
    NatalicWolf, May 24, 2008 IP
  5. Knight1234

    Knight1234 Peon

    Messages:
    345
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hey, thanks +Rep, this was the 1 i wanted :D
     
    Knight1234, May 24, 2008 IP