Results 1 to 3 of 3

Thread: Random username and password from CSV file

  1. #1
    Join Date
    Feb 2010
    Posts
    25
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Random username and password from CSV file

    Dear all,
    Can somebody help me please?
    Instead of ‘username’ and 'password', I need random values from CSV file.
    Can somebody show me how can I do this?

    My CSV file looks like this:

    user001,userpass001
    user002,userpass002
    user003,userpass003

    My script looks like this:

    <?php
    $t= new post();
    $t->username='username';
    $t->password='password';
    $res = $t->update('This is some text.');
    ?>

    Thank you very much advance.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you have many names (more than 100), it may run slowly. If you have thousands of names, it may run very slowly.

    Here's some code to help:
    PHP Code:
    $users file('path/to/myfile.txt');
    $user array_rand($users);
    $user explode(',',$user,1);
    $password $user[1];
    $username $user[0]; 
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    young_coder (08-15-2010)

  4. #3
    Join Date
    Feb 2010
    Posts
    25
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Smile

    Thank you djr33

Bookmarks

Posting Permissions

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