<?php
include "respond.php";
/*
$content = file("max.txt");
$content=$content[0];
echo "$content";
*/
if (isset($HTTP_POST_VARS['input'])){
$numselects=0;
// Start the session or get the existing session.
session_start();
$myuniqueid=session_id();
// Here is where we get the reply.
$botresponse=replybotname($HTTP_POST_VARS['input'],$myuniqueid,$HTTP_POST_VARS['botname']);
// Print the results.
print "<B>Testbot: " . $botresponse->response . "<BR></b>";
//print "<BR><BR>execution time: " . $botresponse->timer;
//print "<BR>numselects= $numselects";
//print_r($botresponse->inputs);
//print_r($botresponse->patternsmatched);
// Include a form so they can say more. Note the hidden part for people that do not have trans sid on but want non-cookie users to be able to use the system.
?>
<html>
<head>
<title>Talk to Chat-bot</title>
</head>
<body>
<form name="form1" method="post" action="talk.php">
<input type="hidden" name="<?=session_name()?>" value="<?=$uid?>">
<input type="hidden" name="botname" value="<?=$HTTP_POST_VARS['botname']?>">
You: <input type="text" name="input" size="55">
<input type="submit" name="Submit" value="Ask">
</form>
</body>
</html>
<?
}
else {
$availbots=array();
// Get all the names of our bots.
$query="select botname from bots";
$selectcode = mysql_query($query);
if ($selectcode){
if(!mysql_numrows($selectcode)){
}
else{
while ($q = mysql_fetch_array($selectcode)){
$availbots[]=$q[0];
}
}
}
?>
<html>
<head>
<title>Talk to Chat-bot</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis620">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="talk.php">
Talk to: <select name="botname">
<?
foreach ($availbots as $onebot){
print "<option value=\"$onebot\">$onebot</option>";
}
?>
</select><BR>
You: <input type="text" name="input" size="55">
<input type="submit" name="Submit" value="Ask">
</form>
</body>
</html>
<?
}
?>