Jump to content
MakeWebGames

Gang Errors in V2


chaoswar4u

Recommended Posts

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.

Link to comment
Share on other sites

  • 5 years later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...