chaoswar4u Posted June 10, 2007 Share Posted June 10, 2007 Gangs have a few bugs i require help on. The first is you declare war on a gang and that is all ok but then you can declare war on the same person thus 2 wars 1 gang. The function is function gang_staff_wardeclare() { global $db,$ir,$c,$userid,$gangdata; if(isset($_POST['subm'])) { $_POST['gang'] = abs((int) $_POST['gang']); $db->query("INSERT INTO gangwars VALUES('',{$ir['gang']},{$_POST['gang']},unix_timestamp())"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID={$_POST['gang']}"); $them=$db->fetch_row($ggq); $event=str_replace("'","''","{$gangdata['gangNAME']} declared war on {$them['gangNAME']}"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',{$_POST['gang']},unix_timestamp(),'$event')"); print "You have declared war!"; } else { print " Choose who to declare war on. Gang: "; $q=$db->query("SELECT * FROM gangs WHERE gangID != {$ir['gang']}"); while($r=$db->fetch_row($q)) { print "{$r['gangNAME']}\n"; } print " "; } } The second error is a user still has the ability to pass a gangs president to another user that is also a president of there own gang. Any help would be great. Many thx in advance. Quote Link to comment Share on other sites More sharing options...
secret_life Posted April 7, 2013 Share Posted April 7, 2013 6 years later you gona have an answer lol Change this function gang_staff_wardeclare() { global $db,$ir,$c,$userid,$gangdata; if(isset($_POST['subm'])) { $_POST['gang'] = abs((int) $_POST['gang']); By this function gang_staff_wardeclare() { global $db,$ir,$c,$h,$userid,$gangdata; if(isset($_POST['subm'])) { $_POST['gang'] = abs((int) $_POST['gang']); $inwar=$db->query("SELECT * FROM gangwars where warDECLARER={$_POST['gang']} AND warDECLARED={$ir['gang']}"); if($db->num_rows($inwar) > 0){ echo"You are already in war with this gang"; $h->endpage(); exit; } $inwar=$db->query("SELECT * FROM gangwars where warDECLARER={$ir['gang']} AND warDECLARED={$_POST['gang']}"); if($db->num_rows($inwar) > 0){ echo"You are already in war with this gang"; $h->endpage(); exit; } Is for new people who don't find an answer why you can declare war on same gang multiple time Quote Link to comment Share on other sites More sharing options...
secret_life Posted April 7, 2013 Share Posted April 7, 2013 Yes is better :) thanks 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.