-2
確定Dreamweaver和我的本地主機服務器保持說他們是一個錯誤,但我不知道在哪裏請幫助?PHP錯誤,但它在哪裏?
這是一個PHP腳本弄清楚,如果用戶已經有一個帳戶,然後,他沒有將他登記到數據庫
<html>
<head>
<style type="text/css">
p {color:white;font-size:20px;}
.toppa {width: 100%;background-color:#2D2D2D;}
</style>
<?php
//Database Information
$dbhost = "localhost";
$dbname = "a8423624_grubber";
$dbuser = "root";
$dbpass = "";
//Connect to database
mysql_connect ($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$username = $_POST['username'];
$email = $_POST['email'];
$password = md5($_POST['password']);
$repassword = md5($_POST['repassword']);
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$Intro = 1;
$admin = "no";
if (!(empty($username) or empty($email) or empty($password) or empty($repassword)))
{
//a Text field is empty
if ($password == $repassword) {
$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkuser1 = mysql_query("SELECT email FROM users WHERE email='$email'");
$email_exist = mysql_num_rows($checkuser1);
$username_exist = mysql_num_rows($checkuser);
// checks email
if ($username_exist > 0)
{
echo "<div class='toppa' align='center'>
<h1 align='Left'> Grubber </h1>
</div>
<p> You'r Name has been taken please try another Name. </P>";
include 'tryagain.html';
}
else
{
if ($email_exist > 0)
{
echo "<div class='toppa' align='center'>
<h1 align='Left'> Grubber </h1>
</div>
<p> You'r Email has been taken please try another Email.</P>";
include 'tryagain.html';
}
else
{
$themes = ("http://grubber.host56.com/Themes/Grubber.gif");
$date = ("$year/$month/$day");
$proimg = ("http://grubber.host56.com/images/defaultprof.png");
$query = "INSERT INTO users (admin,themes,proimg,Birthday,Intro,email, username, password)
VALUES('$admin','$themes','$proimg','$date', '$Intro', '$email', '$username', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
echo "<div class='toppa' align='center'>
<h1 align='Left'> Grubber </h1>
</div>
<p> Please sign in to test that your account works </P>";
include 'tryagain.html';
}
else
{
echo "<div class='toppa' align='center'>
<h1 align='Left'> Grubber </h1>
</div>
<p>You'r passwords are not the same please try again.</P>";
}
}
else
{
echo "<div class='toppa' align='center'>
<h1 align='Left'> Grubber </h1>
</div>
<p> Please fill in all fields </P>";
include 'tryagain.html';
}
}
}
?>
你有沒有試過啓用'display_errors'並調查是怎麼回事? – J0HN
您能否更具體地瞭解錯誤?它何時發生,它是否會購買一條消息?運行時錯誤? –
所以它只是說錯誤,沒有給出任何線索在哪裏? – Alex