概述: 我正在創建一個虛擬網站用於學習的目的,因此它的功能主義者是基本的和安全的不在議程atm。更新表解析錯誤
問題: 當我登錄到一個系統,然後單擊編輯帳戶按鈕我得到這個錯誤:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\eshop\userEditAccount.php on line 104
userEditAccount.php文件:
<?php
session_start();
require_once('userEditAccount.php');
include('connect_mysql.php');
if(isset($_POST['Editsubmited'])){
$userid = $_SESSION['user_id'];
$Newusername = $_POST['username'];
$Newpassword = $_POST['password'];
$Newfirstname = $_POST['first_name'];
$Newlastname = $_POST['last_name'];
$Newemail = $_POST['email'];
$sql = "UPDATE users SET username='$Newusername', password='$Newpassword',
first_name='$Newfirstname', last_name='$Newlastname WHERE user_id='$userid'";
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
if(!$result){
exit("Error Ocured whilsd updating $ud_id record");
}
echo "Record $ud_id has been sucesfully updated";
mysql_close($con);
?>
<html>
<head>
<title>Edit Account</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<header><h1>E-Shop</h1></header>
<article>
<h1>Welcome</h1>
<h1>Edit Account</h1>
<div id="login">
<ul id="login">
<form method="post" name="editAccount" action="userEditAccount.php" >
<fieldset>
<legend>Fill in the form</legend>
<label>Select Username : <input type="text" name="username" /></label>
<label>Password : <input type="password" name="password" /></label>
<label>Enter First Name : <input type="text" name="first_name" /></label>
<label>Enter Last Name : <input type="text" name="last_name" /></label>
<label>Enter E-mail Address: <input type="text" name="email" /></label>
</fieldset>
<br />
<input name="Editsubmited" type="submit" submit="submit" value="Edit Account" class="button">
</form>
<?
echo $newrecord;
?>
</div>
<form action="userhome.php" method="post">
<div id="login">
<ul id="login">
<li>
<input type="submit" value="back" onclick="index.php" class="button">
</li>
</ul>
</div>
</article>
<aside>
</aside>
<div id="footer">This is my site i Made coppyrights 2013 Tomazi</div>
</div>
</body>
</html>
看代碼的一切看起來是正確的和錯誤沒有意義的文件結尾.........
當我在一個單獨的文件中使用php代碼並將該文件與html文件,然後我得到的文件中的PHP相同的錯誤,因此我猜想它的東西與PHP ....
任何建議Overflowers:....?
SQL注入啊嗬! – 2013-03-01 17:04:42
omg人我正在學習我正在嘗試建立基本功能之前,增強代碼這個網站將永遠不會上線。我非常瞭解安全問題和SQL注入問題。 – Tomazi 2013-03-01 17:10:02
如果我發佈一個問題來獲得幫助並學習一些東西,那麼所有這些「聰明的人」都會尋找任何不喜歡的理由。就像大家從一開始就讓事情變得完美一樣! – Tomazi 2013-03-01 17:12:57