Jump to content

Recommended Posts

$password = $_POST['password'];

if ($password =="pgpg7755opcd") {


$itemid = $_POST['id'];
$imagelink = $_POST['imagelink'];
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$member = $_POST['member'];
$noted = $_POST['noted'];
$rare = $_POST['rare'];
$nontradable = $_POST['nontradable'];
$staffonly = $_POST['staffonly'];
$lettercatagory = $_POST['lettercatagory'];

if (!$itemid || !$name || !$description || !$price || !$lettercatagory) {
echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">Item ID: <form action="acp.php" method="POST"><input type="text" name="id"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Image link: <input type="text" name="imagelink"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Name: <input type="text" name="name"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Description: <input type="text" name="description"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Item Price: <input type="text" name="price"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Member: <input type="text" name="member"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Noted: <input type="text" name="noted"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Rare: <input type="text" name="rare"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Non-Tradable: <input type="text" name="tradable"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Staff only: <input type="text" name="staffonly"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">Letter Category: <input type="text" name="lettercatagory"/><input type="submit"></form></td></tr>';
}
else {
mysql_query("INSERT INTO items VALUES ('', '$itemid', '$imagelink', '$name', '$description', '$price', '', '$member', '$noted', '$rare', '$nontradable', '$staffonly', '$lettercatagory', '', '')") or die(mysql_error());

echo "Item added!";
echo '<br></table> 
</div>
</div> 
<div class="center"> 
Change a Price
</div> 
<div class="inbox_body">';

$id = $_POST['itemid'];
$price = $_POST['newprice'];

if (!$id || !$price) {
echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">Item ID: <form action="acp.php" method="POST"><input type="text" name="itemid"/></td></tr> 
<tr><td colspan="5" style="color: #888888; font-style: italic;">New price: <input type="text" name="newprice"/><input type="submit"></form></td></tr>';
}
else {

//display data
$get = mysql_query("SELECT * FROM items WHERE itemid='$id'");
while ($row = mysql_fetch_assoc($get))

{
// get data
  $oldprice = $row['price'];
}

$change = $price - $oldprice;

mysql_query("UPDATE items SET changeprice = $change WHERE itemid='$id'");
mysql_query("UPDATE items SET price = $price WHERE itemid='$id'");
mysql_query("UPDATE items SET beforeprice = $oldprice WHERE itemid='$id'");


echo "Item has been updated.";
} else { 

if (!$password) {
   echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">ACP Password: <form action="acp.php" method="POST"><input type="text" name="password"/></form></td></tr>';
} else {
echo "Incorrect password.";
}

 

Error:

Parse error: syntax error, unexpected T_ELSE in /home/a3993404/public_html/acp.php on line 369

 

I dont understand why it still tells me their is an error. :/

Link to comment
https://forums.phpfreaks.com/topic/191272-else-errors/
Share on other sites

Please make sure to get rid of that hard-coded password: it's a severe breach in security. You're only asking to be hacked.

 

On that note, you were missing some curly brackets in your code (I also indented the code for readability):

$password = $_POST['password'];

if ($password =="pgpg7755opcd") {


$itemid = $_POST['id'];
$imagelink = $_POST['imagelink'];
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$member = $_POST['member'];
$noted = $_POST['noted'];
$rare = $_POST['rare'];
$nontradable = $_POST['nontradable'];
$staffonly = $_POST['staffonly'];
$lettercatagory = $_POST['lettercatagory'];

if (!$itemid || !$name || !$description || !$price || !$lettercatagory) {
	echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">Item ID: <form action="acp.php" method="POST"><input type="text" name="id"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Image link: <input type="text" name="imagelink"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Name: <input type="text" name="name"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Description: <input type="text" name="description"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Item Price: <input type="text" name="price"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Member: <input type="text" name="member"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Noted: <input type="text" name="noted"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Rare: <input type="text" name="rare"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Non-Tradable: <input type="text" name="tradable"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Staff only: <input type="text" name="staffonly"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">Letter Category: <input type="text" name="lettercatagory"/><input type="submit"></form></td></tr>';
} else {
	mysql_query("INSERT INTO items VALUES ('', '$itemid', '$imagelink', '$name', '$description', '$price', '', '$member', '$noted', '$rare', '$nontradable', '$staffonly', '$lettercatagory', '', '')") or die(mysql_error());

	echo "Item added!";
	echo '<br></table> 
	</div>
	</div> 
	<div class="center"> 
	Change a Price
	</div> 
	<div class="inbox_body">';

	$id = $_POST['itemid'];
	$price = $_POST['newprice'];

	if (!$id || !$price) {
		echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">Item ID: <form action="acp.php" method="POST"><input type="text" name="itemid"/></td></tr> 
	<tr><td colspan="5" style="color: #888888; font-style: italic;">New price: <input type="text" name="newprice"/><input type="submit"></form></td></tr>';
	} else {

		//display data
		$get = mysql_query("SELECT * FROM items WHERE itemid='$id'");
		while ($row = mysql_fetch_assoc($get)){ 
			 // get data
		  $oldprice = $row['price'];
		}

		$change = $price - $oldprice;

			mysql_query("UPDATE items SET changeprice = $change WHERE itemid='$id'");
			mysql_query("UPDATE items SET price = $price WHERE itemid='$id'");
			mysql_query("UPDATE items SET beforeprice = $oldprice WHERE itemid='$id'");


		echo "Item has been updated.";
	} // <-- missing these
} // <-- 
} else { 

	if (!$password) {
	   echo '<tr><td colspan="5" style="color: #888888; font-style: italic;">ACP Password: <form action="acp.php" method="POST"><input type="text" name="password"/></form></td></tr>';
	} else {
	echo "Incorrect password.";
	} 

}

Link to comment
https://forums.phpfreaks.com/topic/191272-else-errors/#findComment-1008512
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.