| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * SAMS (Squid Account Management System) |
|---|
| 4 | * Author: Dmitry Chemerik chemerik@mail.ru |
|---|
| 5 | * (see the file 'main.php' for license details) |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | function ChUserPasswd() |
|---|
| 9 | { |
|---|
| 10 | global $SAMSConf; |
|---|
| 11 | global $USERConf; |
|---|
| 12 | global $SquidUSERConf; |
|---|
| 13 | |
|---|
| 14 | if(isset($_GET["id"])) $id=$_GET["id"]; |
|---|
| 15 | $SquidUSERConf=new SAMSUSER(); |
|---|
| 16 | $SquidUSERConf->sams_user($id); |
|---|
| 17 | |
|---|
| 18 | if($USERConf->ToWebInterfaceAccess("AUC")==1 || ($USERConf->s_user_id == $SquidUSERConf->s_user_id && $USERConf->ToWebInterfaceAccess("W")==1 ) ) |
|---|
| 19 | { |
|---|
| 20 | $DB=new SAMSDB(&$SAMSConf); |
|---|
| 21 | |
|---|
| 22 | $lang="./lang/lang.$SAMSConf->LANG"; |
|---|
| 23 | require($lang); |
|---|
| 24 | |
|---|
| 25 | if(isset($_GET["passw1"])) $newpasswd=$_GET["passw1"]; |
|---|
| 26 | |
|---|
| 27 | PageTop("userpasswd_48.jpg"," $userbuttom_6_chpasswd_ChUserPasswd_1 <BR><FONT COLOR=\"BLUE\">$SquidUSERConf->s_nick</FONT>"); |
|---|
| 28 | $passwd=crypt($newpasswd, substr($newpasswd, 0, 2)); |
|---|
| 29 | $num_rows=$DB->samsdb_query("UPDATE squiduser SET s_passwd='$passwd' WHERE s_user_id='$SquidUSERConf->s_user_id'"); |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | function ChUserPasswdForm() |
|---|
| 34 | { |
|---|
| 35 | global $SAMSConf; |
|---|
| 36 | global $USERConf; |
|---|
| 37 | global $SquidUSERConf; |
|---|
| 38 | |
|---|
| 39 | $lang="./lang/lang.$SAMSConf->LANG"; |
|---|
| 40 | require($lang); |
|---|
| 41 | |
|---|
| 42 | if(isset($_GET["id"])) $id=$_GET["id"]; |
|---|
| 43 | $SquidUSERConf=new SAMSUSER(); |
|---|
| 44 | $SquidUSERConf->sams_user($id); |
|---|
| 45 | |
|---|
| 46 | if($USERConf->ToWebInterfaceAccess("AUC")==1 || ($USERConf->s_user_id == $SquidUSERConf->s_user_id && $USERConf->ToWebInterfaceAccess("W")==1 ) ) |
|---|
| 47 | { |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | PageTop("userpasswd_48.jpg","$userbuttom_6_chpasswd_ChUserPasswdForm_1 <FONT COLOR=\"BLUE\">$SquidUSERConf->s_nick</FONT>"); |
|---|
| 51 | |
|---|
| 52 | print("<P>\n"); |
|---|
| 53 | print("<SCRIPT language=JAVASCRIPT>\n"); |
|---|
| 54 | print("function TestUserData(formname)\n"); |
|---|
| 55 | print("{\n"); |
|---|
| 56 | print(" var passw1=formname.passw1.value; \n"); |
|---|
| 57 | print(" var passw2=formname.passw2.value; \n"); |
|---|
| 58 | print(" var res=0;\n"); |
|---|
| 59 | print(" if(passw1.length!=passw2.length) \n"); |
|---|
| 60 | print(" {\n"); |
|---|
| 61 | print(" window.confirm(\"$adminbuttom_4_chpasswd_ChangeAdminPasswdForm_4\");\n"); |
|---|
| 62 | print(" res=1;\n"); |
|---|
| 63 | print(" }\n"); |
|---|
| 64 | print(" else\n"); |
|---|
| 65 | print(" {\n"); |
|---|
| 66 | print(" for(var i=0; i < passw1.length; i +=1 ) \n"); |
|---|
| 67 | print(" {\n"); |
|---|
| 68 | print(" if(passw1.charAt(i)!=passw2.charAt(i)) \n"); |
|---|
| 69 | print(" {\n"); |
|---|
| 70 | print(" window.confirm(\"$adminbuttom_4_chpasswd_ChangeAdminPasswdForm_5\");\n"); |
|---|
| 71 | print(" res=1;\n"); |
|---|
| 72 | print(" break;\n"); |
|---|
| 73 | print(" }\n"); |
|---|
| 74 | print(" }\n"); |
|---|
| 75 | print(" }\n"); |
|---|
| 76 | print(" if(res==0) \n"); |
|---|
| 77 | print(" this.document.forms[\"form1\"].submit();\n"); |
|---|
| 78 | print("}\n"); |
|---|
| 79 | print("</SCRIPT> \n"); |
|---|
| 80 | |
|---|
| 81 | print("<FORM NAME=\"form1\" ACTION=\"main.php\">\n"); |
|---|
| 82 | print("<INPUT TYPE=\"HIDDEN\" NAME=\"show\" value=\"exe\">\n"); |
|---|
| 83 | print("<INPUT TYPE=\"HIDDEN\" NAME=\"function\" value=\"chuserpasswd\">\n"); |
|---|
| 84 | print("<INPUT TYPE=\"HIDDEN\" NAME=\"filename\" value=\"userbuttom_6_chpasswd.php\">\n"); |
|---|
| 85 | print("<INPUT TYPE=\"HIDDEN\" NAME=\"id\" value=\"$SquidUSERConf->s_user_id\">\n"); |
|---|
| 86 | print("<TABLE WIDTH=\"90%\">"); |
|---|
| 87 | print("<TR><TD><B>login:</B><TD>"); |
|---|
| 88 | print("$USERConf->s_nick"); |
|---|
| 89 | print("<TR><TD><B>Password:</B><TD>"); |
|---|
| 90 | print("<BR><INPUT TYPE=\"PASSWORD\" NAME=\"passw1\" SIZE=30> \n"); |
|---|
| 91 | print("<TR><TD><B>Retype:</B><TD>"); |
|---|
| 92 | print("<BR><INPUT TYPE=\"PASSWORD\" NAME=\"passw2\" SIZE=30> \n"); |
|---|
| 93 | print("<BR><INPUT TYPE=\"BUTTON\" value=\"$adminbuttom_4_chpasswd_ChangeAdminPasswdForm_2\" onclick=TestUserData(form1)>\n"); |
|---|
| 94 | print("</FORM>\n"); |
|---|
| 95 | } |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | function userbuttom_6_chpasswd() |
|---|
| 100 | { |
|---|
| 101 | global $SAMSConf; |
|---|
| 102 | global $USERConf; |
|---|
| 103 | global $SquidUSERConf; |
|---|
| 104 | |
|---|
| 105 | $lang="./lang/lang.$SAMSConf->LANG"; |
|---|
| 106 | require($lang); |
|---|
| 107 | |
|---|
| 108 | if( $USERConf->ToWebInterfaceAccess("AUC")==1 || ($USERConf->s_user_id == $SquidUSERConf->s_user_id && $USERConf->ToWebInterfaceAccess("W")==1 )) |
|---|
| 109 | { |
|---|
| 110 | if(strtolower($USERConf->s_auth)=='adld' || strtolower($USERConf->s_auth)=='ldap') |
|---|
| 111 | return(0); |
|---|
| 112 | GraphButton("main.php?show=exe&function=chuserpasswdform&filename=userbuttom_6_chpasswd.php&id=$SquidUSERConf->s_user_id","basefrm","userpasswd_32.jpg","userpasswd_48.jpg"," $userbuttom_6_chpasswd_userbuttom_6_chpasswd_1"); |
|---|
| 113 | } |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | ?> |
|---|