Page 1 of 1

adding this to home page causes flood control to kick in?

Posted: Mon Jul 25, 2016 5:39 pm
by cbsarge
Hello all,

I was trying to add a home page element to one of the modules. I successfully added it and it displays on the home page. The trouble is that I'd like to include the player avatar as part of the listing of bounties (the module in question) but, when I do it causes the flood control function to log me out. Can anyone tell me what part of this would cause that sort of behavior?

Thanks!

Code: Select all

<?php
TableHeader("Available Bounties");
echo Translate("Make some quick cash or put the hit out on someone!")."<br>";
echo Translate("Try to collect one of these contracts or head over to the Bounties Office and take out your own!");
echo "<center>";
$result = $db->Execute("select bounty_id,bounty_userid,bounty_adder,bounty_price,bounty_start,bounty_private,bounty_inAction from bounty_list");
{
	echo "<table class='plainTable'>";
	echo "<tr class='titleLine'>";
	echo "<td>" . Translate("#"). "</td>";
	echo "<td>" . str_replace(" ", " ", Translate("Victim")). "</td>";
	echo "<td>" . str_replace(" ", " ", Translate("Mug Shot")). "</td>";
	echo "<td>" . str_replace(" ", " ", Translate("Bounty Price")) . "</td>";
	echo "<td>" . str_replace(" ", " ", Translate("Bounty Owner")) . "</td>";
	echo "<td>" . str_replace(" ", " ", Translate("Bounty Actions")). "</td>";
	echo "</tr>";
	$row = 0;
	if($result->EOF)
		echo "<tr class='evenLine'><td colspan='100%' align='center'><strong>No bounties to display</strong></td></tr>";
	else
	{
		while (!$result->EOF)
		{
    		if ($row % 2 == 0)
        		echo "<tr class='evenLine'>";
    		else
        		echo "<tr class='oddLine'>";
        	$row ++;
        	$a = $db->Execute("select id, username from users where id = ?",$result->fields[2]);
        	$b = $db->Execute("select id, username from users where id = ?",$result->fields[1]);
			$avatarb = $db->Execute("select id from users where id = ?",$result->fields[1]);
        	if($result->fields[5] == "un-listed")
        	{
        		if($result->fields[2] == $userId)
        			$adder = $a->fields[1]. "<em>(Private)</em>";
        		else
					$adder = "<em>Private</em>";
			}
			else
				$adder = "<a href='index.php?p=view_player&id=".$a->fields[0]."'>".$a->fields[1]."</a>";
        	echo "<td>".$row.".</td>";
			echo "<td><a href='index.php?p=view_player&id=".$b->fields[0]."'>".$b->fields[1]."</td>";
			echo "<td>";
			DisplayAvatar($avatarb->fields[0]);
			echo "</td>";
			echo "<td>".FormatNumber($result->fields[3]).str_replace("","&nbsp",Translate(" !Currency"))."</td>";
			echo "<td>".$adder."</td>";
			echo "<td>";
			if  ($result->fields[2] == $userId)
				LinkButton("Cancel Bounty","index.php?p=bounties&action=cancel&id={$result->fields[0]}");
			else
				LinkButton("Claim Bounty","index.php?p=bounties&action=claim&id={$result->fields[0]}");
			echo "</td>";
			$result->MoveNext();
		}
	$result->Close();
	}
	echo "</tr>";
	echo "</table>";

}
LinkButton("Bounties Office","index.php?p=bounties");
echo "</center>";
tableFooter();
echo "<br>";

Re: adding this to home page causes flood control to kick in

Posted: Tue Jul 26, 2016 3:04 pm
by cbsarge
I've added this element to my live site just so anyone can take a look if interested. I set the flood control values up pretty high and it doesn't seem to be logging me out now but, I'm still kind of curious as to why it is doing it in the first place.

Any thoughts?

Re: adding this to home page causes flood control to kick in

Posted: Tue Jul 26, 2016 4:40 pm
by KaL
You can just create a function in your lib: "function bounty lists()" and put the listed bounty into that script. Then you can use that function to display the bounty function anywhere you want. It will be easier.