0) { # Affirm doctype: echo ''; echo ''; # Start WML: echo "\n"; # Set variables: $chatbot_name = "Fimi Babe"; $title = "Fimizone.org"; $botid = "b92dd6fffe361ccd"; $chatbot_greeting = "Hello!"; # Get variables: $input = $_POST["input"]; $custid= $_POST["custid"]; $hostname = "www.pandorabots.com"; $hostpath = "/pandora/talk-xml"; # Start page: echo "\n"; echo "

\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, ""); if ($pos === false) { $reply = ""; } else { $pos += 6; $endpos = strpos($result, "", $pos); $reply = unhtmlspecialchars(substr($result, $pos, $endpos - $pos)); } # Show reply: //echo htmlspecialchars( $reply); $hers = $reply; $input = htmlspecialchars($input); # Show form: echo "
ME: $input
"; echo "$chatbot_name: $hers
"; echo "
"; echo "Say!"; echo ""; echo ""; echo ""; echo ""; echo "
"; } else { echo $chatbot_greeting; echo "
"; echo ""; echo " Say!"; echo ""; echo ""; echo ""; echo ""; echo "
"; } echo "

Fimi Zone Home
"; # End page: echo "

"; echo "
"; echo "
"; } # 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; } } ?>