3raser Posted February 7, 2010 Share Posted February 7, 2010 $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 More sharing options...
Hybride Posted February 7, 2010 Share Posted February 7, 2010 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 More sharing options...
3raser Posted February 7, 2010 Author Share Posted February 7, 2010 How come the "Change a Price" section doesn't show up once I do what you said? Link to comment https://forums.phpfreaks.com/topic/191272-else-errors/#findComment-1008529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.