📄 edit_psd.php
字号:
<?session_start();require "fun.php";require "config.php";require "header.php";?><!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>修改我的密码--<?=$sys_site_name?></title><style type="text/css"><!--body { margin-left: 70px; margin-top: 30px;}--></style><link href="images/css.css" rel="stylesheet" type="text/css" /></head><body><?if($_SESSION['login_status']=="common1"){ if (empty($action)) { $user_name=$_SESSION['username']; echo "欢迎您,{$user_name}。修改密码请继续:";print <<<EOT <form id="edit_psd" name="edit_psd" method="post" action="edit_psd.php?action=edit"> <p>原密码: <input name="old_psd" type="password" id="old_psd" /></p> <p>新密码: <input name="new_psd" type="password" id="new_psd" /></p> <p>重复新密码: <input name="re_new_psd" type="password" id="re_new_psd" /><input name="user_name" type="hidden" id="user_name" value="$user_name"/> </p> <p> <input type="submit" name="Submit" value="提交" /> </p></form>EOT; } elseif($action=="edit") { $user_name=$_POST['user_name']; $new_psd=$_POST['new_psd']; $old_psd=$_POST['old_psd']; $re_new_psd=$_POST['re_new_psd']; if ($new_psd!==$re_new_psd) { echo "新密码两次输入不一致,请重新输入,<a href=edit_psd.php>点这里返回</a>"; exit;//两次密码输入不一致的时候一定要停止运行程序 } if(file_exists("$sys_data_dir/user/$user_name.php")) { $my_data=file("$sys_data_dir/user/$user_name.php"); } $my_info=explode("|",$my_data[0]); if (md5($old_psd)!==$my_info[1]) { echo "原密码是输入错误!请重新输入,<a href=edit_psd.php>点这里返回</a>"; } else { $psd=md5($new_psd); $new_data="$my_info[0]|$psd|$my_info[2]|$my_info[3]|$my_info[4]|\n"; writeto("$sys_data_dir/user/$user_name.php",$new_data); echo "修改完成!<a href=index.php>返回首页</a>"; } }}else{ echo "您还没有登录,请您先登录,<a href=login.php>点这里进入登录页面</a>";}?></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -