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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.