12-03-2007, 08:20 PM
|
#11 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Just to offer up another approach (simply to show there are always other options available) here's one using the lovely function: fgetcsv
PHP Code:
<?php
$aUsername = array(); $aPassword = array(); $szDbFile = 'flatfile.txt';
if (is_readable($szDbFile)) { $pDb = fopen($szDbFile, 'r'); while (false !== ($aDbRow = fgetcsv($pDb, 100, '|'))) { if (isset($aDbRow[1])) { $aUsername[] = $aDbRow[0]; $aPassword[] = $aDbRow[1]; } } fclose($pDb); }
header('Content-Type: text/plain'); var_dump($aUsername, $aPassword);
There are drawbacks (and advantages) to using this approach, I'll leave discovering those as an exercise for the reader. :)
|
|
|
|