时间:2021-07-01 10:21:17 帮助过:18人阅读
#输入以下内容:
Alias /svntools "/var/www/svn/svntools"Require valid-user AuthType Basic AuthName "svn tools" AuthUserFile "/var/www/svn/project/conf/passwd"
#创建修改密码的php脚本$username = $_SERVER["PHP_AUTH_USER"]; //经过 AuthType Basic 认证的用户名$authed_pass = $_SERVER["PHP_AUTH_PW"]; //经过 AuthType Basic 认证的密码$input_oldpass = (isset($_REQUEST["oldpass"]) ? $_REQUEST["oldpass"] : ""); //从界面上输入的原密码$newpass = (isset($_REQUEST["newpass"]) ? $_REQUEST["newpass"] : ""); //界面上输入的新密码$repeatpass = (isset($_REQUEST["repeatpass"]) ? $_REQUEST["repeatpass"] : ""); //界面上输入的重复密码$action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : ""); //以hide方式提交到服务器的actionif($action!="modify"){$action = "view";}else if($authed_pass!=$input_oldpass){$action = "oldpasswrong";}else if(empty($newpass)){$action = "passempty";}else if($newpass!=$repeatpass){$action = "passnotsame";}else{$action = "modify";}?>Subversion 在线自助密码修改 //action=view 显示普通的输入信息if ($action == "view"){?>
}else if($action == "oldpasswrong"){$msg="原密码错误!";}else if($action == "passempty"){$msg="请输入新密码!";}else if($action == "passnotsame"){$msg="两次输入密码不一致,请重新输入!";}else{$passwdfile="/var/www/svn/project/conf/passwd";$command='"htpasswd" -b '.$passwdfile." ".$username." ".$newpass;system($command, $result);if($result==0){$msg="用户[".$username."]密码修改成功,请用新密码登陆.";}else{$msg="用户[".$username."]密码修改失败,返回值为".$result.",请和管理员联系!";}}if (isset($msg)){?>}?>
版权声明:本文为博主原创文章,未经博主允许不得转载。