I'm trying to set up authentication on my server, however, I know little about Php.
I have a php file filled with users and passwords:
function getPassword( $user )
{
// the user/password database. For very small groups
// of users, you may just get away with expanding this
// array.
$passwords= array (
'user1' => 'password1',
'user2' => 'password2',
'user3' => 'password3',
'user4' => 'password4'
);
$password = $passwords[ $user ];
if ( NULL == $password )
return NULL;
Without manually editing the array of passwords, I want a php file to read in user inputs for usernames and passwords and append it to the array.
I have a vague idea of how this could work by looking up documentation:
<?php
function fwrite_stream($fp, $string) {
$fp = fopen('shit.php', 'w');
for ($written = 0; $written < strlen($string); $written += $fwrite) {
$fwrite = fwrite($fp, substr($string, $written));
if ($fwrite === false) {
return $written;
}
}
return $written;
fclose($fp);
}
?>
How do I tell this to write to the array?