My PHP
<?php
$from = $_POST['from'];
$to = $_POST['to'];
$word = $_POST['word'];
function strProper($str) {
$noUp = array('a','an','of','the','are','at','in');
$str = trim($str);
$str = strtoupper($str[0]) . strtolower(substr($str, 1));
for($i=1; $i<strlen($str)-1; ++$i) {
if($str[$i]==' ') {
for($j=$i+1; $j<strlen($str) && $str[$j]!=' '; ++$j); //find next space
$size = $j-$i-1;
$shortWord = false;
if($size<=1000) {
$theWord = substr($str,$i+1,$size);
for($j=0; $j<count($noUp) && !$shortWord; ++$j)
if($theWord==$noUp[$j])
$shortWord = true;
} else{
$str = substr($str, 0, $i+1) . strtoupper($str[$i+1]) . substr($str, $i+2);
}
}
$i+=$size;
}
return $str;
}
if(file_exists("$from-$to.txt")){
$file = file("$from-$to.txt", FILE_IGNORE_NEW_LINES);
} else{
$file = null;
}
$array = array();
$return = array();
if($file != null){
foreach($file as $line){
if(!empty($line)){
$words = explode("=", $line);
$results = explode("|", $words[1]);
$rest = explode("|", $words[1]);
array_shift($rest);
$array[$words[0]] = $results[0];
$final = strProper(strtr(strtolower($word), $array));
$final = trim($final);
} else{
$final = null;
}
}
$return['final'] = $final;
$return['others'] = $rest;
echo json_encode($return);
}
My AJAX Call:
$("#translate_word").keyup(function(e){
var from = $("#translate_from").val();
var to = $("#translate_to").val();
$("#translate_result").html($(this).val());
$.ajax({
type: "POST",
url: "translate.php",
data: {word: $(this).val(), from: from, to: to},
success: function(html){
if(html !== ""){
var obj = $.parseJSON(html);
console.log(obj);
$("#translate_result").text(obj.final);
if(typeof obj.others === 'object'){
$.each(obj.others, function(index, val){
$("#translate_others").html($("#translate_others").html() + val + "<br />");
});
} else{
$("#translate_others").html($("#translate_others").html() + obj.others + "<br />");
}
}
}
});
});
But when I run the function it says:
Uncaught SyntaxError: Unexpected token < jquery.min.js:4
n.parseJSON jquery.min.js:4
$.ajax.success (index):135
j jquery.min.js:2
k.fireWith jquery.min.js:2
x jquery.min.js:4
b
But whenever I remove the function strProper from the PHP on line 43 it doesn't throw the error and everything works.
Related
How can I pass null PHP variable to javascript?
My code is as:
<?php
$size = null;
<< Call Rest API >>
if (<some_condition_here>) {
$size = <rest_api_value>;
}
echo "<input name='diff_size' id='diff_limit' type='test' value='$size' />";
<script>
var initial_value = $size
function checkIfChanged() {
if ($('diff_size').val() == initial_val )
{
return false;
}
return true;
}
</script>
?>
<< On submit javascript function is called >>
Error message:
Uncaught SyntaxError: Unexpected token ;
var initial_value = ;
<?php
$size = null;
<< Call Rest API >>
if (<some_condition_here>) {
$size = <rest_api_value>;
}
echo "<input name='diff_size' id='diff_limit' type='test' value='$size' />";
?>
<script>
var initial_value = '<?= $size ?>';
function checkIfChanged() {
if ($('diff_size').val() == initial_val )
{
return false;
}
return true;
}
</script>
This question already has answers here:
Uncaught SyntaxError: Unexpected token :
(26 answers)
"SyntaxError: Unexpected token < in JSON at position 0"
(40 answers)
Closed 3 years ago.
i am tying to search user search from database database include varchar and image every time i type in search box this error appears in console Uncaught SyntaxError: Unexpected token < in JSON at position 0
Here is my js code
$(function(){
$('#q').keyup(function(){
var q = $(this).val();
var html = '';
$('.form-wrapper').find('.result-wrapper').remove();
if (q !== '' && q !== null) {
$.ajax({
url: 'suggestions.php',
data: {q: q},
success: function (response){
/*var reader = new FileReader();*/
response = $.parseJSON(response);
html = generateDOM(response);
$('.form-wrapper').append(html);
},
error: function(response){
console.log(response);
}
});
}
});
});
function generateDOM(response){
var html = '<div class="result-wrapper"/>';
html += '<ul>';
$.each(response, function(index, value){
html += '<li><img src="'+value.q_links+'"/>'+value.q_title+'</li>';
});
html += '</ul>';
html += '</div>';
return html;
}
and connection to db code
<?php
function connect(){
$connection = mysqli_connect('localhost', 'root', '', 'img');
if (!$connection){
die('Error: Failed to connect DB!!');
}
return $connection;
}
function get_suggestions( $q ){
$connection = connect();
$sql = "SELECT `id`, `q_image`, `q_title`, `q_links` FROM `users` WHERE (`q_title` LIKE '%$q%')";
$result = mysqli_query($connection, $sql);
if ( mysqli_num_rows($result) ){
return mysqli_fetch_all($result, MYSQLI_ASSOC);
}
return false;
}
function debug($arg){
echo '<pre>';
print_r($arg);
echo '</pre>';
exit;
}
?>
please help me to solve this problem
error screenshot
https://drive.google.com/file/d/1S72_AmxILPZHA7nZZ0g4ZZhx0OxD9wjp/view?usp=sharing
Change your php function to
function get_suggestions( $q ){
$connection = connect();
$sql = "SELECT `id`, `q_image`, `q_title`, `q_links` FROM `users` WHERE (`q_title` LIKE '%$q%')";
$result = mysqli_query($connection, $sql);
if ( mysqli_num_rows($result) ){
return json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
return false;
}
And you ajax code to
$(function(){
$('#q').keyup(function(){
var q = $(this).val();
var html = '';
$('.form-wrapper').find('.result-wrapper').remove();
if (q !== '' && q !== null) {
$.ajax({
url: 'suggestions.php',
data: {q: q},
dataType: 'json',
success: function (response){
/*var reader = new FileReader();*/
/*response = $.parseJSON(response);*/
html = generateDOM(response);
$('.form-wrapper').append(html);
},
error: function(response){
console.log(response);
}
});
}
});
I have a function called function getContactsToForm();
This function runs on a div row called results that holds the values from my sql. On click each row is supposed to load this function grab the data from li[0] and pass it on to the rest of the function.
I seem to be getting it to work all right, however the Li's show up empty on my console log even though the table is populated. I assume that means that the sequencing is wrong.
Previously I had a working sample that had everything it table rows. The original function commented out would use the Tr tags and grab the value. The function was called within the getContacts() function and it all worked well, with the LI I am having trouble. Any thoughts?
functions.js
// JavaScript Document
//formoverlay
function formSubmit() {
$.ajax({
type: 'POST',
url: 'contactsinsert.php',
data: $('#frmBox').serialize(),
success: function(response) {
$('#success').html(response);
}
});
var form = document.getElementById('frmBox').reset();
window.location.reload();
return false;
}
$(document).ready(function() {
$('#srchbtn').click(function start() {
getContacts();
});
});
function getContacts() {
var txtsearch = $('#txtsearch').val();
$.ajax({
url: 'contactstable.php',
type: "POST",
//dataType: "json",
data: ({
txtsearch: txtsearch
}),
success: function(response) {
$('#displayContacts').html(response);
//addRowHandlers();
//getContactsToForm();
}
});
}
window.onload = getContacts();
/*function addRowHandlers() {
console.log("hi");
var table = document.getElementById("resultstable");
var rows = table.getElementsByTagName("li");
console.log(rows[0]);
for (i = 0; i < rows.length; i++) {
var currentRow = table.rows[i];
console.log(currentRow);
var createClickHandler = function(row) {
return function() {
*/
function getContactsToForm() {
var table = document.getElementById("resultstable");
var rows = table.getElementsByTagName("ul")['results'];
console.log(rows);
var lis = table.getElementsByTagName('li')[0];
console.log(lis);
var id = lis.innerHTML;
console.log(id);
//alert("id:" +id);
document.getElementById("id").value = id;
$.ajax({
url: "inputtest.php",
success: function(result) {
var frm = document.getElementById("frmBox2");
var ID = document.getElementById("id").value;
if (/\S/.test(ID)) {
ajax_request(this.action, {
"action": "fetch",
"ID": ID
}, process_response);
} else {
alert("No ID supplied");
}
function ajax_request(url, data, callback) {
var i, parts, xhr;
// if data is an object, unroll as HTTP post data (a=1&b=2&c=3 etc.)
if (typeof data == "object") {
parts = [];
for (i in data) {
parts.push(encodeURIComponent(i) + '=' + encodeURIComponent(data[i]));
}
data = parts.join("&");
}
// create an XML HTTP Request object
xhr = new XMLHttpRequest();
if (xhr) {
// set a handler for changes in ready state
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
// check for HTTP status of OK
if (xhr.status == 200) {
try {
callback(JSON.parse(xhr.responseText));
} catch (e) {
console.log(xhr.responseText); // for debug
alert("AJAX request incomplete:\n" + e.toString());
}
} else {
alert("AJAX request failed: " + xhr.status);
}
}
};
// open connection and send payload
xhr.open("GET", "inputtest.php" + "?" + data, true);
xhr.send(null);
}
}
/**
* process the response, populating the form fields from the JSON data
* #param {Object} response the JSON data parsed into an object
*/
function process_response(response) {
var frm = document.getElementById("frmBox2");
var i;
console.dir(response); // for debug
for (i in response) {
if (i in frm.elements) {
frm.elements[i].value = response[i];
}
}
}
}
});
};
// currentRow.onclick = createClickHandler(currentRow);
// }
// }
//window.onload = addRowHandlers();
function openNav() {
document.getElementById("myNav").style.width = "100%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
window.location.reload();
}
function openCon() {
document.getElementById("conNav").style.width = "100%";
}
function closeCon() {
document.getElementById("conNav").style.width = "0%";
var form = document.getElementById('frmBox').reset();
}
function enablebuttons() {
document.getElementById("insert").disabled = false;
}
contactstable.php (calls the mysql and receives contacts)
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
include_once "iud.php";
$arrayval = array();
$search=$_POST['txtsearch'];
$search1 = explode(" ", $search);
array_push($arrayval, $search1);
foreach ($arrayval as $val){
$orIndex = checkOr($val);
if(empty($orIndex)){
$resultstable = getResults($val);
$resultstable1 = buildTable($resultstable);
print($resultstable1);
}else{
print"there is an or here";
$resultstable = getResults($orIndex);
$resultstable1 = buildTable($resultstable);
print($resultstable1);
}
}
buildTable($resultstable);
/*if (empty($orIndex)){
print "no or";
$resultstable = getResults($val);
$resultstable1 = buildTable($resultstable);
print $resultstable1;
function getResults($array){
include_once "iud.php";
$db = connectDatabase();
$totalResults = array();
$length = count($array);
for ($i = 0; $i < $length; $i++){
$outputDisplay = "";
$myrowcount = 0;
$sql_statement = "SELECT id, firstname, lastname, pcat, position, state ";
//, congroup, cattype, company, position, email, website, phone, mphone, wphone, fax, add1, add2, city, state, zip, country, reference, entrydate, enteredby, notes ";
$sql_statement .= "FROM contacts ";
$sql_statement .= "WHERE (firstname LIKE '%$array[$i]%' or lastname LIKE '%$array[$i]%')";
$sql_statement .= "ORDER BY lastname, firstname";
$sqlResults = selectResults($db, $sql_statement);
$error_or_rows = $sqlResults[0];
if (substr($error_or_rows, 0 , 5) == 'ERROR')
{
$outputDisplay .= "<br />Error on DB";
$outputDisplay .= $error_or_rows;
} else {
$totalResults = array_merge($totalResults, $sqlResults);
//$totalResults = array_map("unserialize", array_unique(array_map("serialize", $totalResults)));
$arraySize = $error_or_rows;
}
}
//return $totalResults;
//print $arraySize;
//print_r($error_or_rows);
return $totalResults;
}
function buildTable($totalResults){
include_once "iud.php";
$outputDisplay = "";
//$outputDisplay .= '<table id="resultstable" style="overflow-x:auto;">';
//$outputDisplay .= '<tr><th align="left">ID</th><th align="left" width="30%">First Name</th><th align="left" width="30%">Last Name</th><th align="left" width="30%">Pages Category</th><th align="left" width="30%">Position</th><th align="left" width="30%">state</th></tr>';
$outputDisplay .= '<div id="resultstable">';
$outputDisplay .= '<div id="headers">';
$outputDisplay .= '<ul id="headers">';
$myrowcount = 0;
for ($i=0; $i < count($totalResults); $i++)
{
$myrowcount++;
$contactid = $totalResults[$i]['id'];
$firstname = $totalResults[$i]['firstname'];
$lastname = $totalResults[$i]['lastname'];
$pcat = $totalResults[$i]['pcat'];
$position = $totalResults[$i]['position'];
$state = $totalResults[$i]['state'];
$outputDisplay .= '<ul id="results">';
$outputDisplay .='<li>'.$contactid.'</li>';
$outputDisplay .= '<li><span style="font-size:10px;cursor:pointer" onclick="openCon();getContactsToForm();">'.$firstname.'</span></li>';
$outputDisplay .= '<li><span style="font-size:10px;cursor:pointer" onclick="openCon()">'.$lastname.'</span></li>';
$outputDisplay .= '<li><span style="font-size:10px;cursor:pointer" onclick="openCon()">'.$pcat.'</span></li>';
$outputDisplay .= '<li><span style="font-size:10px;cursor:pointer" onclick="openCon()">'.$position.'</span></li>';
$outputDisplay .= '<li><span style="font-size:10px;cursor:pointer" onclick="openCon()">'.$state.'</span></li>';
$outputDisplay .= '</ul>';
//echo $myrowcount;
}
$outputDisplay .= "</div>";
return $outputDisplay;
}
function checkOr($searchArray){
if (in_array("OR",$searchArray)){
$orPos = array_search("OR", $searchArray);
//$surrVal =array();
//$surrVal = array(--$orPos, ++$orPos);
if (!empty($orPos)){
$surrVal = "";
$surrVal = --$orPos;
$orValArray = array();
array_push($orValArray,$searchArray[$surrVal]);
$surrVal = $orPos+2;
array_push($orValArray,$searchArray[$surrVal]);
return $orValArray;
}
}
}
The results I get are:
209AnisBakerDC
but from the console side:
i have created a native javascript code (w/o jquery) to upload using php for server side, it seems that everything is ok and going fine, but when i selected 10 or more images, not all of them are uploaded some images are having problem, here is my javascript so far:
var uploadevent = function(event) {
event.preventDefault();
event.stopPropagation();
var xhr = new XMLHttpRequest();
var data = new FormData();
for(var i = 0; i < images.files.length; ++i) {
data.append('images[]', images.files[i]);
}
data.append('EmailAd', EmailAd);
data.append('UserID', UserID);
data.append('Studentnumber', Studentnumber);
data.append('album_name', document.getElementById('hidden_album_name').value);
var ul_album_thumbnails = document.getElementById('ul_album_thumbnails');
var rand = Math.random().toString().split('.');
var str = rand[1]; // need this to generate unique id
var newli = document.createElement('li');
newli.setAttribute('id', str);
var display = document.createElement('div'); // div element that handles preview
display.style.position = "relative";
display.style.height = "191px";
display.style.width = "180px";
display.style.cssFloat = "right";
display.style.border = "1px solid #a4a4a4";
display.style.background = "#fff";
display.style.zIndex = '998'; // this thumbnail container should be on the top
$(display).append("<progress id='progressBar' style='border:1px solid #a4a4a4;position:absolute;bottom:0px;width:178px;z-index:1' value='0' max='100'></progress>");
$(display).append("<div id='progressStatus' style='position:absolute;bottom:0px;width:178px;z-index:1;text-align:right;background:transparent'></div>");
newli.appendChild(display);
ul_album_thumbnails.insertBefore(newli, ul_album_thumbnails.childNodes[1]);
xhr.upload.addEventListener('progress', function(event) {
var percent = (event.loaded / event.total) * 100;
document.getElementById('progressBar').value = Math.round(percent);
document.getElementById('progressStatus').innerHTML = Math.round(percent) + ' %';
});
xhr.onload = function() {
if((typeof this.response == 'object' || typeof this.response) && this.status == 200 && this.response != '') {
try {
var $resp = JSON.parse(this.response);
document.body.style.overflowY = 'auto';
divback.removeAttribute('style');
$('#ul_album_thumbnails > li#' + str + ' > div').css('z-index','1');
$('li#' + str + ' > div').html('');
var newimg = document.createElement('img'), thumb = $resp.ImageUrl.replace('../', '');
newimg.src = 'temp_pages/image.php?nocache=nocache&width=180&height=180&cropratio=5:4&image=/prototype/' + thumb;
$('li#' + str + ' > div').append(newimg);
var strs = $resp.AlbumName; // album name
var divfooter = document.createElement('div');
divfooter.style.position = 'absolute';
divfooter.style.width = '180px';
divfooter.style.height = '50px';
divfooter.style.bottom = '0px';
$(divfooter).append("<a href='JavaScript:void(0)' style='font-family:Tahoma, Geneva, sans-serif;font-size:11px;font-weight:bold;position:relative;top:8px;left:3px;'>" + strs + "</a>");
$('li#' + str + ' > div').append(divfooter);
images.value = '';
document.getElementById('hidden_album_name').value = '';
} catch(SyntaxError) {
}
} else {
}
} // end of xmlhttprequest onload event
xhr.open('POST', 'ajax/ajax_upload_photo_album.php', true);
xhr.setRequestHeader('Cache-Control', 'no-cache');
xhr.send(data);
xhr.close();
}
and this is my PHP
<?php
function find($filename, $key) {
//$x = is_file($base . $filename) ? 'true' : 'false';
// count the number of period occurence as this return an array object
$countp = explode('.', $filename);
$s = (count($countp) > 2) ? end($countp) : $countp[1];
$countp[0] = md5($countp[0]) . md5(rand());
if($key == 0) {
$filename = $countp[0] . '_' . 'thumbnail' . '.' . $s;
} else {
$filename = $countp[0] . '.' . $s;
}
return strtolower($filename);
}
$base_url = '../user/images/albums/';
$EmailAd = $_REQUEST['EmailAd'];
$username = explode('#', $EmailAd);
$UserID = $_REQUEST['UserID'];
$Studentnumber = $_REQUEST['Studentnumber'];
$album_name = $_REQUEST['album_name'];
$base_url .= $UserID.'_'.$Studentnumber.'_'.$username[0].'/'.$UserID.'_'.$Studentnumber.'_'.$username[0].'_'.$album_name.'/';
$tmp = array();
foreach($_FILES['images']['name'] as $key => $name) {
//$sizexy = getimagesize($w);
$image_info = getimagesize($_FILES['images']['tmp_name'][$key]);
$imageWidth = $image_info[0];
$imageHeight = $image_info[1];
$f = $base_url . $imageWidth . '_' . $imageHeight . '_' . find($name, $key);
if($_FILES['images']['error'][$key] == 0 && move_uploaded_file($_FILES['images']['tmp_name'][$key], $f)) {
if($key == 0) {
$g = array('ImageUrl' => $f, 'BaseUrl' => $base_url, 'AlbumName' => $album_name, 'ImageCount' => count($_FILES['images']['name']), 'Created' => date('h:ia', filectime($base_url)));
}
}
}
echo json_encode($g);
clearstatcache();
?>
is there alternative code for this?
I'm trying to create a gameserver query for my website, and I want it to load the content, save it, and echo it later. However, it doesn't seem to be echoing. It selects the element by ID and is supposed to echo the content of the VAR.
Here's my HTML code:
<center><div id="cstrike-map"><i class="fa fa-refresh fa-spin"></i> <b>Please wait ...</b><br /></div>
JavaScript:
<script type="text/javascript">
var map = "";
var hostname = "";
var game = "";
var players = "";
$.post( "serverstats-cstrike/cstrike.php", { func: "getStats" }, function( data ) {
map = ( data.map );
hostname = ( data.hostname );
game = ( data.game );
players = ( data.players );
}, "json");
function echoMap(){
document.getElementByID("cstrike-map");
document.write("<h5>Map: " + map + "</h5>");
}
</script>
PHP files:
query.php
/* SOURCE ENGINE QUERY FUNCTION, requires the server ip:port */
function source_query($ip)
{
$cut = explode(":", $ip);
$HL2_address = $cut[0];
$HL2_port = $cut[1];
$HL2_command = "\377\377\377\377TSource Engine Query\0";
$HL2_socket = fsockopen("udp://".$HL2_address, $HL2_port, $errno, $errstr,3);
fwrite($HL2_socket, $HL2_command); $JunkHead = fread($HL2_socket,4);
$CheckStatus = socket_get_status($HL2_socket);
if($CheckStatus["unread_bytes"] == 0)
{
return 0;
}
$do = 1;
while($do)
{
$str = fread($HL2_socket,1);
$HL2_stats.= $str;
$status = socket_get_status($HL2_socket);
if($status["unread_bytes"] == 0)
{
$do = 0;
}
}
fclose($HL2_socket);
$x = 0;
while ($x <= strlen($HL2_stats))
{
$x++;
$result.= substr($HL2_stats, $x, 1);
}
$result = urlencode($result); // the output
return $result;
}
/* FORMAT SOURCE ENGINE QUERY (assumes the query's results were urlencode()'ed!) */
function format_source_query($string)
{
$string = str_replace('%07','',$string);
$string = str_replace("%00","|||",$string);
$sinfo = urldecode($string);
$sinfo = explode('|||',$sinfo);
$info['hostname'] = $sinfo[0];
$info['map'] = $sinfo[1];
$info['game'] = $sinfo[2];
if ($info['game'] == 'garrysmod') { $info['game'] = "Garry's Mod"; }
elseif ($info['game'] == 'cstrike') { $info['game'] = "Counter-Strike: Source"; }
elseif ($info['game'] == 'dod') { $info['game'] = "Day of Defeat: Source"; }
elseif ($info['game'] == 'tf') { $info['game'] = "Team Fortress 2"; }
$info['gamemode'] = $sinfo[3];
return $info;
}
cstrike.php
include('query.php');
$ip = 'play1.darkvoidsclan.com:27015';
$query = source_query($ip); // $ip MUST contain IP:PORT
$q = format_source_query($query);
$host = "<h5>Hostname: ".$q['hostname']."</h5>";
$map = "<h5>Map: ".$q['map']."</h5>";
$game = "<h5>Game: ".$q['game']."</h5>";
$players = "Unknown";
$stats = json_encode(array(
"map" => $map,
"game" => $game,
"hostname" => $host,
"players" => $players
));
You need to display the response in the $.post callback:
$.post( "serverstats-cstrike/cstrike.php", { func: "getStats" }, function( data ) {
$("#map").html(data.map);
$("#hostname").html(data.hostname);
$("#game").html(data.game);
$("#players").html(data.players);
}, "json");
You haven't shown your HTML, so I'm just making up IDs for the places where you want each of these things to show.
There are some things that I can't understand from your code, and echoMap() is a bit messed up... but assuming that your php is ok it seems you are not calling the echomap function when the post request is completed.
Add echoMap() right after players = ( data.players );
If the div id you want to modify is 'cstrike-map' you could use jQuery:
Change the JS echoMap to this
function echoMap(){
$("#cstrike-map").html("<h5>Map: " + map + "</h5>");
}
So what I did was I had to echo the content that I needed into the PHP file, then grab the HTML content and use it.
That seemed to be the most powerful and easiest way to do what I wanted to do in the OP.
<script type="text/javascript">
$(document).ready(function(){
$.post("stats/query.cstrike.php", {},
function (data) {
$('#serverstats-wrapper-cstrike').html (data);
$('#serverstats-loading-cstrike').hide();
$('#serverstats-wrapper-cstrike').show ("slow");
});
});
</script>
PHP
<?php
include 'query.php';
$query = new query;
$address = "play1.darkvoidsclan.com";
$port = 27015;
if(fsockopen($address, $port, $num, $error, 5)) {
$server = $query->query_source($address . ":" . $port);
echo '<strong><h4 style="color:green">Server is online.</h4></strong>';
if ($server['vac'] = 1){
$server['vac'] = '<img src="../../images/famfamfam/icons/tick.png">';
} else {
$server['vac'] = '<img src="../../images/famfamfam/icons/cross.png">';
}
echo '<b>Map: </b>'.$server['map'].'<br />';
echo '<b>Players: </b>'.$server['players'].'/'.$server['playersmax'].' with '.$server['bots'].' bot(s)<br />';
echo '<b>VAC Secure: </b> '.$server['vac'].'<br />';
echo '<br />';
} else {
echo '<strong><h4 style="color:red">Server is offline.</h4></strong>';
die();
}
?>