There are currently no built in options, its just id order or most players order.
If you want newest servers on top, you can use the advanced management button to put new servers at the top of the list.
Or you could edit the lgsl_class.php and find lgsl_sort_servers_by_id and change: $server_a['o']['id'] > $server_b['o']['id'] to $server_a['o']['id'] < $server_b['o']['id']
For random, you could edit the lgsl_list.php and remove $server_list = lgsl_sort_servers($server_list); So that it lists the servers by last refresh time.
Sun Dec 07 2008, 03:21PM
You make it sound so easy....
And another question, maybe even the wrong website to post this...
How should a php file look when i want to extract all servers in the database with one gametype. What i want to do is that users can click on "Call of Duty 4", and see only call of duty 4 servers... The database contains servers with all gametypes, including cod1, 2, and so on... Maybe this is the hard way, and instead i should use zones... What do you recommend?
Added the code, sorting works! thanks man! I assume this is a safe way? A friend of me said with some code added to the url anyone can flush the database... is this correct? Made a backup anyway..:P
Another question. Output is a table with 7 cells per row. How can i add a sorting option above it, for example, to sort online players (most players top, no players bottom). Maybe you have a txt file hidding about this aswell.
Your friend is not completely off the mark, but is wrong, and because security is important I will explain why.
Here is how deleting of a database could occur:
$_GET contains data from the url.
so: website/lgsl/?type=source makes: $_GET[type] = source making sql: ...WHERE `disabled` = 0 AND `type` = 'source' ORDER BY...
Now some evil person comes along and changes the url.
so: webiste/lgsl?type=';DROP lgsl FROM database;etc ' makes: $_GET[type] = website/lgsl?type=';DROP lgsl FROM database;etc ' making sql: ...WHERE `disabled` = 0 AND `type` = '';DROP lgsl FROM database;etc '' ORDER BY...
By using a single quote and semi-colon in the url, you could break out of the quotes and add something nasty, then just have to join it back up to avoid a sql error. This is called php sql injection, and if your doing php coding, I recommend googling and learning more.
So why is the above code not at risk ? $lgsl_type = mysql_real_escape_string($_GET['type']); mysql_real_escape_string function escapes ( puts backslashes infront of ) quotes or other sql symbols, so they are treated as text within the quotes.
As to the other question, what you want is 'column sorting' which gets complicated, I dont have a text file for that, so you will need to google it.
Posts: 19 Joined: Mon Jan 25 2010, 11:53AM Registered Member #5749
Rich Did you ever find out anything about column sorting in your script? I'm looking around but since I'm quite new to php and not everything is stored in mysql as it's own row I'm having trouble finding out how to call for things and sort by it. Such as country, gametype, ip etc.
The thing is, I see various fairly easy to implement scripts or bits of code that can sort. I've made the column headings, but I am unable to make anythign work in your script.
Since you are a lot of experienced then most of us here, perhaps you'd be willing to implement this option yourself?