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

📄 modifyemail.php

📁 邮箱加即时聊天
💻 PHP
字号:
  <? ob_start(); ?>
	
  <body background="../danse3.jpg">  
  <form action="modifyEmail.php" method="post">
    <center>

	<!--提示信息 begin-->
	<center><strong>修改保密邮箱<strong></center><br><br><br>
    <hr>
	<!--提示信息 end-->

	
	<!--内容 begin-->
	<table width=540 border=2 cellpadding=0 cellspacing=1 bgcolor="#0099FF">
	<tr><td bgcolor="#7dafdb">

	<br><br>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr><td align=right ><font color=red>*</font>请输入原密码:</td>
		<td align=left width="310"><input type="password" name="loginpassword" size="22" ><div id=loginname style="DISPLAY:none"></div></td></tr>
	</table>

	<br> 
	<?	
	     include realpath("../Sysconf.php");
		 $username=$_COOKIE["username"];
		 $sql="select * from user_base_information where user_name = '$username'";
		 $result=mysql_query($sql);
		 $user_id=mysql_result($result,0,"user_id");
		 
		 $sql="select email from user_extend_information where user_id = '$user_id'";
		 $result=mysql_query($sql);
		 
		 $a=mysql_num_rows($result);
		 
	     if($a ==1 ){
	?>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr><td align=right ><font color=red>*</font>请输入原保密邮箱:</td>
		<td align=left width="310"><input type="text" name="email" size="22" ><div id=loginname style="DISPLAY:none"></div></td></tr>
	</table><br>
	
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr><td align=right ><font color=red>*</font>请确认保密邮箱:</td>
		<td align=left width="310"><input type="text" name="cemail" size="22" ><div id=loginname style="DISPLAY:none"></div></td></tr>
	</table><br>
	
	<?  }else{ ?>
	
		  <table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr><td align=right ><font color=red>*</font>请输入新保密邮箱:</td>
		<td align=left width="310"><input type="text" name="email" size="22" ><div id=loginname style="DISPLAY:none"></div></td></tr>
	</table><br>
<? }?>

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr><td></td><td></td></tr>
		<tr><td width="100%" colspan=2 align=center><input type=submit name=submit value="提交修改"></td></tr>
	</table><br><br>
	</td>
	</tr>
	</table>
</center>
</form>
</body>
<?
	function showWrongMes($mes){
		echo "<script>alert('$mes')</script>";
		echo "<script>window.location.href='modifyEmail.php'</script>";
	}
	function showRightMes($mes){
		echo "<script>alert('$mes.')</script>";
		echo "<script>window.location.href='../safeCenter.php'</script>";
	}
    //include realpath("../../Sysconf.php");
	$pass=$_POST["loginpassword"];//获取修改邮箱的密码确认
	$username=$_COOKIE["username"];//获取当前用户名

	if($_POST["submit"]=="提交修改"){
		
		$email=$_POST["email"];
   		if($pass==""){
			echo "<script>alert('请输入原来的密码!')</script>";
			echo "<script>history.back()</script>";
		}elseif($email ==""){
			echo "<script>alert('请输入邮箱!')</script>";
			$pass="";
			echo "<script>history.back()</script>";
		}elseif($a==1){
		     $cemail=$_POST["cemail"];
			 if($cemail==""){
			 	echo "<script>alert('请输入邮箱!')</script>";
				$pass="";
				echo "<script>history.back()</script>";
			
			 }else{	
			
				$sql="select * from user_base_information where user_name = '$username' and password='$pass';";
				$result=mysql_query($sql);
	         
				if(mysql_fetch_row($result)){
				    $user_id=mysql_result($result,0,'user_id');
					$result=mysql_query("select * from user_extend_information 
										 where user_id='$user_id' and email='$email'");
					if(mysql_num_rows($result)==1){
						$sql="update user_extend_information 
					      	  set email = '$cemail' 
						  	  where user_id = '$user_id';";
						$resultUpdate=mysql_query($sql) or die("数据库中保密邮箱更新失败!");
						if(resultUpdate==true)
							showRightMes("保密邮箱更改成功...");
						}else
							showWrongMes("邮箱错误!");					
					
				}else
					showWrongMes("密码错误!");
			 }
		}elseif($a==0 ){
		
			$sql="select * from user_base_information where user_name = '$username' and password='$pass';";
			
			$result=mysql_query($sql);
			$b=mysql_num_rows($result);
			
			//在扩展信息的数据库没有相关的信息
			
			if($b==1){
			    $user_id=mysql_result($result,0,'user_id');
				$sqlA="select * 
				      from user_extend_information
					  where user_id = '$user_id';";
				$result1=mysql_query($sqlA);
				
				if(mysql_fetch_row($result1)==false){
					$sql="insert into user_extend_information(user_id,email)
						  values('$user_id','$email')";
					$result=mysql_query($sql) or die("数据库中保密邮箱更新失败1!");
					if($result==true)
						showRightMes("保密邮箱更改成功...");
				}
			}else
				showWrongMes("密码错误!");
		}
	}
?>

⌨️ 快捷键说明

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