gpt4 book ai didi

PHP:找不到语法错误

转载 作者:行者123 更新时间:2023-11-29 01:19:27 25 4
gpt4 key购买 nike

<分区>

Parse error: syntax error, unexpected $end in blah/blah/blah.php line 1

这是我收到的错误,带有这段代码

<?php 
include("db.php");

if (isset($_POST['username']) &&
isset($_POST['password']) &&
isset($_POST['email']))
{
//Prevent SQL injections
$username = mysql_real_escape_string($_POST['username']);
$email = mysql_real_escape_string($_POST['email']);

//Get MD5 hash of password
$password = md5($_POST['password']);

//Check to see if username exists
$sql = mysql_query("SELECT username FROM usersystem WHERE username = 'username'");

if (mysql_num_rows($s > 0))
{
die ("Username taken.");
}

mysql_query("INSERT INTO usersystem (username, password, email) VALUES ( '$username', '$password', '$email')")
or die (mysql_error()); echo "Account created.";
}
?>

我已经检查了未闭合的括号,这不是问题所在。同样通过对它进行故障排除,我发现 include("db.php");导致问题。当我将其注释掉时,它会很好地加载页面。然而,即使 db.php 完全空白,只是一个空的 .php 文件,它仍然会给我同样的错误。我很困惑。有人有什么想法吗?

这是我的 db.php 文件,但老实说,当我将 db.php 完全空白时,我得到了同样的错误。我正在正确保存它。

<?php
session_start();
mysql_connect("localhost", "mydatabase", "mypassword");
mysql_select_db("ratherda_jetpackfandango");

function user_login ($username, $password)
{
//take the username and prevent SQL injections
//$username = mysql_real_escape_string($username);

//begin the query
$sql = mysql_query("SELECT * FROM user WHERE username = 'username' AND password = 'password' LIMIT 1");

//check to see how many rows were returned
$rows = mysql_num_rows($sql);

if ($rows<=0 )
{
echo "Incorrect username/password";
}
else
{
//have them logged in
$_SESSION['username'] = $username;
}
}
?>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com