Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Den här filen är till för att hantera löpande kommunikation mellan server och klient
  • Loading branch information
Harald-Rr authored Sep 9, 2019
1 parent dc7ed55 commit bcf0682
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cmd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

header('Content-Type: text/plain; charset=utf-8');

$queue = explode("\n", file_get_contents('status/queue')); //Läs in köfilen
$queue_pos = array_search($_COOKIE['queue'], $queue, true); //2=Aktuell spelare, 3=nästkommande spelare ..., false=Inte i kön
if($queue_pos != 2) { echo 'Ej först i kön!'; exit; } //Hantera inte kommandon från fel spelare!

$cmd = $_SERVER['PATH_INFO'];
$robot_ip = file_get_contents('server/robot_ip');


switch($cmd) {
//case 'kommandonamn': kod som utför kommandot; echo svar; break;
//case 'kommandonamn': kod som utför kommandot; echo svar; break;


default: echo 'okänt_kommando ', $cmd, "\n";
}















0 comments on commit bcf0682

Please sign in to comment.