add_user 564 B

1234567891011121314151617181920212223
  1. #!/usr/bin/php
  2. <?
  3. set_include_path("../include");
  4. require("header.inc.php");
  5. if (empty($argv[1]) || empty($argv[2]) || empty($argv[3])) {
  6. die("Usage: $argv[0] " . '$userID $username $password' . "\n");
  7. }
  8. $userID = $argv[1];
  9. $username = $argv[2];
  10. $password = $argv[3];
  11. $salt = Z_CONFIG::$AUTH_SALT;
  12. echo "Adding new user $username with ID $userID\n";
  13. Zotero_Users::add($userID, $username);
  14. $hash = SHA1($salt . $password);
  15. echo "$salt . $password $hash\n";
  16. $sql = "update users set password=? where userid=?";
  17. Zotero_DB::query($sql, array($hash, $userID));
  18. ?>