Chat Bot Hello

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Chat Bot Hello

    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

    #2
    search the forum with bot i hope you will find something

    or here is the chatbot script by subzero bro ---
    Code:
    <?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&amp;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&amp;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&amp;password=$password\">» Main Menu «</a>
    ";
    
    # End page:
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    }
    
    # Define function:
    function unhtmlspecialchars( $string ) {
    $string = str_replace ( '&amp;', '&', $string );
    $string = str_replace ( ''', '\'', $string );
    $string = str_replace ( '&quot;', '"', $string );
    $string = str_replace ( '&lt;', '<', $string );
    $string = str_replace ( '&gt;', '>', $string );
    $string = str_replace ( '&uuml;', '?', $string );
    $string = str_replace ( '&Uuml;', '?', $string );
    $string = str_replace ( '&auml;', '?', $string );
    $string = str_replace ( '&Auml;', '?', $string );
    $string = str_replace ( '&ouml;', '?', $string );
    $string = str_replace ( '&Ouml;', '?', $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;
    ********}
    
    
    }
    ?>
    Last edited by bijaybd; 29.07.09, 12:25.

    Comment

    Working...
    X