<?php

require_once("db.php");

$idprod = addslashes($_GET['idprod']);
$dono = addslashes($_GET['dono']);

$query = "SELECT ligado FROM tablet,user "
        . " WHERE ligado = 1 AND idprod = '" . $idprod . "' "
        . " AND tablet.cliente = user.username  "
        . " AND user.status = 1 AND cliente = '" . $dono . "'";
//$query = "SELECT ligado FROM tablet,user WHERE idprod = '".$idprod."' AND tablet.cliente = user.username  AND user.status = 1 AND cliente = '".$dono."'";

$queryVersao = "SELECT versao FROM tablet_config";
$resultVersao = mysql_query($queryVersao);

$result = mysql_query($query) or die(mysql_error());

$resultRow = mysql_fetch_array($result);
$versaoRow = mysql_fetch_array($resultVersao);

if (mysql_num_rows($result) == 0) {
    echo "OFF#";
} else {
    echo 
    "ON#".
    $versaoRow['versao'];
}
?>

