2 /***************************************
3 * http://www.program-o.com
7 * AUTHOR: Elizabeth Perreau and Dave Morton
9 * DETAILS: Searches the database for all active chatbots, returning a JSON encoded array of ID/name pairs
10 ***************************************/
12 $time_start = microtime(true);
13 $script_start = $time_start;
14 $last_timestamp = $time_start;
16 require_once("config/global_config.php");
18 require_once(_LIB_PATH_
. 'PDO_functions.php');
19 include_once (_LIB_PATH_
. "error_functions.php");
20 include_once(_LIB_PATH_
. 'misc_functions.php');
21 ini_set('error_log', _LOG_PATH_
. 'getbots.error.log');
24 $sql = "select `bot_id`, `bot_name` from `$dbn`.`bots`;";
25 $result = db_fetchAll($sql, null, __FILE__
, __FUNCTION__
, __LINE__
);
26 $bots = array('bots'=>array());
27 foreach ($result as $row)
29 $bot_id = $row['bot_id'];
30 $bot_name = $row['bot_name'];
31 $bots['bots'][$bot_id] = $bot_name;
33 header('Content-type: application/json');
34 $out = json_encode($bots);