Reply to Re: Altering users passwords

Your name:

Reply:


Posted by 4site on 01/02/06 20:53

After a little research into proc_open and pipes, I've re-worked a
function written by 'mendoza', found in the online PHP Manual at
http://www.php.net/manual/en/function.proc-open.php.

With some judicious form data error checking, this actually works:

function authenticate($user,$old_password,$password) {
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file","/tmp/error-output.txt", "a")
);

$process = proc_open("passwd ".escapeshellarg($user), $descriptorspec,
$pipes);

if (is_resource($process)) {
fwrite($pipes[0], $old_password."\n");
fwrite($pipes[0], $password."\n");
fwrite($pipes[0], $password."\n");
fclose($pipes[0]);
fclose($pipes[1]);
$return_value = proc_close($process);
return !$return_value;
}
}

Thanks to Colin for pointing me in the right direction...

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация