<?php
echo "
";
function display_queue()
{
$host="HOST_NAME"; // Host name
$username="USERNAME"; // Mysql username
$password="PASSWORD"; // Mysql password
$db_name="trade_bots"; // Database name
$tbl_name="Queue"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password") or error(); //or die("cannot connect");
mysql_select_db("$db_name") or error(); //or die("cannot select DB");
$sql = "SELECT sid64,avatar FROM $tbl_name WHERE processed = 0 AND position != 0 ORDER BY position";
$get_queue = mysql_query($sql);
if(!$get_queue)
{
die('Could not get data: ' . mysql_error());
}
$user_inqueue = false;
$position = 1;
$sid64=$_COOKIE['steamID64'];
while($row = mysql_fetch_array($get_queue, MYSQL_ASSOC))
{
echo "".
"".str_pad($position, 4, "000", STR_PAD_LEFT)."".
"
{$row['sid64']} ";
if ($sid64 == $row['sid64'])
{
echo "
You!";
$user_inqueue = true;
if ($position == 1)
{
echo "
Estimated time to wait: $position minute.";
if ($_COOKIE['alert_played'] != 1)
{
$file='alert.mp3';
echo "
";
setcookie("alert_played","1",time()+60,'/','.thectscommunity.com',false);
}
}
else
{
echo "
Estimated time to wait: ($position*5) minutes.";
}
}
echo "".
"";
$position++;
}
if ($user_inqueue == false)
{
setcookie("queue_state","",time()-60000,'/','.thectscommunity.com',false);
}
else
{
setcookie('queue_state',1,time() + 60,'/','.thectscommunity.com',false);
}
mysql_close($conn);
}
?>