<?php

require_once 'config/config.php';

 $state = '';
 $data = 'var return_msg = "NULL";';

if(!empty($_GET['state'])){$state = $_GET['state'];};
if(!empty($_GET['auth'])){$botid = $_GET['auth'];};

if(!empty($_POST['state'])){$state = $_POST['state'];};
if(!empty($_POST['auth'])){$botid = $_POST['auth'];};


//data from bd
     if($state == 'workstate')
   {

     $db = getDbInstance();
     $db->where('botid', $botid);
     $data_to_db['comment'] = 'online';
     $stat = $db->update('logs', $data_to_db);
     $data = '';
     echo $data;

     if ($stat)
     {
         $_SESSION['success'] = 'Log updated successfully!';
         // Redirect to the listing page
         header('Refresh:0;');
         // Important! Don't execute the rest put the exit/die.
         exit();
     }

   }


?>
