Help with website?

So I made this website and I might let the server computer do the thing like collect data of players and then i’ll put them in the database myself. I’ve created the table and database. My problem is that I’m trying to make the bots gather data from the master list.

[php]1.

<?php 2. 3. function initBot() { 4. 5. $loadedTime = time(); 6. 7. if(file_exists("server-status_cache_details.txt") && file_exists("server-status_cache.txt")) 8. { 9. $cacheTime = file_get_contents("server-status_cache_details.txt"); 10. if($cacheTime != "" && is_numeric($cacheTime) && $loadedTime - $cacheTime < 240) 11. $servers = file("server-status_cache.txt"); 12. } 13. if(!isSet($servers)) 14. { 15. $servers = file("http://master2.blockland.us/"); 16. file_put_contents("server-status_cache_details.txt",$loadedTime); 17. file_put_contents("server-status_cache.txt",implode("",$servers)); 18. } 19. foreach($servers as $index => $server) 20. { 21. $playersNum[0] = $server[0]; 22. $playersNum[1] = $server[1]; 23. $playersNum[2] = $server[2]; 24. $playersNum[3] = $server[3]; 25. $playersNum[4] = $server[4]; 26. return; 27. } 28. echo($playersNum[0][5]); 29. echo($playersNum[1][5]); 30. echo($playersNum[2][5]); 31. echo($playersNum[3][5]); 32. echo($playersNum[4][5]); 33. } 34. 35. initBot(); 36. 37. ?>

[/php]

[php]<?php

function initBot() {

$loadedTime = time();

if(file_exists(“server-status_cache_details.txt”) && file_exists(“server-status_cache.txt”))
{
$cacheTime = file_get_contents(“server-status_cache_details.txt”);
if($cacheTime != “” && is_numeric($cacheTime) && $loadedTime - $cacheTime < 240)
$servers = file(“server-status_cache.txt”);
}
if(!isSet($servers))
{
$servers = file(“http://master2.blockland.us/”);
file_put_contents(“server-status_cache_details.txt”,$loadedTime);
file_put_contents(“server-status_cache.txt”,implode("",$servers));
}
foreach($servers as $index => $server)
{
$playersNum[0] = $server[0];
$playersNum[1] = $server[1];
$playersNum[2] = $server[2];
$playersNum[3] = $server[3];
$playersNum[4] = $server[4];
return;
}
echo($playersNum[0][5]);
echo($playersNum[1][5]);
echo($playersNum[2][5]);
echo($playersNum[3][5]);
echo($playersNum[4][5]);
}

initBot();

?>[/php]

Could you describe the problem in a little more detail? Generally with tech help we’d need:

  1. What you are trying to do
  2. What the problem is
  3. Steps taken to reproduce the problem
  4. Expected result
  5. Actual result
Sponsor our Newsletter | Privacy Policy | Terms of Service