Lordicon Posted October 1, 2014 Share Posted October 1, 2014 Almost on a daily bases I have people asking me how I got the server status and voting stuff on my web site, Well I am going to explain it here so anyone wanting the code can come here read this and grab what they need. Also so I can refer them to this post link instead of explaining it once a day to different people. First thing first. You have to register your server on [URL="http://7daystodie-servers.com/"]7daystodie-servers[/URL] for any of these code snippets to work on your site. Also its a great way to take advantage of FrontRunnerTeks vote system on the [URL="http://games.frontrunnertek.com/index.php/7-days-to-die/7d2d-server-manager"]Server Manager[/URL]. Everything I am sharing is PHP based so please make sure your web site is configured to use PHP and the extension of your index file is .php and not .html, PHP code does not work in a .html file extension. This is the current server status that I display, You can use my online and offline images by leaving the link there or find your own. Also you can pull more data from the API link if you know what you want to display and how too do it, I left it pretty default and basic. Here is the Server Status I currently use [IMG]http://www.thedecoy.net/images/status.png[/IMG] Here is the code for the Server Status, Replace [COLOR="#B22222"]YOUR_API_KEY_HERE[/COLOR] with the API Key you get for your server at [URL="http://7daystodie-servers.com/"]7daystodie-servers[/URL]. [CODE] Address: ".$data->address.":".$data->port."Status: "; $online = $data->is_online; if ($online =="1"){ echo""; }else{ echo""; } echo"Players: ".$data->players."/".$data->maxplayers."Uptime: ".$data->uptime."%Version: ".$data->version.""; ?> [/CODE] Here is the Top 10 Voters [IMG]http://www.thedecoy.net/images/vote.png[/IMG] Here is the PHP Code for the Top 10 Votes, Replace [COLOR="#B22222"]YOUR_API_KEY_HERE[/COLOR] with the API Key you get for your server at [URL="http://7daystodie-servers.com/"]7daystodie-servers[/URL]. [CODE] '; foreach ($users as $user){ echo "".$user['nickname']." ".$user['votes']." votes"; } echo ''; [/CODE] For the Vote Button itself you will have to get that script from the [URL="http://7daystodie-servers.com/"]7daystodie-servers[/URL] site under manage your servers as every code is designed for each server. Link to comment Share on other sites More sharing options...
entopia Posted February 18, 2018 Share Posted February 18, 2018 Hi, this script works Great for us but reduce the Loadingtime... Is it Possible that you update this script to Ajax for Async Load? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.