#!/usr/local/bin/php -q [ password ] ]\n"); } function getpass() { if (! $f = fopen("php://stdin", "r")) die("error: can't open stdin???"); $pw = fgets($f, 8); return($pw); } if ($argc < 2 || $argc > 3) usage(); $username = $argv[1]; $password = $argv[2]; if (! $password) { echo "Enter a password: "; $password = chop(getpass()); } if (! $password) { die("error: No password was supplied\n"); } include "user.inc"; $user = new USER(); if (! $user->getpwnam($username)) { echo "error: User '$username' doesn't exist\n"; return(1); } if (! $user->changePassword($password, 0)) { echo "error: $user->error\n"; return(1); } ?>