Chat Bot Hello

Started on the old forum in July 2009 · view the original in the archive · old links redirect here

1 reply · 392 views · started 17 years ago · 1 min read

2 participants
rackla Junior · 20 posts #1

**someone knows hou to make a bot...when a user enters on chat room the bot will hello hime something like this: Bot: hello rackla welcome,how are you? Bot: what are u doing princes nick?

Because i have a chatforum but some people dontknot to say hi to others;(**

bijaybd Developer · 178 posts #2

search the forum with bot i hope you will find something

or here is the chatbot script by subzero bro ---

<?php

# Chatbot for chat ozzy Script
# Modded by SuB-ZeRo at [EMAIL="subzero@goowy.com"]subzero@goowy.com[/EMAIL]

# Send page headers:
header("Cache-Control: no-cache, must-revalidate");

# Get configuration:
include("config.inc.php");

# Clear cache:
header("Pragma: no-cache");

# Affirm content type:
header("Content-type: text/vnd.wap.wml");

# Connect to and select database:
$Connect = mysql_connect("$server","$user","$pass");
mysql_select_db("$dbname");

# Check user details:
$result = mysql_query("select * from members where username='$username' and password='$password'");
$number_of_rows = mysql_num_rows($result);
if ($number_of_rows > 0) { include("check.inc.php"); }
if ($ok>0) {
include("online.inc.php");

# Affirm doctype:
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";

# Start WML:
echo "<wml>\n";

# Set variables:
$chatbot_name = "Bizarre Babe";
$botid = "b92dd6fffe361ccd";
$chatbot_greeting = "";

# Get variables:
$input = $_POST["input"];
$custid=$_POST["custid"];
$hostname = "www.pandorabots.com";
$hostpath = "/pandora/talk-xml";

# Start page:
echo "<card id=\"\" title=\"$chatbot_name\">\n";
echo "<p align=\"center\">\n";
echo "
\n";

# Show page:
if ($input!="") {
$sendData = "botid=".$botid."&input=".urlencode($input)."&custid=".$custid;
$result = PostToHost($hostname, $hostpath, $sendData);
$pos = strpos($result, "custid=\"");
if ($pos === false) {
$custid = "";
} else {
$pos += 8;
$endpos = strpos($result, "\"", $pos);
$custid = substr($result, $pos, $endpos - $pos);
}

# Get reply:
$pos = strpos($result, "<that>");
if ($pos === false) {
$reply = "";
} else {
$pos += 6;
$endpos = strpos($result, "</that>", $pos);
$reply = unhtmlspecialchars(substr($result, $pos, $endpos - $pos));
}

# Show reply:
//echo htmlspecialchars( $reply);
$hers = $reply;
$input = htmlspecialchars($input);

# Show form:
echo "
[B]$username: [/B]$input
";
echo "[B]$chatbot_name: [/B]$hers
";
echo "
<input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>";
echo " Say!";
echo "<go href=\"chatbot.php?username=$username&password=$password\" method=\"post\">";
echo "<postfield name=\"input\" value=\"$(input)\"/>";
echo "<postfield name=\"custid\" value=\"$custid\"/>";
echo "</go>";
echo "</anchor>
";
} else {
echo $chatbot_greeting;
echo "
";
echo "<input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>";
echo " Say!";
echo "<go href=\"chatbot.php?username=$username&password=$password\" method=\"post\">";
echo "<postfield name=\"input\" value=\"$(input)\"/>";
echo "<postfield name=\"custid\" value=\"$custid\"/>";
echo "</go>";
echo "</anchor>
";
}
echo "

<a href=\"welcome.php?username=$username&password=$password\">» Main Menu «</a>
";

# End page:
echo "</p>";
echo "</card>";
echo "</wml>";
}

# Define function:
function unhtmlspecialchars( $string ) {
$string = str_replace ( '&', '&', $string );
$string = str_replace ( ''', '\'', $string );
$string = str_replace ( '"', '"', $string );
$string = str_replace ( '<', '<', $string );
$string = str_replace ( '>', '>', $string );
$string = str_replace ( 'ü', '?', $string );
$string = str_replace ( 'Ü', '?', $string );
$string = str_replace ( 'ä', '?', $string );
$string = str_replace ( 'Ä', '?', $string );
$string = str_replace ( 'ö', '?', $string );
$string = str_replace ( 'Ö', '?', $string );
return $string;
}

function PostToHost($host, $path, $data_to_send)
{

****************$result = "";
********$fp = fsockopen($host,80,$errno, $errstr, 30);
********if( $fp)
********{
************fputs($fp, "POST $path HTTP/1.0\n");
********fputs($fp, "Host: $host\n");
********fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
********fputs($fp, "Content-length: " . strlen($data_to_send) . "\n");
********fputs($fp, "Connection: close\n\n");
********fputs($fp, $data_to_send);

********while(!feof($fp)) {
********************$result .=**fgets($fp, 128);
********}
********fclose($fp);

********return $result;
********}

}

?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close