} */ //resp is type of inquery if (!isset($overrideAction)) { $resp = parseSentence($_REQUEST); if ($resp != "command") { $_SESSION['action'] = 0; } $statement = $_REQUEST['sentence']; dbQuery("INSERT INTO conversations (statement, which, userId, type) VALUES ('{$statement}', 'human', 'mike', '{$resp}')"); $result = determineResponse($_REQUEST, $resp); } else { //echo('did this one'); $_REQUEST['sentence'] = $overrideAction; $resp = parseSentence($_REQUEST); if ($resp != "command") { $_SESSION['action'] = 0; } $result = determineResponse($_REQUEST, "command"); } $answer = $result['answer']; $answerType = $result['answerType']; dbQuery("INSERT INTO conversations (statement, which, userId, type) VALUES ('{$answer}', 'humanoid', 'allini', '{$answerType}')"); //add callback for jsonp if (isset($REQUEST['callback'])) { echo $_GET['callback'] . '(' . json_encode($result) . ')'; } else { echo json_encode($result); } function determineResponse($inp, $type)
while (!feof($srcFile)) { $inString = fgets($srcFile, 1024); switch ($count) { case 0: $splitStr = split(",", $inString); $outString = "insert into onthebible.BibleTrans (transId, langId, description) values ( '" . $splitStr[0] . "', '" . $splitStr[1] . "', '" . $splitStr[2] . "');\n"; $transId = $splitStr[0]; break; case 1: $splitStr = split(",", $inString); for ($i = 0; $i < count($splitStr); $i++) { $outString = $outString . "insert into onthebible.BibleTransTitle (transId ,TitleId, TransTitle) values ('" . $transId . "', " . ($i + 1) . ", '" . $splitStr[$i] . "');\n"; } break; default: $s = parseSentence($transId, $inString); if ($s != null) { $outString = "insert into onthebible.BibleSentence (sentenceId, transId, TitleId, page, row, sentence) values(" . $s[0] . ", " . $s[1] . "," . $s[2] . "," . $s[3] . "," . $s[4] . ",'" . $s[5] . "');\n"; } else { $outString = null; } break; } if ($outString == null) { break; } fputs($dstFile, $outString); echo $outString; $outString = ""; if ($count == $limit) { break;