www.webdeveloper.com
Results 1 to 3 of 3

Thread: password file

  1. #1
    Join Date
    Jul 2009
    Posts
    70

    Smile password file

    PHP Code:
    <?php
    $username
    =$_POST['username'];
    $password=$_POST['password'];

    $user[admin]="admin";
    $pass[admin]="pass";

    array_push($user$username);
    array_push($pass$username);

    $fileh=fopen("passwords.txt"'a');
    fwrite($filehprint_r($user));
    fwrite($filehprint_r($user));
    fclose($fileh);
    ?>
    Code:
    <form action="process.php" method="post">
    Username<input type="text" value="" name="username"><br>
    Password<input type="text" value="" name="password">
    <input type="submit" value="submit">
    </form>
    My problem is that the php code only returns a 1 to the password file and doesn't record the array.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,408
    I suspect you do not want the print_r() within your fwrite() calls (just the variable name, instead). If you do want to use print_r() for some reason, then you'll need to set its optional 2nd parameter to true.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2009
    Posts
    70
    thanks that worked i wanted text file to show the full array layout so i used print_r()

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles