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

$streamStat = $_POST['streamStat'];
$userName = $_POST['userName'];
$userPass = $_POST['userPass'];

$response = "";

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

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

$iterations = 1000;
$salt = count($userName) * 23;
$hashPass = hash_pbkdf2("sha256", $userPass, $salt, $iterations, 25);

$sql = "UPDATE accounts SET streamstatus = '$streamStat' WHERE username = '$userName' and userpass = '$hashPass'";
if($mysqli->query($sql) === true){
    $response = "ok";
} else{
   $response = "notok";
}

$mysqli->close();

echo $response;

?>