⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 20-16.php

📁 php 和 ajax 开发的一些资料
💻 PHP
字号:
<?php
echo "<html>\n";								//输出标准HTML内容
echo "<head>\n";
echo "<title>\n";
echo "修改用户密码\n";
echo "</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<div class=\"Frame\">\n";
if(!$_GET[id])
{
  echo "<div class=\"title\">没有指定用户ID<p>点<a href=\"20-5.php\">这里</a>返回</div>";
}
else
{
  include "20-1.php";
  $sql="select * from $bbs_user where id='$_GET[id]' limit 1";
  $temp=mysql_fetch_array(mysql_query($sql,$my_conn));
  if($temp[name]!=$_COOKIE["user"])
	{
	  echo "<div class=\"title\">没有登录,或者身份不符<p>点<a href=\"20-5.php\">这里</a>返回</div>";
	  exit();
	}
	else
	{
		if(!$_POST[old_pass])
		{
			echo "
<script language=\"javascript\">
<!--
function Juge(theForm)
{
  if (theForm.old_pass.value == \"\")
  {
    alert(\"请输入原始密码!\");
    theForm.old_pass.focus();
    return (false);
  }
  if (theForm.new_pass.value == \"\")
  {
    alert(\"请输入新的密码!\");
    theForm.new_pass.focus();
    return (false);
  }
  if (theForm.new_pass.value !== theForm.re_pass.value)
  {
    alert(\"重复密码与新设密码不一置\");
    theForm.re_pass.focus();
    return (false);
  }
}
-->
</script>";
		  
          echo "<div class=\"title\">修改用户".$temp[nickname]."的密码</div>\n";
          echo "<div class=\"main\">&nbsp;</div>\n";
          echo "<div class=\"huifu\"><a href=\"20-5.php\">论坛首页</a>";
          if($temp["name"]==$_COOKIE["user"])   echo " <a href=\"20-14.php?id=".$_GET[id]."\">查看信息</a> <a href=\"20-15.php?id=".$_GET[id]."\">修改信息</a>";
          echo "</div>\n";
		  echo "<form action=\"".$_SERVER[PHP_SELF]."?id=".$_GET[id]."\" method=\"post\"  onsubmit=\"return Juge(this)\">\n";
          echo "<div class=\"title\">\n";
          echo "<table width=95%>\n";
          echo "<tr><td class=\"huifu\">原始密码:<input type=\"password\" name=\"old_pass\" class=\"input\"></td></tr>\n";
		  echo "<tr><td class=\"huifu\">修改密码:<input type=\"password\" name=\"new_pass\" class=\"input\"></td></tr>\n";
		  echo "<tr><td class=\"huifu\">重复密码:<input type=\"password\" name=\"re_pass\" class=\"input\"></td></tr>\n";
          echo "<tr><td class=\"huifu\"><input type=\"submit\" value=\"确认修改\"></td></tr>\n";
          echo "</table>\n";
          echo "</div>\n";
		  echo "</form>\n";
		}
		else
		{
			if($temp[pass]!=md5($_POST[old_pass]))
			{
				echo "<div class=\"title\">输入的原始密码不正确!<p>点<a href=\"20-16.php?id=".$_GET[id]."\">这里</a>返回</div>\n";
				exit();
			}
			else
			{
			  $sql="UPDATE $bbs_user set pass=md5('$_POST[new_pass]') where id='$_GET[id]'";
			  $result=mysql_query($sql,$my_conn);
			  if($result)
			  {
				  echo "<div class=\"title\">修改用户密码成功<p>点<a href=\"20-14.php?id=".$_GET[id]."\">这里</a>返回</div>";
			  }
			  else
			  {
				  echo "<div class=\"title\">修改用户密码失败<p>点<a href=\"20-14.php?id=".$_GET[id]."\">这里</a>返回</div>";
			  }
			}
		}
	}
}
echo "</div>\n";
echo "</doby>\n";
echo "</html>\n";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -