www.gusucode.com > 仿51.com的php源码 1.1 > User/MyPassword.php
<?php include("CheckLogined.php"); //MD5加密 require_once "../share.php"; include("../include/dbclass.php"); $db=new DbConn(); include "functions.php"; $function=new functions(); include "user.php"; $globalvars->set_vars(); $user_dat = $user->process_user($globalvars); if ($_GET["action"]=="edit") { $User_OldPassword=$_POST["User_OldPassword"]; $User_Password=$_POST["User_Password"]; //md5加密 $Md5_User_OldPassword=md5_5($User_OldPassword); $Md5_User_Password=md5_5($User_Password); $Md5_User_OldPassword=$User_OldPassword; $Md5_User_Password=$User_Password; $uid=$_COOKIE["uid"]; $old_sql="select User_Password from userdata where User_Account='$uid'"; $arr=$db->getRs($old_sql); if($arr['User_Password']==$Md5_User_OldPassword) { $sql="update userdata set User_Password='$Md5_User_Password' where User_Account='$uid'"; $db->Execute($sql); echo "<script>alert('新密码修改成功!');location.href='Main.php';</script>"; } else { echo "<script>alert('旧密码不正确!');location.href='MyPassword.php';</script>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>村委会档案管理中心--设置密码</title> <link href="../images/User_Main.css" rel="stylesheet" type="text/css" /> <script> try{ if(top!=window){ document.domain ="www.wu-liao.com"; }else{ top.location.href="/webin.php?refer=%2FUser%2FMyPassword.php"; } }catch(e){} function showNewMessage(user){ top.showNewMessage(user); } </script> <script> function checkPass() { self.event.returnValue=false; if(document.all("User_OldPassword").value.length<6) { alert("旧密码至少要6位!"); document.all("User_OldPassword").focus(); return; } if(document.all("User_Password").value.length<6) { alert("新密码至少要6位!"); document.all("User_Password").focus(); return; } if(document.all("User_Password").value!=document.all("User_RePassword").value) { alert("密码两次输入的不一致,请重新输入!"); document.all("User_Password").focus(); return } if(document.all("User_OldPassword").value.length<=0) { alert("修改成功!"); return; } form2.submit(); } </script> </head> <body> <div id="top"> <div id="top"> <div id="logo"><a href="Main.php"></a></div> <div id="topr"> <div id="exit"><a href="http://www.wu-liao.com/" target="_top">网站首页</a><!--| <a href="/User/Online.php">在线列表</a> | <a href="http://bbs.51.com/gourl.php?refer=/index.html" target=_blank>论坛</a> | <a href="http://qun.51.com/gourl.php?refer=/index.php" style="color:#0000cc;text-decoration: underline;">群组</a> --><?php if($_COOKIE["uid"] !=""){?> | <a href="http://www.wu-liao.com/home.php?user=<?php echo $_COOKIE["uid"]; ?>" target="_blank" style="color:#0000cc;text-decoration: underline;" id="myhomepage">我的主页</a> | <a href="../User/Logout.php" target="_top">安全退出</a></div><?php } ?> <div id="menu"> <div class="m2"> <div class="mg"><a href="Main.php">用户管理中心</a></div> <div class="mh"><a href="../Diary/DiaryList.php">日记文集</a></div> <div class="ma"><a href="../Photo/PhotoList.php">相册</a></div> <div class="ma"><a href="../Image/ImageList.php">图库</a></div> <div class="mb"><a href="../Music/MusicList.php">音乐</a></div> <div class="mc"><div id="ms"><a href="../Memo/MemoList.php"><img src="../images/suo2.gif" width="10" height="12" /> 秘密记事本</a></div> </div> <div class="me"><a href="../Fav/FavList.php">网址收藏夹</a></div> <div class="mf"><a href="../Addr/AddrList.php">通讯录</a></div> </div> </div> </div> <div id="nav"> <div id="navt"></div> </div> <div id="mjx"></div> <div id="main"> <div id="left"> <div class="leme"> <div class="imxle"><a href="MyPersonalInfo.php">个人资料设置</a></div><div class="imxle"><a href="MyHomepageTemplate.php">个人主页设置</a></div><div class="imxle"><a href="MyAccessRight.php">高级权限设置</a></div> <div class="pawo"><!-- <a href="http://pay.51.com" target=_blank>支付中心</a>--><br /><a href="MyPassword.php">密码设置</a></div> <div id=IdMyQun> </div> <!-- 广告 --> <!-- XML 文件读取失败! --><!-- XML 文件读取失败! --> <div style="margin-top:20px;"></div> </div> </div> <div id="right"> <div id="a4n"> <div class="anphg"> <div class="a4"id="l">修改密码</div> <!-- <div class="a4"><a href="/User/MySecondPassword.php">设置二级密码</a></div> <div class="a4"><a href="/UserPasswd/PasswdApp.php">设置密码保护</a></div> --> </div> </div> <div id="fenle"> <form name="form2" action="?action=edit" method="post" onsubmit="checkPass()"> <table width="570" border="0" cellpadding="5" cellspacing="0" class="teb"> <tr> <td width="110" height="20" align="right">用户名:</td> <td align="left"><?php echo $user_dat['name']; ?></td> </tr> <tr> <td height="20" align="right">旧密码:</td> <td align="left"> <input name="User_OldPassword" type="password" size="15" /> </td> </tr> <tr> <td height="20" align="right">新密码:</td> <td align="left"> <input name="User_Password" type="password" size="15" /> </td> </tr> <tr> <td height="20" align="right">确认新密码:</td> <td align="left"> <input name="User_RePassword" type="password" size="15" /> </td> </tr> <tr> <td height="180" colspan="2" align="center" valign="top"> <input name="Submit2" type="submit" class="btn" value="修 改" /> </td> </tr> </table> </form> </div> </div> </div><div id="bottom"> <div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div> </div> </body> </html>