Username:    Password:        Click Here To Signup     Forgotten Password
Main Menu
Online
Members: 0

Guests: 13

112.111.x.x forum
123.125.x.x forum
175.44.x.x forum
192.151.x.x forum
216.152.x.x comment
36.248.x.x forum
36.251.x.x forum
42.62.x.x lgsl
50.16.x.x forum
66.249.x.x forum
66.249.x.x forum
69.175.x.x forum
8.35.x.x forum

Last Seen

Dodgeitorelse Sat 08:48
Wussie Sat 08:48
BYTM Sat 07:32
xMin Sat 06:32
palyarmerc Sat 06:00

Newest Members

Forums
Multiple-Page index.php
Michael
Sat Mar 22 2008, 07:03AM
Guest I have a small problem. I have 4939 servers that i am updating. they all show up on the index page. Do you think to can make an option to show "10" "25" "50" servers and multiple pages? That would be very cool.
Anonymous
Sat Mar 22 2008, 07:07AM
Guest Also. If you could make a separate "update.php" that would update all the servers in the database that would be cool "or tell me how to do it ". I know you are a busy man and i like what you are doing for us. Keep up the GREAT work!
Rich
Sat Mar 22 2008, 07:29AM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

Thats a lot of servers

The paging I can look into but is not a trivial, and will take a bit of re-design to do.

The seperate update is the "lgsl_cron.php" which you can run by a cron job to update the list. Details of the commands to run in the readme. ( LGSL v4.6 )

Take note of the part about increasing the "cache_time".
Website
Anonymous
Sat Mar 22 2008, 05:54PM
Guest OK THANKS ALOT! i didn't read the readme yet. probably should have done that first. but thanks for the info.
Michael
Sun Mar 23 2008, 02:15AM
Guest Also "yet again", i am working on a search feature. hopefully i get it done soon.
Michael
Sun Mar 23 2008, 04:21AM
Guest I have a script here that searches the mysql database for the ip you entered "or partial ip". what i want to do is get the server name from the cache that was returned from the mysql query.

The cache is all jumbled and i have no idea how to get just the server name out of it. Can you help me out a little?

$query = "SELECT * FROM `server` WHERE `ip` LIKE '%".mysql_real_escape_string($ip)."%'";

while($row = @mysql_fetch_array($result)) {

$online = $row['status'];

"need some code here to get the NAME of the server"
Nome
Sun Mar 23 2008, 10:12AM
Posts: 6
Joined: Thu Mar 20 2008, 05:46AM
Registered Member #3855
Michael do u share ip search script?
Website
Rich
Sun Mar 23 2008, 10:20AM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

"yet again" ?

Please remember I do this in my spare time for free.

99.9% of people use LGSL for 1 to 10 servers, so I have designed it around that usage.

For large ammounts of servers, you are better off making your own database structure, geared towards searching and sorting, and just using the "lgsl_protocol.php" to do the querying.
Website
Anonymous
Mon Mar 24 2008, 12:37AM
Guest yet again - i have asked a bunch of questions.

i have an idea on exactly what i want to do. i just can decipher the cache lol.

something to do with unserialize($cache);

i cant for the life of me, figure it out.

i just want to echo the name of the server in a table

echo "<tr style='".lgsl_bg()."'><td>"Name of Server"<td>".$row['ip']."</td><td>".$row['c_port']."</td><td><img alt='' src='lgsl_files/other/icon_online.gif' title='ONLINE' /></td></tr>\n";
Michael
Mon Mar 24 2008, 08:30PM
Guest I got my ip search script to work "will explain when i release it". now im going to add some more functionality "name search, number of players search, map search, online-offline search sorting etc.".
Michael
Tue Mar 25 2008, 10:51PM
Guest I have a LIVE version of my search "i replaced the index with it because i need to figure out how to get multiple pages"

http://battlefield2gamer.info/server/index.php

In order for me to search for the Server Name i had to make a separate field in my mysql table called "name".

every time somebody makes a search it puts all the outputted servers' names into the mysql database.
-----------
Do you think it would be hard to implement flags in the player list. what i mean is in the game battlefield 2, players are either on the USMC side "u.s" MEC side "middle-eastern coalition" or china side. there are flags that designate what side you are on. instead of having it say what side the player is on, it would be cool if it showed the flag too.

this is in the server detail page.
-----------
Rich
Wed Mar 26 2008, 10:58AM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

Looking good ( although some servers seemed to have map text and a picture causing the table to shift over ? )

For the flags, some where after "server_html" has been called, you could replace the text with an image link:


if ($server['b']['type'] == "bf2")
{
  foreach ($server['p'] as $player_key => $player)
  {
    if ($player['team'] == "MEC")
    {
      $server['p'][$player_key]['team'] = "<img src='mec_flag.gif' />";
    }
  }
}

Website
Elite_Marines
Wed Mar 26 2008, 05:27PM
Posts: 59
Joined: Tue Mar 25 2008, 11:18PM
Registered Member #3872
Thanks for the info! that was pretty much exactly how i was going to do it. I got the table fixed, it was just an error in the code.


if ($server['b']['type'] == "bf2") //Changes the text for the players team to an image

  foreach ($server['p'] as $player_key => $player) 
  { 
    if ($player['team'] == "US") 
    { 
      $server['p'][$player_key]['team'] = "<a class='thumbnail' href='#thumb'><img src='lgsl_files\icons\bf2\US.png' width='32px' height='24px' border='0'/><span><img src='lgsl_files\icons\bf2\US.png' /><br />This player is on the USMC side.</span></a>"; 
    } else if ($player['team'] == "MEC") 
    { 
      $server['p'][$player_key]['team'] = "<a class='thumbnail' href='#thumb'><img src='lgsl_files\icons\bf2\MEC.jpg' width='32px' height='24px' border='0'/><span><img src='lgsl_files\icons\bf2\MEC.jpg' /><br />This player is on the MEC side.</span></a>"; 
    } else if ($player['team'] == "CH") 
    { 
      $server['p'][$player_key]['team'] = "<a class='thumbnail' href='#thumb'><img src='lgsl_files\icons\bf2\CHINA.png' width='32px' height='24px' border='0'/><span><img src='lgsl_files\icons\bf2\CHINA.png' /><br />This player is on the Chinese side.</span></a>"; 
    }    
  } 
}


ALSO. i added another sort function to lgsl_class.php

It is to sort by team.


  if (!function_exists('lgsl_sort_players')) {
  function lgsl_sort_players($server)
  {
    global $lgsl_config;

    if (!is_array($server['p'])) { return $server; }

    if ($lgsl_config['sort']['players'] == "score")
    {
      usort($server['p'], "lgsl_sort_players_by_score");
    }
    else if ($lgsl_config['sort']['players'] == "name")
    {
      usort($server['p'], "lgsl_sort_players_by_name");
    }
    else if ($lgsl_config['sort']['players'] == "team")
    {
      usort($server['p'], "lgsl_sort_players_by_team");
    }

    return $server;
  }}



if (!function_exists('lgsl_sort_players_by_team')) {
  function lgsl_sort_players_by_team($player_a, $player_b)
  {
    if ($player_a['team'] == $player_b['team']) { return 0; }

    return ($player_a['team'] < $player_b['team']) ? 1 : -1;
  }}


I also added logo's to the details page with a simple code

if ($field == "bf2_sponsorlogo_url"){
    $value = "<img src='$value' alt='' name='Serverlogo' width='400' height='100' id='serverlogo' />";
    } 
    if ($field == "bf2_communitylogo_url"){
    $value = "<img src='$value' alt='' name='Serverlogo' width='400' height='100' id='serverlogo' />";
    }

This will output the picture instead of the URL.

Website
Rich
Wed Mar 26 2008, 07:35PM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

Just checked, and see you have added the team flags, but you have used backslashes ( \ ) for the paths which IE corrects, but does not work in other browsers.
Website
Elite_Marines
Wed Mar 26 2008, 07:39PM
Posts: 59
Joined: Tue Mar 25 2008, 11:18PM
Registered Member #3872
updated with /

I also did small little edits. The player info has a tittle "Player Information", the server info has "Server Information".

Website
Rich
Wed Mar 26 2008, 08:40PM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

What might be a good idea is to combine team and name sorting, so you take the name sort and add to the top

if ($player_a['team'] < $player_b['team']) { return 1; }
if ($player_a['team'] > $player_b['team']) { return -1; }

So when both players being compared have the same team, it then goes onto sorting by name.
Website
Elite_Marines
Wed Mar 26 2008, 11:32PM
Posts: 59
Joined: Tue Mar 25 2008, 11:18PM
Registered Member #3872
Good idea. Question:
I want to add to my lgsl_cron.php...

I add

$server_list = $mysql_row['id'];    

$lookup = lgsl_lookup_id($server_list);

$server = lgsl_query_cached($lookup['ip'], $lookup['q_port'], $lookup['c_port'], $lookup['s_port'], $lookup['type'], "sep");

$players = $server['s']['players'];

$query  = "UPDATE `server` SET `players`='$players' WHERE `id`='$server_list'";

$result = mysql_query($query) or die(mysql_error());
but it just keeps saying "server not in database"

Website
Rich
Thu Mar 27 2008, 05:37AM
Posts: 1700
Joined: Wed Nov 26 2003, 04:30PM

I assume you want to take the cron, and make it also insert data into your custom columns.

http://www.greycube.com/help/lgsl_4.x/lgsl_01.txt

Players are an array, so they must be converted to a string before insertion. I just used serialize, but you may only want to store the names for example.

Always run mysql_real_escape_string before insertion, for security, and to prevent any server data being mistaken for SQL.

If your doing a 'WHERE' and its only going to effect one server, add LIMIT 1 to the end for speed.

( as for the server not in database, check that the lookup_id function is returning data )
Website
Elite_Marines
Thu Mar 27 2008, 04:29PM
Posts: 59
Joined: Tue Mar 25 2008, 11:18PM
Registered Member #3872
It worked the first time i ran the script but no matter what i did it would not work again.

if you go here http://battlefield2gamer.info/server/lgsl_files/lgsl_cron.php you will see my cron in action "don't go to it too often or it will mess up my mysql tables for some reason, probably because i have cron jobs set up"

another quick question. what is skill? i havent been able to figure that out.

update - i got it working by adding $server = $mysql_row['id']; before the lgsl_query_cached
hopefully it doesnt stop working

update - stopped working AGAIN. WTF? changed WHERE `id`='{$mysql_row['id']}' to {$server['o']['id']} and it works again.

update - i got it fully working. added the server name to the $lgsl_cron so that my search script wont take so long "it has to query the server name then update mysql, very inefficient in my opinion".

update - Added battlefield 2 special forces map pictures

update - Added bf2 special forces team flags and bf2 high-quality flags. ill try to add bf2 sf support and a separate folder "or you can for the lgsl 4.7 release". go here for teamflags and map pics http://home.rochester.rr.com/mybf2page/maps.html

update - I made a script to change servers that play Special forces maps to `type`='bf2sf' and i changed the lgsl_protocol to go with bf2sf. hopefully it works

Website
Elite_Marines
Sat Mar 29 2008, 06:06PM
Posts: 59
Joined: Tue Mar 25 2008, 11:18PM
Registered Member #3872
My Community has a couple servers and about 90 admins on each 1 "we are ranked 20 'used to be 1 but we switch servers'" and they want me to add an icon next to the names that says if a player is an admin.

i tried

 foreach ($server['p'] as $player_key => $player) 
  { 
    if ($player['name'] == "=Iowa= Elite_Marines") 
    {
$admin = "This player is an admin";
} else {
$admin = "";
}

Which works to a point. if i change "=Iowa= Elite_Marines" to a variable it doesnt work.

do you have an idea?

i have the names in a database. it worked then but it would echo 5 rows for each person in my database so it would say

This player is not an admin - Test
This player is not an admin - Test
This player is not an admin - Test
This player IS an admin - Test
This player is not an admin - Test

test being the player. it would do that to all the players on the server.

Website
Go to page       >>   

Jump:     Back to top


You are not logged in - Click Here To Signup

Username:    Password:   

Mini Buttons

.... © GreyCube.com - Richard Perry - Powered by e107.org