jasmine214--love

          只有當你的內心總是充滿快樂、美好的愿望和寧靜時,你才能擁有強壯的體魄和明朗、快樂或者寧靜的面容。
          posts - 731, comments - 60, trackbacks - 0, articles - 0

          導航

          公告

          這里是我記錄學習與成長的地方,文章大多摘自網絡,如有不妥,作者可以跟我聯系,我會盡快刪除。
          <2011年1月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          常用鏈接

          留言簿(10)

          隨筆分類(920)

          隨筆檔案(724)

          收藏夾(15)

          Ajax

          JS

          VC++

          WLAN

          版本管理

          網管軟件

          項目管理

          高手成長

          最新隨筆

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          源代碼倉庫SVN用戶修改密碼PHP頁面

          添加 myadminphp

          svn

          ubuntu

          分類:Linux
          • 編輯apache2配置文件
          /etc/apache2/mods-enable/alias.conf

          增加以下內容

          Alias /svntools "/mnt/svndb/svntools"

          <Directory "/mnt/svndb/svntools">
          Require valid-user
          AuthType Basic
          AuthName "GridTeam`s subversion tools"
          AuthUserFile "/etc/subversion/passwd"
          </Directory>
          • 新建PHP頁面,保存svntools目錄下

          index.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方式提交到服務器的action

          if($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";
          }
          ?>

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=GBK">
          <title>Subversion 在線自助密碼修改</title>
          </head>
          <body>

          <?
          //action=view 顯示普通的輸入信息
          if ($action == "view"){
          ?>
          <script language = "javaScript">
          <!--
          function loginIn(myform)
          {
          var newpass=myform.newpass.value;
          var repeatpass=myform.repeatpass.value;

          if(newpass==""){
          alert("請輸入密碼!");
          return false;
          }

          if(repeatpass==""){
          alert("請重復輸入密碼!");
          return false;
          }

          if(newpass!=repeatpass){
          alert("兩次輸入密碼不一致,請重新輸入!");
          return false;
          }
          return true;
          }
          //-->
          </script>
          <style type="text/css">
          <!--
          table {
          border: 1px solid #CCCCCC;
          background-color: #f9f9f9;
          text-align: center;
          vertical-align: middle;
          font-size: 9pt;
          line-height: 15px;
          }
          th {
          font-weight: bold;
          line-height: 20px;
          border-top-width: 1px;
          border-right-width: 1px;
          border-bottom-width: 1px;
          border-left-width: 1px;
          border-bottom-style: solid;
          color: #333333;
          background-color: f6f6f6;
          }
          input{
          height: 18px;
          }
          .button {
          height: 20px;
          }

          -->
          </style>
          <br><br><br>
          <form method="post">
          <input type="hidden" name="action" value="modify"/>
          <table width="220" cellpadding="3" cellspacing="8" align="center">
          <tr>
          <th colspan=2>Subversion 密碼修改</th>
          </tr>
          <tr>
          <td>用戶名:</td>
          <td align="left"> <?=$username?></td>
          </tr>
          <tr>
          <td>原密碼:</td>
          <td><input type=password size=12 name=oldpass></td>
          </tr>
          <tr>
          <td>用戶密碼:</td>
          <td><input type=password size=12 name=newpass></td>
          </tr>
          <tr>
          <td>確認密碼:</td>
          <td><input type=password size=12 name=repeatpass></td>
          </tr>
          <tr>
          <td colspan=2>
          <input onclick="return loginIn(this.form)" class="button" type=submit value="修 改">
          <input name="reset" type=reset class="button" value="取 消">
          </td>
          </tr>
          </table>
          </form>
          <?
          }
          else if($action == "oldpasswrong"){
          $msg="原密碼錯誤!";
          }
          else if($action == "passempty"){
          $msg="請輸入新密碼!";
          }
          else if($action == "passnotsame"){
          $msg="兩次輸入密碼不一致,請重新輸入!";
          }
          else{
          $passwdfile="/etc/subversion/passwd";
          $command='"htpasswd" -b '.$passwdfile." ".$username." ".$newpass;
          system($command, $result);
          if($result==0){
          $msg="用戶[".$username."]密碼修改成功,請用新密碼登陸.";
          }
          else{
          $msg="用戶[".$username."]密碼修改失敗,返回值為".$result.",請和管理員聯系!";
          }
          }

          if (isset($msg)){
          ?>
          <script language="javaScript">
          <!--
          alert("<?=$msg?>");
          window.location.href="<?=$_SERVER["PHP_SELF"]?>"
          //-->
          </script>
          <?
          }
          ?>
          </body>
          </html>

          原文:http://hi.baidu.com/ggb98/blog/item/a09b7683463399ae0df4d225.html

          主站蜘蛛池模板: 沛县| 容城县| 霍林郭勒市| 安泽县| 综艺| 南靖县| 美姑县| 大兴区| 苍南县| 邓州市| 镇安县| 贵南县| 马鞍山市| 开远市| 拉孜县| 英超| 康定县| 宜都市| 揭西县| 枞阳县| 旬阳县| 垦利县| 栖霞市| 外汇| 罗甸县| 老河口市| 宁乡县| 高淳县| 呈贡县| 双牌县| 黎城县| 泌阳县| 锡林郭勒盟| 渭源县| 通化县| 双牌县| 祁东县| 彝良县| 台江县| 苏尼特右旗| 肥城市|