Xyphon Posted January 18, 2009 Share Posted January 18, 2009 <?PHP include('top.php'); include('Connect.php'); $ID = $_COOKIE['UserID']; $ID = mysql_real_escape_string($ID); $Battle_Result= mysql_query("SELECT * FROM Battle_Information WHERE ID='$ID'"); $Battle_Rows= mysql_fetch_array($Battle_Result); $Battle_Result2= mysql_query("SELECT * FROM users WHERE ID='$ID'"); $Battle_Rows2= mysql_fetch_array($Battle_Result2); $Taijutsu= $Battle_Rows2['Taijutsu']; $Taijutsu = mysql_real_escape_string($Taijutsu); $Ninjutsu= $Battle_Rows2['Ninjutsu']; $Ninjutsu = mysql_real_escape_string($Ninjutsu); $Genjutsu= $Battle_Rows2['Genjutsu']; $Genjutsu = mysql_real_escape_string($Genjutsu); $Bloodline1= $Battle_Rows2['Bloodline']; $Bloodline1 = mysql_real_escape_string($Bloodline1); $Bloodline2= $Battle_Rows2['Bloodline2']; $Bloodline2 = mysql_real_escape_string($Bloodline2); $Bloodline3= $Battle_Rows2['Bloodline3']; $Bloodline3 = mysql_real_escape_string($Bloodline3); $Bloodline4= $Battle_Rows2['Bloodline4']; $Bloodline4 = mysql_real_escape_string($Bloodline4); $Bloodline5= $Battle_Rows2['Bloodline5']; $Bloodline5 = mysql_real_escape_string($Bloodline5); $Weapon= $Battle_Rows2['Weapon']; $Weapon = mysql_real_escape_string($Weapon); $Taijutsu_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Taijutsu'"); $Taijutsu_Rows= mysql_fetch_array($Taijutsu_Result); $Ninjutsu_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Ninjutsu'"); $Ninjutsu_Rows= mysql_fetch_array($Ninjutsu_Result); $Genjutsu_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Genjutsu'"); $Genjutsu_Rows= mysql_fetch_array($Genjutsu_Result); $Bloodline1_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Bloodline1'"); $Bloodline1_Rows= mysql_fetch_array($Bloodline1_Result); $Bloodline2_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Bloodline2'"); $Bloodline2_Rows= mysql_fetch_array($Bloodline2_Result); $Bloodline3_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Bloodline3'"); $Bloodline3_Rows= mysql_fetch_array($Bloodline3_Result); $Bloodline4_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Bloodline4'"); $Bloodline4_Rows= mysql_fetch_array($Bloodline4_Result); $Bloodline5_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Bloodline5'"); $Bloodline5_Rows= mysql_fetch_array($Bloodline5_Result); $Weapon_Result= mysql_query("SELECT * FROM jutsus WHERE Jutsu_Name='$Weapon'"); $Weapon_Rows= mysql_fetch_array($Weapon_Result); $Power= $Battle_Rows2['Power']; $Power = mysql_real_escape_string($Power); $Max_HP= $Battle_Rows2['Max_HP']; $Max_HP= mysql_real_escape_string($Max_HP); if(!isset($ID)) { echo "Sorry, you must be logged in to view this page"; include('bottom.php'); exit; } $Submit = $_GET['Type']; if(!$Submit) { if($Battle_Rows['Enemy_Name']=="") { echo "Sorry, you aren't in a battle.."; } else { echo " <html> <center> <table border='3' bordercolor='red' width='550' height='300'><td><center> <table border='0' width='550'><td><center>" . $Battle_Rows['Enemy_Name'] . "<br> HP: " . $Battle_Rows['Enemy_HP'] . "/" . $Battle_Rows['Enemy_Max_HP'] . " Chakra: " . $Battle_Rows['Enemy_Chakra'] . "/" . $Battle_Rows['Enemy_Max_Chakra'] . "</td></table><br><br><br><br> <table border='1' width='550'><td><center>Taijutsu:<br><a href='battle.php?Type=Taijutsu'>" . $Battle_Rows2['Taijutsu'] . "</a></td><td>Ninjutsu:<br><a href='battle.php?Type=Ninjutsu'>" . $Battle_Rows2['Ninjutsu'] . "</a></td><font size='3'><td>Genjutsu:<br><a href='battle.php?Type=Genjutsu'>" . $Battle_Rows2['Genjutsu']. "</a></td><td>Bloodline:<br><a href='battle.php?Type=Bloodline1'>" . $Battle_Rows2['Bloodline'] . "</a></td><td>Weapon:<br><a href='battle.php?Type=Weapon'>" . $Battle_Rows2['Weapon'] . "</a></td></table><br><table border='0' width='550'> <td><center>" . $Battle_Rows2['Username'] . "<br> HP: " . $Battle_Rows2['HP'] . "/" . $Battle_Rows2['Max_HP'] . " Chakra: " . $Battle_Rows2['Chakra'] . "/" . $Battle_Rows2['Max_Chakra'] . "</td></table></td></table>"; } } else { if($Submit=='Taijutsu') { $EnemyRand= rand(1, 4); $GenjutsuE= $Battle_Rows['Enemy_Genjutsu']; $GenjutsuE= mysql_real_escape_string($GenjutsuE); $NinjutsuE= $Battle_Rows['Enemy_Ninjutsu']; $NinjutsuE= mysql_real_escape_string($NinjutsuE); $TaijutsuE= $Battle_Rows['Enemy_Taijutsu']; $TaijutsuE= mysql_real_escape_string($TaijutsuE); $WeaponE= $Battle_Rows['Enemy_Weapon']; $WeaponE= mysql_real_escape_string($WeaponE); $Taijutsu_Enemy_Result= mysql_query("SELECT * FROM Battle_Information WHERE Jutsu_Name='$TaijutsuE'"); $Taijutsu_Enemy_Rows= mysql_fetch_array($Taijutsu_Enemy_Result); $Ninjutsu_Enemy_Result= mysql_query("SELECT * FROM Battle_Information WHERE Jutsu_Name='$NinjutsuE'"); $Ninjutsu_Enemy_Rows= mysql_fetch_array($Ninjutsu_Enemy_Result); $Genjutsu_Enemy_Result= mysql_query("SELECT * FROM Battle_Information WHERE Jutsu_Name='$GenjutsuE'"); $Genjutsu_Enemy_Rows= mysql_fetch_array($Genjutsu_Enemy_Result); $Weapon_Enemy_Result= mysql_query("SELECT * FROM Battle_Information WHERE Jutsu_Name='$WeaponE'"); $Weapon_Enemy_Rows= mysql_fetch_array($Weapon_Enemy_Result); if($EnemyRand=="4"); { $Enemy_Move=="$NinjutsuE"; $EnemyDamage1= $Ninjutsu_Enemy_Rows['Jutsu_Power']; $EnemyDamage1= mysql_real_escape_string($EnemyDamage1); $Ninjutsupower= $Battle_Rows['Ninjutsu_Power']; $Ninjutsupower= mysql_real_escape_string($Ninjutsupower); $EnemyPower= $Battle_Rows['Enemy_Power']; $EnemyPower= mysql_real_escape_string($EnemyPower); $EnemyDamage2= round(($EnemyDamage1 + Ninjutsupower) + $EnemyPower); $EnemyDamage3= round($EnemyDamage2 / 5); $HP= $Battle_Rows2['HP']; $HP= mysql_real_escape_string($HP); $HP= round($HP - $EnemyDamage3); $Defense= $Ninjutsu_Enemy_Rows['Defense']; $Defense= mysql_real_escape_string($Defense); if($HP < 0) { $HP= 0; } } elseif($EnemyRand=="3") { $Enemy_Move=="$TaijutsuE"; $EnemyDamage1= $Taijutsu_Enemy_Rows['Jutsu_Power']; $EnemyDamage1= mysql_real_escape_string($EnemyDamage1); $Taijutsupower= $Battle_Rows['Taijutsu_Power']; $Taijutsupower= mysql_real_escape_string($Taijutsupower); $EnemyPower= $Battle_Rows['Enemy_Power']; $EnemyPower= mysql_real_escape_string($EnemyPower); $EnemyDamage2= round(($EnemyDamage1 + Taijutsupower) + $EnemyPower); $EnemyDamage3= round($EnemyDamage2 / 5); $HP= $Battle_Rows2['HP']; $HP= mysql_real_escape_string($HP); $HP= round($HP - $EnemyDamage3); $Defense= $Taijutsu_Enemy_Rows['Defense']; $Defense= mysql_real_escape_string($Defense); if($HP < 0) { $HP= 0; } } elseif($EnemyRand=="2") { $Enemy_Move=="GenjutsuE"; $EnemyDamage1= $Genjutsu_Enemy_Rows['Jutsu_Power']; $EnemyDamage1= mysql_real_escape_string($EnemyDamage1); $Genjutsupower= $Battle_Rows['Genjutsu_Power']; $Genjutsupower= mysql_real_escape_string($Genjutsupower); $EnemyPower= $Battle_Rows['Enemy_Power']; $EnemyPower= mysql_real_escape_string($EnemyPower); $EnemyDamage2= round(($EnemyDamage1 + Genjutsupower) + $EnemyPower); $EnemyDamage3= round($EnemyDamage2 / 5); $HP= $Battle_Rows2['HP']; $HP= mysql_real_escape_string($HP); $HP= round($HP - $EnemyDamage3); $Defense= $Genjutsu_Enemy_Rows['Defense']; $Defense= mysql_real_escape_string($Defense); if($HP < 0) { $HP= 0; } } else { $Enemy_Move=="Weapon"; $EnemyDamage1= $Weapon_Enemy_Rows['Jutsu_Power']; $EnemyDamage1= mysql_real_escape_string($EnemyDamage1); $Weaponpower= $Battle_Rows['Weapon_Power']; $Weaponpower= mysql_real_escape_string($Weaponpower); $EnemyPower= $Battle_Rows['Enemy_Power']; $EnemyPower= mysql_real_escape_string($EnemyPower); $EnemyDamage2= round(($EnemyDamage1 + Weaponpower) + $EnemyPower); $EnemyDamage3= round($EnemyDamage2 / 5); $HP= $Battle_Rows2['HP']; $HP= mysql_real_escape_string($HP); $HP= round($HP - $EnemyDamage3); $Defense= $Weapon_Enemy_Rows['Defense']; $Defense= mysql_real_escape_string($Defense); if($HP < 0) { $HP= 0; } } $Damage1= $Taijutsu_Rows['Jutsu_Power']; $Damage1= mysql_real_escape_string($Damage1); $Taijutsupower= $Battle_Rows2['Taijutsu_Power']; $Taijutsupower= mysql_real_escape_string($Taijutsupower); $Damage2= round(($Damage1 + $Taijutsupower) + $Power); $Damage3= round($Damage2 / 5); if($Defense=="Yes") { $Damage3="0"; $Enemy_HP= round($Enemy_HP - $Damage3); $Enemy_MHP= $Battle_Rows['Enemy_Max_HP']; if($Enemy_HP < 0) { $Enemy_HP= 0; } mysql_query("UPDATE Battle_Information SET Enemy_HP='$Enemy_HP' WHERE ID='$ID'"); mysql_query("UPDATE users SET HP='$HP' WHERE ID='$ID'"); echo "<html> <center> <table border='3' bordercolor='red' width='550' height='300'><td><center> <table border='0' width='550'><td><center>" . $Battle_Rows['Enemy_Name'] . "<br> HP: " . $Enemy_HP . "/" . $Battle_Rows['Enemy_Max_HP'] . " Chakra: " . $Battle_Rows['Enemy_Chakra'] . "/" . $Battle_Rows['Enemy_Max_Chakra'] . "</td></table><br><br><br><br> <table border='1' width='550'><td><center>Taijutsu:<br><a href='battle.php?Type=Taijutsu'>" . $Battle_Rows2['Taijutsu'] . "</a></td><td>Ninjutsu:<br><a href='battle.php?Type=Ninjutsu'>" . $Battle_Rows2['Ninjutsu'] . "</a></td><font size='3'><td>Genjutsu:<br><a href='battle.php?Type=Genjutsu'>" . $Battle_Rows2['Genjutsu']. "</a></td><td>Bloodline:<br><a href='battle.php?Type=Bloodline1'>" . $Battle_Rows2['Bloodline'] . "</a></td><td>Weapon:<br><a href='battle.php?Type=Weapon'>" . $Battle_Rows2['Weapon'] . "</a></td></table><br><table border='0' width='550'> <td><center>" . $Battle_Rows2['Username'] . "<br> HP: " . $Battle_Rows2['HP'] . "/" . $Battle_Rows2['Max_HP'] . " Chakra: " . $Battle_Rows2['Chakra'] . "/" . $Battle_Rows2['Max_Chakra'] . "</td></table>You did $Damage3 damage!<br>The Enemy used $Enemy_Move. It did $EnemyDamage3 damage!"; if($Enemy_HP=="0") { echo "<html><font size='3'> You have defeated the enemy!</font>"; $EXP_Gained= round($Enemy_MHP * 1.2); echo "<br>You gained $EXP_Gained EXP!"; $EXP= $Battle_Rows2['EXP']; $EXP= mysql_real_escape_string($EXP); $Total_EXP= round($EXP + $EXP_Gained); mysql_query("UPDATE users SET EXP='$Total_EXP' WHERE ID='$ID'"); $EXP2= $Battle_Rows2['EXP']; $EXP2= mysql_real_escape_string($EXP2); $NEXP= $Battle_Rows2['NEXP']; $NEXP= mysql_real_escape_string($NEXP); if($EXP2 >= $NEXP) { $EXP2= round($EXP2 - $NEXP); $NEXP= round($NEXP * 1.5); $Level= $Battle_Rows2['Level']; $Level= mysql_real_escape_string($Level); $Level2= round($Level + 1); $Statpoints= $Battle_Rows2['Stat_Points']; $Statpoints= mysql_real_escape_string($Statpoints); $Statpoints2= round($Statpoints + 3); $Max_HP2= round($Max_HP * 1.2); $Power2 = round($Power * 1.2); $Chakra= $Battle_Rows2['Max_Chakra']; $Chakra= mysql_real_escape_string($Chakra); $Chakra2= round($Chakra + 1); mysql_query("UPDATE users SET EXP=$EXP2, NEXP=$NEXP, Level=$Level2, Stat_Points=$Statpoints2, Max_HP=$Max_HP, HP=$Max_HP, Max_Chakra=$Chakra2, Chakra=$Chakra2, Power=$Power2 WHERE ID='$ID'"); echo "<br>You have gained a level!"; echo "<br>Level: $Level2<br />Statpoints: +3<br>HP: $Max_HP2<br>Power: $Power2<br>Chakra: $Chakra2"; } mysql_query("DELETE FROM Battle_Information WHERE ID='$ID'"); } } } elseif($Submit=='Ninjutsu') { echo "Ninjutsu!"; } elseif($Submit=='Genjutsu') { echo "Genjutsu!"; } elseif($Submit=='Bloodline1') { echo "Bloodline1!"; } else { echo "Weapon!"; } } ?> I know its a little messy so I'll show you exactly where it was $HP= $Battle_Rows2['HP']; $HP= mysql_real_escape_string($HP); $HP= round($HP - $EnemyDamage3); $Defense= $Ninjutsu_Enemy_Rows['Defense']; $Defense= mysql_real_escape_string($Defense); if($HP < 0) { $HP= 0; } } elseif($EnemyRand=="3") { $Enemy_Move=="$TaijutsuE"; $EnemyDamage1= $Taijutsu_Enemy_Rows['Jutsu_Power']; $EnemyDamage1= mysql_real_escape_string($EnemyDamage1); $Taijutsupower= $Battle_Rows['Taijutsu_Power']; Why did I get an unexpected elseif? The brackers are right and everything, and theres the semi colon after each line, ect. Quote Link to comment https://forums.phpfreaks.com/topic/141295-solved-unexpected-elseif/ Share on other sites More sharing options...
Philip Posted January 18, 2009 Share Posted January 18, 2009 if($EnemyRand=="4"); shouldn't have a semicolon Quote Link to comment https://forums.phpfreaks.com/topic/141295-solved-unexpected-elseif/#findComment-739539 Share on other sites More sharing options...
Xyphon Posted January 18, 2009 Author Share Posted January 18, 2009 Oh, I didnt notice I put one. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/141295-solved-unexpected-elseif/#findComment-739544 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.