php - 重置密码显示布局

标签 php html

这是我的重设密码页面代码。当我在没有任何样式的情况下尝试时,一切正常,但是当我集成到我的原始网页中时,没有任何显示。

<?php

require("../dbconnect.php"); ?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <title>ipv6 | Reset Password</title>
    </head>

    <body>

        <!-- Top content -->
        <div class="top-content">
        	
            <div class="inner-bg">
                <div class="container" >
                    <div class="row">
					<?php
					if (isset($_GET['code'])){
	$get_email=$_GET['email'];
	$get_code=$_GET['code'];
	
	$query=mysql_query("SELECT * FROM member WHERE email='$get_email'");
	
	while ($row=mysql_fetch_assoc($query))
	{
		$db_code = $row['pass_reset'];
		$db_email=$row['email'];
	}
	if ($get_email == $db_email && $get_code == $db_code)
	{
		echo "
		<form action ='pass_reset_complete.php?code=$get_code' method='POST'>
		PASSOWRD= <input type='password' name='newpwd'/><br>
		Confirm PASSOWRD= <input type='password' name='newpwd1'/><p>
		<input type= 'hidden' name='email' value='$db_email'/>
		
		
		</form>
		";
	}

 else
					echo "
                        <div class='col-sm-6 col-sm-offset-3 form-box'>
                        	<div class='form-top'>
                        		<div class='form-top-left'>
                        			<h3>Reset Password</h3>
									<hr>
                            		<p>Enter your email address and we’ll send you an email with instructions to reset your password.</p>
									<form name='forgot.php' method='post' class='login-form'>
			                    	<div class='form-group'>
			                    		
			                        	<input type='text' name='email' placeholder='Email Address...' class='form-username form-control' id='form-username' onblur='check();'>
			                        </div>
			                        <input type='submit' value='SUBMIT' name='submit' class='btn btn-success'>
                                    
			                    </form>
                        		</div>
                       
                            </div>
                            <div class='form-bottom' style='background-color:#fafafa'>
			                    <p >If you don't receive an email from us within a few minutes, check your spam filter as sometimes they end up in there. The email will be from help@teamtreehouse.com.</p>
		                    </div>
                        </div> ";
						
						if (isset($_POST['submit']))
{
	$email=$_POST['email'];
	
	$query=mysql_query("SELECT * FROM member WHERE email='$email'");
	$numrow=mysql_num_rows($query);
	
	if($numrow!=0){
		$row=mysql_fetch_assoc($query);
			$db_email=$row['email'];
		
		if($email== $db_email){
			$code=rand(10000,1000000);
			
			//email msg
			
			$to=$db_email;
			$subject="Password Reset";
			$body="
			This is an automated email.Please do not reply to this.
			
			Click the link below or paste it into your browser
			
			http://localhost/forgot/forgot_pass.php?code=$code&email=$email	
			
			";
			mysql_query("UPDATE member SET pass_reset='$code' WHERE email='$email'");
			
			mail($to,$subject,$body,"FROM:ipv6@learning.org");
			echo "CHECK YOUR MAIL";
		}
		else{
			echo "email incorrect";
		}
	}
	else{
		echo "THAT DOES NoT EXIST";
	}
	
	}
					}	

						?>
                    </div> 
                </div>
            </div>   
        </div>

    </body>

</html>

我是否在双引号方面犯了一些错误或任何其他错误尝试请提出建议

最佳答案

您错过了 else 条件中的 {} 括号。

if ($get_email == $db_email && $get_code == $db_code)
{
    // your stuff
}
else{ // **you missed these brackets**
    // your stuff
}

旁注:我建议您使用 mysqli_*PDO,因为 mysql_* 已弃用并且在 PHP 7 中不可用。

关于php - 重置密码显示布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34653691/

相关文章:

html - 仅使输入字段的一部分不可编辑

php - MySQL表在数据之前插入空记录

php - php 中 glob 函数的行为与 open_basedir 不同

jquery - 如何为桌面 View 禁用响应式移动菜单 jquery 命令

javascript - (JS) 如何删除动态创建的最后一个元素?

填充单元格高度的 HTML 标签,带有某种形式的填充

php - 如何通过网络传送音乐(渐进/下载)而不暴露 mp3 的 URL(即使在 webkit 浏览器中)

php - 如何使用 Carbon 从 "created_at"中提取时间

php - Laravel + Redis 通过 SSL 缓存?

javascript - 防止 Element-UI 为 li 标签强制执行列表项