<?php
require '../connForms/acdet.php';

//$streamStat = "streamon";
$userName = $_POST['mobName'];
$streamStat = "";

$response = "";

$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);

//$userName = $mysqli->real_escape_string($userName);


//check to see if username if in database table
//$sqlName = "SELECT username = '$userName' FROM accounts WHERE streamstatus = '$streamStat'";
$sqlName = "SELECT streamstatus FROM accounts WHERE username='$userName'";
$resultName = $mysqli->query($sqlName);


if($resultName -> num_rows > 0){
    $row = $resultName->fetch_assoc();
    $streamStat = $row["streamstatus"];
    echo $streamStat;
    /*
    echo json_encode([
        "Message" => "Connection successful",
        "Status" => "streamon"
    ]); */
} 
/* else  {
    
    echo json_encode([
        "Message" => "Could not connect",
        "Status" => "streamoff"
    ]); 
} */

$mysqli->close();




?>