//echo 'data read error'; exit(); if($_GET) $task = $_GET['task']; switch ($task) { case 'ajax': // read the file and get the string echo file_get_contents('ksstats.txt'); exit(); break; case 'data': file_put_contents ('ksstats.txt', $_GET['data'] ); exit(); break; default: $defaultArray = json_decode(file_get_contents('./ksstats.txt'), TRUE); foreach($defaultArray[0] AS $key => $value){ $$key = html_entity_decode($value,ENT_COMPAT,'UTF-8'); } break; } ?>