darktimesrpg Posted June 21, 2007 Share Posted June 21, 2007 I get this error: Parse error: syntax error, unexpected T_IF in /home/darktime/public_html/item-action.php on line 471 The first line is 471 with this code: if ($action == 9) { if (empty($hidden)) { $status = " <form action=\"$PHP_SELF?iid=$tid\" method=\"post\"> <input type=\"hidden\" name=\"hidden\" value=\"1\"> <input type=\"hidden\" name=\"action\" value=\"9\"> <br> Use On :: <input type=\"text\" name=\"uname\" maxlength=\"20\" style=\"width: 150px\"> <br><br> <input type=\"submit\" value=\"Attack\"> "; } else { $check = mysql_query("SELECT * FROM members WHERE username = '$uname'") or die(mysql_error()); $checknum = mysql_num_rows($check); $check = mysql_fetch_object($check); if (!$uname) { $status = " Please fill in the username. <br><br> <input type=submit value=\"Go Back\" onClick=\"history.go(-1)\"> "; } elseif ($checknum == 0) { $status = " User \"$uname\" does not exsist. <br><br> <input type=submit value=\"Go Back\" onClick=\"history.go(-1)\"> "; } $hitself = rand(1,10) if($hitself <= 2){$attack = 2;} else{$attack = 1;} if(!empty($check->shield)){ $itemshield = mysql_query("SELECT * FROM inventory WHERE tid = '$check->shield'") or die(mysql_error()); $itemshield = mysql_fetch_object($itemshield); if($itemshield->iid == 220){ $shield = 1; } else{$shield = 0; $attack = 1;} } if($shield = 1){ $chance = rand(1,10) if($chance >= 6){$attack = 0;} elseif($chance <= 3){$attack = 2;} else{$attack = 1;} } if($attack = 0){ $status = "This users Shield Cloak worked and you didn't hurt them (The chances are random and you can hurt them sometimes, but be careful it can also backfire!)<br><input type=\"button\" value=\"Back\" onClick=\"location.href='inventory.php'; return true;\">" } elseif($attack = 2){ $newhealth = rand($iteminfo->mindamage, $iteminfo->maxdamage); $damage = $newhealth; $newhealth = user($username, health) - $newhealth; if($newhealth < 0){$newhealth = '0';}; mysql_query("UPDATE members SET health = '$newhealth' WHERE username = '$username'") or die(mysql_error()); $event = "Your attack backfired and you hit yourself for $damage points of damage!"; $event= str_replace("'","\'",$event); mysql_query("INSERT INTO events SET username = '$uname', event = '$event'") or die(mysql_error()); if($iteminfo->reuse == 0){ mysql_query("DELETE FROM inventory WHERE tid = '$tid'") or die(mysql_error()); };$status = " Your attack backfired and you hit yourself for $damage points of damage! <br><br> <input type=\"button\" value=\"Back\" onClick=\"location.href='inventory.php'; return true;\">"; } elseif ($shield = 0 || $attack = 1) { $newhealth = rand($iteminfo->mindamage, $iteminfo->maxdamage); $damage = $newhealth; $newhealth = user($uname, health) - $newhealth; if($newhealth < 0){$newhealth = '0';}; mysql_query("UPDATE members SET health = '$newhealth' WHERE username = '$uname'") or die(mysql_error()); $event = "$username attacked you with $name for $damage points of damage!"; $event= str_replace("'","\'",$event); mysql_query("INSERT INTO events SET username = '$uname', event = '$event'") or die(mysql_error()); if($iteminfo->reuse == 0){ mysql_query("DELETE FROM inventory WHERE tid = '$tid'") or die(mysql_error()); };$status = " Attacked $uname for $damage points of damage! <br><br> <input type=\"button\" value=\"Back\" onClick=\"location.href='inventory.php'; return true;\"> "; } } } Link to comment https://forums.phpfreaks.com/topic/56564-help/ Share on other sites More sharing options...
darktimesrpg Posted June 21, 2007 Author Share Posted June 21, 2007 bump Link to comment https://forums.phpfreaks.com/topic/56564-help/#findComment-279391 Share on other sites More sharing options...
chigley Posted June 21, 2007 Share Posted June 21, 2007 Paste 10 lines above 147 please? Link to comment https://forums.phpfreaks.com/topic/56564-help/#findComment-279423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.