LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-27-2009, 07:58 PM   #16
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu, Debian
Posts: 182

Rep: Reputation: 49

[EDIT]double post[/EDIT]

Last edited by ammorais; 12-27-2009 at 08:00 PM.
 
Old 12-27-2009, 07:59 PM   #17
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu, Debian
Posts: 182

Rep: Reputation: 49
The explode function return an array. Instead of
PHP Code:
        foreach($value1 as $value2)
        {
            echo 
"<td>$value2</td>";
        } 
You can replace by
PHP Code:
echo "<td>"$value1[0] . "</td>";
echo 
"<td>"$value1[1] . "</td>";
echo 
"<td>"$value1[2] . "</td>";
echo 
"<td>"$value1[3] . "</td>";
echo 
"<td>"$value1[5] . "</td>";
... 
Choose the columns that you want. Keep in mind that arrays start at the index 0, so if you want to omit the password you have to omit $value1[1]

Last edited by ammorais; 12-27-2009 at 08:02 PM.
 
Old 12-27-2009, 08:00 PM   #18
jumperbee
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Original Poster
Rep: Reputation: 0
I will post this on my website and package it with the game server tar file with you has the author of the script of course!

You know my e-mail so don't hesitate to send me your info if you wish to charge something for it and i am mor ethan willing to keep in contact with you and hiring you for small scripts i will need for my game server hosting site and of course i will pay.

Thank you so much and looking foward to get your e-mail.....

Martin

admin@excelclan.com
 
Old 12-27-2009, 08:07 PM   #19
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu, Debian
Posts: 182

Rep: Reputation: 49
I'm glad I could help. I will send you a message.
 
Old 12-27-2009, 08:13 PM   #20
jumperbee
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Here is the result ^^,, its not finished but just to show the result:

http://www.excelclan.info/games/scor...layerstats.php

THANK YOU AMMORAIS FOR HELPING THE SCORCHED COMMUNITY..........
its dying, but were keeping it alive! ^^
 
Old 12-28-2009, 02:07 AM   #21
jumperbee
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Original Poster
Rep: Reputation: 0
For those in need of a Scorch2000 server stats script...

Here is the finished code:

PHP Code:
<TABLE width="600" border="1" align="center" cellPadding="5" cellSpacing="0" borderColor="#FFFFFF" bgcolor="#000000">
<TR bgcolor="#aaaaaa">
  <TH bgcolor="#009933"><div align="center" class="style3">PLAYER NAME</div></TH>
  <TH bgcolor="#009933"><div align="center" class="style3">OVERALL KILLS</div></TH>
  <TH bgcolor="#009933"><div align="center" class="style3">TOTAL SCORE</div></TH>
  </TR>

<?php
    $filename 
"players.db";
    
$handle fopen($filename"r");
    
$multi_arr = array();
    if (
$handle) {
    
        
$buffer fread($handlefilesize($filename));
        
$lines explode(chr(10), $buffer);
        foreach(
$lines as $line)
        {

            
$multi_arr[] = explode(chr(0), $line);        
        }        
    }
    
$sort_ = array();
    foreach(
$multi_arr as  $value) {
            
$sort_[] = $value[4];
    }
        
    
array_multisort($sort_SORT_DESCSORT_NUMERIC$multi_arr);
    foreach(
$multi_arr as $value1)
    {
        echo 
"<tr>";
        echo 
"<td>"$value1[0] . "</td>";
echo 
"<td>"$value1[3] . "</td>";
echo 
"<td>"$value1[4] . "</td>";
        echo 
"</tr>";
    }
?>
</table>
Ammorais thank you thank you thank you! ^^

You can see the demo in action HERE

Thanks again!

Last edited by jumperbee; 12-28-2009 at 02:08 AM. Reason: perfection! ^^
 
Old 12-28-2009, 02:14 AM   #22
jumperbee
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Original Poster
Rep: Reputation: 0
One last thing though,, how do i limit the number of people in this list? like to do a top 100?
 
Old 12-28-2009, 05:32 PM   #23
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
foreach($multi_arr as $value1)
{
$counter2++;
if($counter2 >= 100) break;
$counter = 0;
foreach($value1 as $value2)
{
$counter++;
if($counter != 1 && $counter != 2 ) {
echo "<td>$value2</td>";
}
}
}

Last edited by j-ray; 12-28-2009 at 05:39 PM.
 
Old 12-30-2009, 02:10 AM   #24
jumperbee
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Original Poster
Rep: Reputation: 0
ahhhhhhhhhhhh!,, i was close ^^

thank you
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need a php script to format and display a select amount of text from a file steve51184 Linux - Software 27 01-27-2009 02:29 PM
Parsing text file sandeepsudeep Linux - Newbie 7 10-09-2007 05:34 AM
parsing text file in php ohcarol Programming 1 08-25-2006 09:18 AM
inserting the data thru php in a text file suchi_s Programming 5 02-02-2005 03:28 AM
need help parsing text file airman99 Linux - General 2 10-08-2004 09:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration