这是我的代码
<?php
include("inc/scripts/mysql_connect.inc.php");
?>
<?php
$reg = @$_POST['reg'];
//Declaring Variables
$fn = ""; //First Name
$ln = ""; //Last Name
$em = ""; //Email
$em2 = ""; //Email Confirm
$pswd = ""; //Password
$pswd2 = ""; //Password Confirm
$d = ""; //Sign Up Date
//Registration Form
$fn = strip_tags(@$_POST['first_name']); //First Name
$ln = strip_tags(@$_POST['last_name']); //Last Name
$em = strip_tags(@$_POST['email']); //Email
$em2 = strip_tags(@$_POST['email2']); //Email Confirm
$pswd = strip_tags(@$_POST['password']); //Password
$pswd2 = strip_tags(@$_POST['password2']); //Password Confirm
$d = date("Y-m-d"); //Sign Up Date
if($reg) {
if($fn&&$ln&&$em&&$em2&&$pswd&&$pswd2) {
if($em==$em2){
if($pswd==$pswd2) {
if(strlen($fn)>32||strlen($ln)>32) {
echo "First name and Last name must be no more than 32 characters!";
}
else {
if(strlen($pswd)>30||strlen($pswd)<5) {
echo "Your password must be between 5 and 30 characters ...";
}
else {
$pswd = md5($pswd);
$pswd2 = md5($pswd2);
$query = mysql_query("INSERT INTO users VALUES('','$fn','$ln','$em','$pswd','$d','0')");
die("<h2>Welcome to bakpakk!</h2>");
}
}
}
else {
echo "Your passwords do not match!";
}
}
else {
echo "Your emails do not match!";
}
}
else {echo "Please fill in all fields ...";}
}
?>
用户登录系统将此信息发布到数据库。“mysql_connect.inc.php”看起来像这样
<?
mysql_connect("localhost","root","250317") or die(myspq_error());
mysql_select_db("bakpakk");
?>
当我在输入字段(名字、姓氏、电子邮件、密码等)中输入数据时,它不会发布到数据库中的表中。我似乎无法弄清楚为什么。