skull Posted July 21, 2009 Share Posted July 21, 2009 cant get this to work this is attack ladder <?php $atkpage=1; include "globals.php"; if($ir['hospital']) { die("This page cannot be accessed while in hospital."); } if($ir['jail']) { die("This page cannot be accessed while in jail."); } $_GET['ID']=abs((int) $_GET['ID']); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); $od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}"); if($_SESSION['attackwon'] != $_GET['ID']) { die ("Cheaters don't get anywhere."); } if($db->num_rows($od)) { $r=$db->fetch_row($od); $gq=$db->query("SELECT * FROM gangs WHERE gangID={$r['gang']}"); $ga=$db->fetch_row($gq); if($r['hp'] == 1) { print "What a cheater u are."; } else { $db->query("UPDATE users SET attacks_won=attacks_won+1 WHERE userid=$userid"); $db->query("UPDATE users SET attacks_total=attacks_total+1 WHERE userid=$userid"); $db->query("UPDATE users SET defends_lost=defends_lost+1 WHERE userid={$_GET['ID']}"); $db->query("UPDATE users SET defends_total=defends_total+1 WHERE userid={$_GET['ID']}"); $db->query("UPDATE users SET total_won=total_won+1 WHERE userid=$userid"); $db->query("UPDATE users SET total_lost=total_lost+1 WHERE userid={$_GET['ID']}"); $db->query("UPDATE users SET total_total=total_total+1 WHERE userid=$userid"); $db->query("UPDATE users SET total_total=total_total+1 WHERE userid={$_GET['ID']}"); $db->query("INSERT INTO userattacks VALUES($userid,'You attacked <a href=viewuser.php?u={$r['userid']}>{$r['username']}</a>, in a ladder battle.',unix_timestamp());"); $db->query("INSERT INTO userattacks VALUES({$r['userid']},'<a href=viewuser.php?u=$userid>{$ir['username']}</a> beat you in a ladder battle.',unix_timestamp());"); $half=$ir['maxenergy']/2/2; $db->query("UPDATE users SET energy=energy+$half WHERE userid=$userid"); $_SESSION['attackwon']=0; event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] == 1) { event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); die("<center>You did not lose or gain any ladder rank.</center>"); } if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] < 22) { event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); die("<center>You did not lose or gain any ladder rank.</center>"); } if($you['ladderRANK'] < $them['ladderRANK'] && $you['ladderRANK'] > 21) { $newrank=$you['ladderRANK']-1; $otherrank=$you['ladderRANK']; $db->query("UPDATE ladder SET ladderRANK=$otherrank WHERE ladderRANK=$newrank"); $db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid"); die("<center>You have gained 1 position in the ladder rankings.</br>You are now rank <font color=red>$newrank</font>.</center>"); } if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] > 10) { event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); $blah=round(($you['ladderRANK']-$them['ladderRANK'])/2); $newrank=$you['ladderRANK']-$blah; $lowest=$newrank-1; $dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}") or die(mysql_error()); while($others=$db->fetch_row($dert)) { $db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}") or die(mysql_error()); } $db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid") or die(mysql_error()); die("<center>You have gained $blah position(s) in rank.</br>You are now rank <font color=red>$newrank</font>.</center>"); } if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] > 6) { event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); $newrank=$you['ladderRANK']-2; $lowest=$newrank-1; $dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}"); while($others=$db->fetch_row($dert)) { $db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}"); } $db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid"); die("<center>You have gained 2 positions in rank.</br>You are now rank <font color=red>$newrank</font>.</center>"); } if($you['ladderRANK'] > $them['ladderRANK'] && $you['ladderRANK'] < 7) { event_add($r['userid'],"{$ir['username']} beat you in a ladder battle.",'combat'); $newrank=$you['ladderRANK']-1; $lowest=$newrank-1; $dert=$db->query("SELECT * FROM ladder WHERE ladderRANK>$lowest AND ladderRANK<{$you['ladderRANK']}"); while($others=$db->fetch_row($dert)) { $db->query("UPDATE ladder SET ladderRANK=ladderRANK+1 WHERE ladderID={$others['ladderID']}"); } $db->query("UPDATE ladder SET ladderRANK=$newrank WHERE ladderID=$userid"); die("<center>You have gained 1 position in rank.</br>You are now rank <font color=red>$newrank</font>.</center>"); } } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Eruondo Posted July 21, 2009 Share Posted July 21, 2009 Re: help What's the error? Quote Link to comment Share on other sites More sharing options...
skull Posted July 21, 2009 Author Share Posted July 21, 2009 Re: help it doesnt update the query you to battle ladder you attack you finish and it on the screen were it says leave, mug and all attack ladder button ther when press it goes to this file and thats it blank page doesnt update Quote Link to comment Share on other sites More sharing options...
Danny696 Posted July 21, 2009 Share Posted July 21, 2009 Re: help Use Code Tags Like This [code] Do It Like This [code][/code] Quote Link to comment 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.