?? 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 + -