39 lines
		
	
	
		
			653 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			39 lines
		
	
	
		
			653 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#!/usr/bin/php
							 | 
						||
| 
								 | 
							
								<?
							 | 
						||
| 
								 | 
							
								set_include_path("../include");
							 | 
						||
| 
								 | 
							
								require("header.inc.php");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if (empty($argv[1])) {
							 | 
						||
| 
								 | 
							
									die("Usage: $argv[0] " . '$username $password' . "\n");
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$username = $argv[1];
							 | 
						||
| 
								 | 
							
								$password = $argv[2];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$docRoot = str_replace($_SERVER['SCRIPT_NAME'], '', __FILE__);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								echo $docRoot;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								echo "changing password for  user $username\n";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$passwordhash = password_hash($password,  PASSWORD_DEFAULT);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Zotero_DB::beginTransaction();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									$sql = "SET NAMES UTF8;";
							 | 
						||
| 
								 | 
							
									Zotero_DB::query($sql);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $sql = "UPDATE zotero_www.users SET password=? WHERE username=?";
							 | 
						||
| 
								 | 
							
								        Zotero_DB::query($sql, array($passwordhash,$username));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Zotero_DB::commit();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								?>
							 | 
						||
| 
								 | 
							
								
							 |