/[dtapublic]/projs/dtats/trunk/projs/2018/20180707_cgi_web_tools/active/passwd/htpasswd_gen/index.php
ViewVC logotype

Diff of /projs/dtats/trunk/projs/2018/20180707_cgi_web_tools/active/passwd/htpasswd_gen/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 205 by dashley, Sun Jul 15 18:45:10 2018 UTC revision 206 by dashley, Sun Jul 15 19:48:41 2018 UTC
# Line 1  Line 1 
1  <?php  <?php
2  if (!$STDNWPSTYLE_INCLUDED)  require_once("style/std/stdwpstyle.inc");
3     {  //----------------------------------------------------------------------------------------------------
4     include("stdnwpstyle.inc");  //Copyright (c) 2003, 2018 David T. Ashley.
5     $STDNWPSTYLE_INCLUDED=1;  //
6     }  //Permission is hereby granted, free of charge, to any person obtaining a copy
7  ?>  //of this software and associated documentation files (the "Software"), to deal
8  <?php  //in the Software without restriction, including without limitation the rights
9  //********************************************************************************  //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  //Copyright (C) 2003 David T. Ashley  //copies of the Software, and to permit persons to whom the Software is
11  //********************************************************************************  //furnished to do so, subject to the following conditions:
12  //This program or source file is free software; you can redistribute it and/or  //
13  //modify it under the terms of the GNU General Public License as published by  //The above copyright notice and this permission notice shall be included in all
14  //the Free Software Foundation; either version 2 of the License, or (at your  //copies or substantial portions of the Software.
15  //option) any later version.  //
16  //  //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  //This program or source file is distributed in the hope that it will  //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  //be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  //GNU General Public License for more details.  //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  //  //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  //You may have received a copy of the GNU General Public License  //SOFTWARE.
23  //along with this program; if not, write to the Free Software  //----------------------------------------------------------------------------------------------------
 //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 //********************************************************************************  
24  //  //
25  function do_header(&$style)  function do_header(&$style)
26     {     {
27     $style->header_title("HTPASSWD-Style Hashed Password Generator",     $style->static_page_header_title_std("HTPASSWD-Style Hashed Password Generator",
28                            "<i>htpasswd</i>-Style Hashed Password Generator",                            "<i>htpasswd</i>-Style Hashed Password Generator",
29                            "");                            "");
30     echo "<p align=\"center\"><b><font size=\"3\">(This cgi-bin form generates password hashes which are \n";     echo "<p align=\"center\"><b><font size=\"3\">(This cgi-bin form generates password hashes which are \n";
# Line 36  function do_header(&$style) Line 34  function do_header(&$style)
34     echo "randomly selected two-character salt. &nbsp;To use this password hash generator, \n";     echo "randomly selected two-character salt. &nbsp;To use this password hash generator, \n";
35     echo "you must normally paste the output into an <i>Apache</i> directory access file or into \n";     echo "you must normally paste the output into an <i>Apache</i> directory access file or into \n";
36     echo "the <i>CVSROOT/passwd</i> file of a <i>CVS</i> repository.)</font></b></p>\n";     echo "the <i>CVSROOT/passwd</i> file of a <i>CVS</i> repository.)</font></b></p>\n";
37     $style->hrule_std();       $style->static_page_hrule_std();  
38     echo "<p align=\"center\"><font size=\"3\" color=\"#FF0000\"><b>WARNING:</b>&nbsp; The username and ";     echo "<p align=\"center\"><font size=\"3\" color=\"#FF0000\"><b>WARNING:</b>&nbsp; The username and ";
39     echo "password you choose are ";     echo "password you choose are ";
40     echo "transmitted over the network to the server unencrypted and can be intercepted.&nbsp; ";     echo "transmitted over the network to the server unencrypted and can be intercepted.&nbsp; ";
41     echo "Use this utility ";     echo "Use this utility ";
42     echo "at your own risk.</font></p>\n";     echo "at your own risk.</font></p>\n";
43     $style->hrule_std();       $style->static_page_hrule_std();  
44     }       }  
45    
46  function do_footer(&$style)  function do_footer(&$style)
47     {     {
48     $style->footer_std();     $style->static_page_footer_std();
49     }     }
50    
51  function do_form($Buttontext)  function do_form($Buttontext)
52     {     {
53     echo "<form method=post action=\"htpasswd_gen.php\" width=\"100%\">\n";     echo "<form method=post action=\"index.php\" width=\"100%\">\n";
54     echo "<table align=\"center\">\n";     echo "<table align=\"center\">\n";
55     echo "<tr>\n";     echo "<tr>\n";
56     echo "  <td width=\"10%\">\n";     echo "  <td width=\"10%\">\n";
# Line 94  function random_salt() Line 92  function random_salt()
92  //Main script begins here.  //Main script begins here.
93  //  //
94  //  //
95  $style = new Stdnwpstyle;  $style = new StdWpStyle;
96  //Assign the current style in force.  Also, starts the CPU  //Assign the current style in force.  Also, starts the CPU
97  //usage clock.  //usage clock.
98    
99  //Do the header unconditionally.  The header is always used on this page.  //Do the header unconditionally.  The header is always used on this page.
100  do_header($style);  do_header($style);
101  //  //
102    if (isset($_POST['Username']))
103       $Username = $_POST['Username'];
104    //
105    if (isset($_POST['Password']))
106       $Password = $_POST['Password'];
107    
108  //Load up a few variables based on what username and password values were supplied.  //Load up a few variables based on what username and password values were supplied.
109  if (isset($Username) && isset($Password))  if (isset($Username) && isset($Password))
110     {     {
# Line 169  elseif ($Passwordlen < 2 || !$Passwordva Line 173  elseif ($Passwordlen < 2 || !$Passwordva
173     {     {
174     //The password is suspicious.  Must flag it.     //The password is suspicious.  Must flag it.
175     do_err_msg("The <i>Password</i> you supplied is not valid. &nbsp;Passwords must contain at least two characters and may consist only of lower-case and upper-case letters and digits and the \"/\" and \".\" characters. &nbsp;Please try again.");     do_err_msg("The <i>Password</i> you supplied is not valid. &nbsp;Passwords must contain at least two characters and may consist only of lower-case and upper-case letters and digits and the \"/\" and \".\" characters. &nbsp;Please try again.");
176     $style->hrule_std();       $style->static_page_hrule_std();  
177     do_form("Click To Generate Hashed Password");     do_form("Click To Generate Hashed Password");
178     }     }
179  else  else
# Line 187  else Line 191  else
191     echo "character or other punctuation appears as the last character(s) of the hash above, \n";     echo "character or other punctuation appears as the last character(s) of the hash above, \n";
192     echo "it <i>is</i> part of the hash and \n";     echo "it <i>is</i> part of the hash and \n";
193     echo "must be included when copying and pasting.</p>\n";     echo "must be included when copying and pasting.</p>\n";
194     $style->hrule_std();       $style->static_page_hrule_std();  
195     do_form("Click To Generate Another Hashed Password");     do_form("Click To Generate Another Hashed Password");
196     }     }
197    

Legend:
Removed from v.205  
changed lines
  Added in v.206

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25