我正在创建一个登录和注册页面。我正在使用MAMP服务器和Querious MySQL管理器。这个代码文件的名称是“SignUp.php”,过去几天我很疯狂地找到为什么它不在localhost网站上执行。当我从netbeans运行它时显示空白屏幕。此SignUp.php是一个网页模板。我使用netbeans来编码。请帮助我如何运行,因为我可以运行登录表单,因为我在html文件中编码,但这是包含html部分的.php文件。我尝试了所有可以获得的知识,但我不知道我哪里出错了。当我运行此文件时,它显示空白页面 - 没有显示html部分。 非常感谢您的帮助。
<html>
<head>
<meta charset="UTF-8">
<title>SignUp</title>
</head>
<body>
<form name=form3 action="SignUp.php" method="post">
<table id ="title">
<tr>
<p><input id="First_Name" name="fname" type="text" placeholder="First Name"></p>
</tr>
<tr>
<p><input id="Last_Name" name="lname" type="text" placeholder="Last Name"></p>
</tr>
<tr>
<p><input id="Email_Id" name ="email" type="text" placeholder="Email-Id"></p>
</tr>
<tr>
<p><input id="Username" name ="username" type="text" placeholder="Username"></p>
</tr>
<tr>
<p><input id="Password" name ="password" type="password" placeholder="Password"></p>
</tr>
<tr>
<p><input id="Confirm_Password" name ="cpassword" type="password" placeholder="Confirm Password"></p>
</tr>
<tr>
<td> </td>
<p><input type="submit" name="submit" value="Sign Up"
</tr>
</table>
</div>
</form>
<?php
include("DB_Connect.php");
if (isset(filter_input(INPUT_POST,'submit')))
{
if(!filter_input(INPUT_POST,'fname') | !filter_input(INPUT_POST,'lname') | !filter_input(INPUT_POST,'email') |
!filter_input(INPUT_POST,'username') | !filter_input(INPUT_POST,'password') | !filter_input(INPUT_POST,'cpassword'))
{
die('You did not complete all of the required fields');
}
}
//check validation email
$check = "SELECT Email_Id FROM Members where Email_Id='".$email."'";
$result1 = mysql_query($connection,$query1);
$numResults = mysql_num_rows($result1);
if(!!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$message = "Invalid email address, please type valid email address";
}
elseif($numResult>=1)
{
$message = $email." Email already exist!!";
}
//checks if the username is in use
if (!get_magic_quotes_gpc())
{
filter_input(INPUT_POST,'username') = addslashes(filter_input(INPUT_POST,'username'));
}
$usercheck = filter_input(INPUT_POST,'username');
$check1 = mysql_query("SELECT Username FROM Members WHERE Username = '$usercheck'");
// if the name given exist error
$check2 = mysql_num_rows($check1);
if ($check2 != 0)
{
die('Sorry, the Username '. filter_input(INPUT_POST, 'username').' is already in use.');
}
//if passwords match
if (filter_input(INPUT_POST, 'password')!= filter_input(INPUT_POST, 'cpassword'));
{
die('Your passwords did not match. ');
}
//encrypt password
filter_input(INPUT_POST,'password') = md5(filter_input(INPUT_POST, 'password'));
if (!get_magic_quotes_gpc())
{
filter_input(INPUT_POST, 'password') = addslashes(filter_input(INPUT_POST, 'password'));
filter_input(INPUT_POST, 'username') = addslashes(filter_input(INPUT_POST, 'username'));
}
//add member
$insert = "INSERT INTO Members (First Name, Last Name, Email-Id, Username, Password, Confirm Password)
VALUES ('".filter_input(INPUT_POST,'fname')."', '".filter_input(INPUT_POST,'lname')."',
'".filter_input(INPUT_POST,'email')."', '".filter_input(INPUT_POST,'username')."',
'".filter_input(INPUT_POST,'password')."','".filter_input(INPUT_POST,'cpassword')."')";
$add_member = mysql_query($insert);
?>
<h1>Registered</h1>
<p>Thank you, you have registered - you may now login</a>.</p>
?>
</body>