Jump to content

need to convert passwords/userrnames into format my php script can use


XODAVEOX

Recommended Posts

: I have a newspaper website I'm developing. We have thousands of subscribers and a piece of circulation software that can give us tables of names and numbers we can use for usernames and passwords. I have a simple security script I found online that wants me to format my usernames and passwords like this:

: $LOGIN_INFORMATION = array(
:  'zubrag' => 'root',
:  'test' => 'testpass',
:  'admin' => 'passwd'
: );

: Is there a way I can take a chunk of names and passwords and use a program to make it format them properly? A program that can be defined to take the first word and put the ' on either side, add a space, add the =>, add another space, etc.?
: Anything you can do to help me would be most appreciated. I'm in the dark here. I need someone to point me in the right direction.
Link to comment
Share on other sites

You mean open up the dbase of names and then read them into an array in that format?

Assuming that you have read the dbase of names probly from a file into an array $dbase.

[code]
$array="";
$i=0;
foreach($dbase as $word){
  if($i<2){$i++;}
  else{$i=0;}
  if($i=0){ $text="\`".$word."\` => \`root\`,";
  if($i=1){ $text="\`".$word."\` => \`testpass\`,";
  if($i=2){ $text="\`".$word."\` => \`passwd\`";
  $array=$array.$text;
}

$login_information = array($array);
[/code]

Not sure if that is what you mean, or if it will even work.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.