Solar Posted June 14, 2009 Share Posted June 14, 2009 Hello Everyone, I hope this is possible which probably is 100%. I want to make a quick easy little script that takes the master server list of a game and list certain players. Lets say for Example; 6 people are in a game server, there is.. Noob_Player1, Noob_Player2, Noob_Player3, Person1, Person2, Person3. fopen(); is what I am using to open the simple file which just is the IP of the Server, Name of the Server, Port of the Server, Server Version, and Players in the server. Is there a way to filter players in the server to show only people that start with "Noob_" I've tried searching on the php website for fopen codes and I can't seem to find the right one I am looking for. Heres an example of something I have started, it gets the rank, player, and score. <table border="1" cellpadding="5" cellspacing="1" bordercolor="#0099FF" id="tablerounds"> <tbody> <tr> <th>Rank</th> <th>Player</th> <th>Points</th> </tr> <?php $fp = @fopen("HIGHSCORES.txt", "rb") or die("Couldn't open file"); $data = ""; while(!feof($fp)) { $data .= fgets($fp, 1024); } fclose($fp); $values = explode("\n", $data); $run=(count($values))-1; $x=0; while($x<18){ echo "<tr><td style=\"color: rgb(192, 192, 192);\">" .($x+1). "</td><td style=\"color: rgb(192, 192, 192);\">" . substr($values[$x],9) . "</td><td style=\"color: rgb(192, 192, 192);\">". substr($values[$x],0, . "</td></tr>"; $x++; } ?> </tbody> </table> Thanks In advance! Quote Link to comment https://forums.phpfreaks.com/topic/162088-reading-certain-lines/ Share on other sites More sharing options...
Alex Posted June 14, 2009 Share Posted June 14, 2009 If I understand what you're doing correctly.. Put this inside the while loop you have: if(substr($values[$x], 0, 4) == 'Noob'){ ... } Quote Link to comment https://forums.phpfreaks.com/topic/162088-reading-certain-lines/#findComment-855318 Share on other sites More sharing options...
Solar Posted June 14, 2009 Author Share Posted June 14, 2009 THanks But. I recieve error. Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\servers.php on line 17 <div align="center"><br><table border="1" cellpadding="5" cellspacing="1" bordercolor="#0099FF" id="tablerounds"> <tbody> <tr> <th>Player</th> </tr> <?php $fp = @fopen("URLHERE", "rb") or die("Couldn't open file"); $data = ""; while(!feof($fp)) { $data .= fgets($fp, 1024); } fclose($fp); $values = explode("\n", $data); $run=(count($values))-1; $x=0; { while($x<100) substr($values[$x],9) == '-=}ID<'. "</td><td style=\"color: rgb(192, 192, 192);\">". substr($values[$x],0,. "</td></tr>"; $x++; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/162088-reading-certain-lines/#findComment-855347 Share on other sites More sharing options...
Solar Posted June 14, 2009 Author Share Posted June 14, 2009 Actually' Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\servers.php on line 16 Quote Link to comment https://forums.phpfreaks.com/topic/162088-reading-certain-lines/#findComment-855366 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.