我有一些大代码,我不知道是否可以在这里发布。但是我需要帮助。解析错误:语法错误,第220行的C:\ xampp \ htdocs \ icebm \ Projekt \ account.php中文件意外结束,这就是我收到的消息,并且我检查了一百万次是否错过了某些内容,但是我可以什么都找不到。这段代码有220行,body或html标记有问题吗?非常感谢,如果您看一看:)
<?php session_start(); ?>
<html>
<head>
<link type="text/css" rel="stylesheet" href="index.css">
<title>ICEBM 2017</title>
<link rel="shortcut icon" href="Photos/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body onload="displayCalendar()" >
<div class="tarolo">
<!-- Slideshow beillesztese -->
<div class="slideshow">
<div class="slide">
<img src="Photos/elso.png" style="width:100%; height:62%">
</div>
<div class="slide">
<img src="Photos/masodik.jpg" style="width:100%; height:62%">
</div>
<div class="slide">
<img src="Photos/harmadik.jpg" style="width:100%; height:62%">
</div>
</div>
<div style="text-align:center">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<script src="Javascript/slideshow.js"></script>
<!-- Menu beillesztese -->
<ul class="menu">
<li><a href="index.php">HOME</a></li>
<li><a href="helyszin.php">Location</a></li>
<li><a href="bizottsag.php">Committee</a></li>
<li><a href="szervezo.php">Organizing institutions</a></li>
<li><a href="hataridok.php">Deadlines</a></li>
<li><a href="palyazas.php">Application</a></li>
<li><a href="kapcsolat.php">Contact</a></li>
<li><a href="registration.php">Registration</a></li>
<?php
if(!isset($_SESSION['user']))
echo '<li><a href="login.php">Log In</a></li>';
else
echo '<li><a href="logout.php">Log Out</a></li>';
?>
</ul>
<div class="tartalom">
<a href="index.php"><img src="Photos/logo.png" align="right" alt="logo"></a>
<h1>Account Info</h1>
<?php
//session_start();
if(isset($_POST['submission'])) {
$filename = $_FILE["fileup"]["name"];
$target_dir = "Uploads/"; //the directory where file will be uploaded
$target_file = $target_dir . basename($_FILES["fileup"]["name"]);
$uploadOk = 1;
$filetype = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
//check if the file is pdf
if (!empty($_FILES['fileup']['name'])) {
if( mime_content_type($target_file) == "application/pdf" ) {
if ($_FILES["fileup"]["error"] > 0) {
echo "Error: " . $_FILES["fileup"]["error"] . "<br>";
$uploadOk = 0;
}
else {
echo "Upload: " . $_FILES["fileup"]["name"] . "<br>";
echo "Type: " . $_FILES["fileup"]["type"] . "<br>";
echo "Size: " . ($_FILES["fileup"]["size"] / 1024) . " Kb<br>";
echo "Stored in: " . $_FILES["fileup"]["tmp_name"];
echo "<br>";
$uploadOk = 1;
}
}
else {
echo "Invalid file!";
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists. <br>";
$uploadOk = 0;
}
// Check file size
/*if ($_FILES["fileup"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}*/
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0)
echo "Sorry, your file was not uploaded. <br>";
// if everything is ok, try to upload file
else {
if (move_uploaded_file($_FILES["fileup"]["tmp_name"], $target_file))
echo "The file ". basename( $_FILES["fileup"]["name"]). " has been uploaded. <br><br>";
else
echo "Sorry, there was an error uploading your file. <br>";
}
//connect to mysql
$servername = "localhost";
$username = "root";
$password = "";
$database = "icebm";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Csatlakozás sikertelen: " . $conn->connect_error);
}
//echo "Sikerült csatlakozni.";
mysqli_query($conn,"set character set UTF8");
$title = $_POST["paper"];
$abstract = $_POST["abstract"];
$author = $_POST["author"];
$option = $_POST["option"];
$insertinto = "INSERT INTO eloadas (cim, osszefoglalo, tarsszerzo, fajlnev, azonosito) VALUES ('". $title ."', '". $abstract ."', '".$author."', '".$filename."', '".$option."') ";
$result = mysqli_query($conn, $insertinto);
/*if(!empty($result)) {
echo "sikerult";
}*/
$select = "SELECT eloadasID FROM eloadas";
$result2 = mysqli_query($conn, $select);
/*if(!empty($result2)) {
echo "sikerultt";
}*/
while($eloadas = $result2->fetch_assoc()) {
$eloadasID = $eloadas['eloadasID'];
$felhasznalonev = $_SESSION['user'];
$eredmeny = mysqli_query($conn, "INSERT INTO eloadast_tart VALUES ('".$eloadasID."', '".$felhasznalonev."')");
/*if(!empty($eredmeny)) {
echo "sikerulttt";
}*/
}
?>
<?php
//connect to mysql
$servername = "localhost";
$username = "root";
$password = "";
$database = "icebm";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn->connect_error)
die("Csatlakozás sikertelen: " . $conn->connect_error);
$nev=$_SESSION['user'];
//SELECT cim FROM eloadas INNER JOIN eloadast_tart ON eloadas.eloadasID=eloadast_tart.eloadasID INNER JOIN jelentkezo ON eloadast_tart.felhasznalonev=jelentkezo.felhasznalonev WHERE felhasznalonev=$nev;
$id = mysqli_query($conn,"SELECT eloadasID FROM eloadast_tart WHERE felhasznalonev='".$nev."'");
echo '<i>Title of submitted papers: </i><br>';
while($row = $id->fetch_assoc()) {
$cim = mysqli_query($conn, "SELECT cim FROM eloadas WHERE eloadasID='".$row['eloadasID']."'");
while($x = mysqli_fetch_array($cim)) {
echo "<br>";
echo $x['cim'];
}
}
/*$parancs = mysqli_query($conn, "SELECT cim FROM eloadas INNER JOIN eloadast_tart ON eloadas.eloadasID=eloadast_tart.eloadasID INNER JOIN jelentkezo ON eloadast_tart.felhasznalonev=jelentkezo.felhasznalonev WHERE felhasznalonev='".$nev."'");
while($row = mysqli_fetch_array($parancs))
echo $row['cim'];*/
?>
</div>
<div class="jobboldal">
<div align="left">
<?php
if(isset($_SESSION['user']))
echo '<a style="color:#7f1515;" href="submission.php" id="submission">Submission!</a>';
?>
</div>
<div align="right">
<?php
if(isset($_SESSION['user'])) {
echo '<img src="Photos/account.png" width="9%" height="4%">';
echo "<a href='account.php'>'".$_SESSION['user']."'</a> ";
}
?>
</div>
<!-- Visszaszamlalo -->
<img src="Photos/days.png" width="100%">
<p id="demo"></p>
<script src="Javascript/visszaszamlalo.js"></script>
<!--Naptar beillesztese -->
<div id="calendar"></div>
<script src="Javascript/naptar.js"></script>
<p>Previous ICEBM pages:
<a href="https://econ.ubbcluj.ro/icebm/2015/">ICEBM 2015</a><br>
<a href="https://econ.ubbcluj.ro/icebm/2013/">ICEBM 2013</a> </p>
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
看起来您没有关闭以下括号:
if(isset($_POST['submission'])) {
和
if (!empty($_FILES['fileup']['name'])) {