Jump to content

Recommended Posts

Posted

Hi guys. I really need your help.

I have lineage 2 tops server www.top.la2tops.nbd.lt and i need add server "top5" in my ipb forum

 

llb.lt have this plugin.

 

HERE IS MY CODE:

 

<?php
   $server_ip = "localhost";
   $mysql_user = "tralalal";
   $mysql_pass = "lalalala";
   $database = "lalalal";
   
   $connect = mysql_connect("$server_ip", "$mysql_user", "$mysql_pass");
   if(!$connect){
      die('Negaliu prisijungti:'. mysql_error());
   }
   $db_select = mysql_select_db("$database", $connect);
   if(!$db_select){
      die('Nerasta Duomenu baze:'. mysql_error());
   }
   
   $top = mysql_query("SELECT id, title, votes FROM servers ORDER BY votes DESC LIMIT 10");
   $pos = 0;
   echo"<table  cellspacing='5'  border='0'>";
   echo"<tr><td>Nr.</td><td>Taskai</td><td>Serveris</td></tr>";
   while($row=mysql_fetch_array($top)){
      $pvpkill = $row['title'];
      $nick = $row['votes'];
      $pos++;
      echo"<tr><td>$pos.</td><td>$nick</td><td>$pvpkill</td></tr>";
   }   
   echo"</table>";
   mysql_close($connect);
?>

 

I modified it from top pvp .php script:D

Only one problem. How to to that when some press on server name he goes to server website? :)

 

Thanks.

 

P.s I DONT WANT TO ADVERTISE SOMETHING HERE. JUST NEED HELP :)

Posted

change the echo"<tr><td>Nr.</td><td>Taskai</td><td>Serveris</td></tr>";

to

echo "<tr><td>Nr.</td><td><a href="server website">Taskai</a></td><td>Serveris</td></tr>";

Posted

Ok, I see you didin't get it. Nevermind.

Let's do it other way.

 

<?php
if(!defined('SYS_STARTED')) die('Security activated');

$three_first_images = array(
1 => "<img src='{$theme_path}/images/icons/gold_medal_small.png' style='margin-left: -5px;' alt=''>", 
"<img src='{$theme_path}/images/icons/silver_medal_small.png' style='margin-left: -5px;' alt=''>", 
"<img src='{$theme_path}/images/icons/bronze_medal_small.png' style='margin-left: -5px;' alt=''>"
);
$servers_list = array();

$query = $db->prepare("SELECT *,rank FROM (
SELECT @rank := IF(@prev_val=votes,@rank,@rank+1) AS rank, @prev_val := votes AS 
votes, id, user_id, title, web_url, chronicle, xp, description, game_server_status, login_server_status
FROM servers WHERE deleted = '0' ORDER BY votes DESC, last_vote_date DESC
)as result LIMIT 5");
$query->execute();

if ($query->rowCount() > 0) {
$i = 1;
foreach ($query->fetchAll() as $key => $value) {
	$rank = get_server_rank($value['user_id']);

	$value['rank'] = (isset($three_first_images[$rank])) ? "<div class='server_rank_add'><strong>{$rank}</strong></div>" : "<div class='server_rank_add'>{$rank}</div>";
	$value['short_title'] = truncate(strtolower($value['title']), 25);
	$value['_id'] = $i;

	$servers_list[] = $value;
	++$i;
}
}

$tpl->assign('servers_list', $servers_list);	
$tpl->draw('top5');
?>

 

This is code of Top_5.php.

But when i go that file it says me "Security activated"... what should i do that top5 work?

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...