130 lines
3.7 KiB
Bash
Executable File
130 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
while read kos
|
|
do
|
|
[ "${#kos}" -le "1" ]&&break;
|
|
koss="$kos
|
|
$koss"
|
|
done
|
|
|
|
ck=($(echo "$koss"|awk -F'[|:]' '{IGNORECASE=1}$1=="Cookie"{print $3}'))
|
|
sqlstart="SELECT passd,grups,isok,feilv,ckuser,ckname,ckkey,tixian,shouyi FROM user WHERE userid = '${ck[2]}'"
|
|
dada="$($MYSQLS -e "$sqlstart" 2>>$0.errlog)"
|
|
sdata=($dada)
|
|
cksec=${ck[4]}
|
|
yunse=$(echo -n "$REMOTE_HOST${sdata[2]}${sdata[1]}${ck[2]}${sdata[0]}${dateddd:0:6}"|md5sum|tr -dc [0-9])
|
|
|
|
[ "$yunse" = "$cksec" ]||{
|
|
echo "HTTP/1.1 302 Moved temporarily
|
|
Connection: close
|
|
Pragma: no-cache
|
|
Cache-Control: no-cache
|
|
Cache-Control: no-store
|
|
Cache-Control: private
|
|
Server: kos-1.0
|
|
Content-Type: text/html;charset=utf-8
|
|
Location: login.xhtml
|
|
"
|
|
exit 0
|
|
}
|
|
|
|
echo "HTTP/1.1 200 ok
|
|
Connection: close
|
|
Pragma: no-cache
|
|
Cache-Control: no-cache
|
|
Cache-Control: no-store
|
|
Cache-Control: private
|
|
Server: kos-1.0
|
|
Content-Language:zh-CN,zh
|
|
Content-Type: text/html;charset=utf-8
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<center>
|
|
<head>
|
|
<script type=\"text/javascript\">
|
|
var ckname='${sdata[5]}';
|
|
var tixian='${sdata[7]}';
|
|
var shouyi='${sdata[8]}';
|
|
var ifeilv='${sdata[3]}';
|
|
</script>
|
|
<title>密码修改$titles</title>
|
|
$(cat $rpath/www/man 2>/dev/null)
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<form onSubmit=\"btok();return false\" id=\"dld-msg\">
|
|
<table>
|
|
<tr>
|
|
<td>原密码</td>
|
|
<td>
|
|
<input placeholder=\"旧密码\" type=\"password\" required=\"required\" minlength=\"6\" maxlength=\"16\" autocomplete=\"off\" id=\"oldpasd\" />
|
|
<td>
|
|
</tr>
|
|
<tr>
|
|
<td>新密码</td>
|
|
<td>
|
|
<input placeholder=\"新密码\" type=\"password\" required=\"required\" minlength=\"6\" maxlength=\"16\" autocomplete=\"off\" id=\"newpasd\" />
|
|
<td>
|
|
</tr>
|
|
<tr>
|
|
<td>确认新密码</td>
|
|
<td>
|
|
<input placeholder=\"确认新密码\" type=\"password\" required=\"required\" minlength=\"6\" maxlength=\"16\" autocomplete=\"off\" id=\"newpasds\" />
|
|
<td>
|
|
</tr>
|
|
</table>
|
|
<input type=\"submit\" value=\"确认\" />
|
|
</form>
|
|
<script type=\"text/javascript\" src=\"base64.js\"></script>
|
|
<script type=\"text/javascript\">
|
|
document.getElementById('gerenzhongxin').style.color='#b63b4d';
|
|
document.getElementById('gerenzhongxin-xiugaimima').style.color='white';
|
|
document.getElementById('gerenzhongxin-xiugaimima').style.background='#b63b4d';
|
|
function btok() {
|
|
var b = new Base64();
|
|
var xmlhttp = new XMLHttpRequest();
|
|
var o=document.getElementById(\"oldpasd\");
|
|
var n=document.getElementById(\"newpasd\");
|
|
var s=document.getElementById(\"newpasds\");
|
|
if (o.value == \"\" || n.value == \"\" || s.value == \"\"){
|
|
alert(\"密码不能为空!\");
|
|
return;
|
|
}
|
|
if (n.value != s.value){
|
|
alert(\"两次新密码输入不一致\");
|
|
return;
|
|
}else if (n.value == o.value){
|
|
alert(\"新密码请勿与旧密码相同!\");
|
|
return;
|
|
}
|
|
xmlhttp.onreadystatechange = function () {
|
|
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
|
if(xmlhttp.responseText.replace(/\s+/g,\"\") == \"okay\"){
|
|
alert(\"密码修改成功!\");
|
|
window.location.href= document.location.href;
|
|
}else if (xmlhttp.responseText.replace(/\s+/g,\"\") == \"noes\"){
|
|
alert(\"登录失效,请重新登录!\");
|
|
window.location.href= \"login.xhtml\";
|
|
}else{
|
|
alert(\"验证失败:\n\"+xmlhttp.responseText);
|
|
o.value=\"\";
|
|
n.value=\"\";
|
|
s.value=\"\";
|
|
}
|
|
}else{
|
|
if (xmlhttp.readyState == 4 && xmlhttp.status != 200)
|
|
alert(\"网络错误!\"+xmlhttp.readyState+\"|\"+xmlhttp.status);
|
|
}
|
|
};
|
|
xmlhttp.open(\"POST\", \"paswd.xjs?xiugai\",false);
|
|
xmlhttp.send(b.encode(o.value)+\" \"+b.encode(s.value));
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</center>
|
|
|
|
</html>
|
|
" |