View file wapirate/wml/ravebabe.php

File size: 2.91Kb
<?php 
include("head.php"); 
$id=$_GET["id"]; 
$botid = "a13d14da1e36eb15"; 
$input = $_POST["input"]; 
$custid=$_POST["custid"]; 
$hostname = "www.pandorabots.com"; 
$hostpath = "/pandora/talk-xml"; 
if(islogged($sid)==false){ 
echo "<card id=\"main\" title=\"wapirate\">"; 
echo "<p align=\"center\">"; 
echo "You are not logged in<br/>"; 
echo "Or Your session has expired<br/><br/>"; 
echo "<a href=\"index.php\">Login</a>"; 
echo "</p>"; 
echo "</card>"; 
echo "</wml>"; 
exit(); 
} 
echo "<card id=\"main\" title=\"wapirate\">"; //start of main card 
echo "<p align=\"center\">"; 
echo "<br/>"; 
addonline(getuid_sid($sid),"Chatting to PirateBabe",""); 
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); 
} 
$pos = strpos($result, "<that>"); 
if($pos===false){ 
$reply = ""; 
} else { 
$pos += 6; 
$endpos = strpos($result, "</that>", $pos); 
$reply = unhtmlspecialchars(substr($result, $pos, $endpos - $pos)); 
} 
$hers = $reply; 
$hers = parsemsg($hers); 
$input=htmlspecialchars($input); 
$nick = getnick_uid($uid); 
echo "<br/><b>$nick: </b>$input<br/>"; 
echo "<b>PirateBabe: </b>$hers<br/>"; 
echo "<br/><input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>"; 
echo " Write"; 
echo "<go href=\"ravebabe.php?sid=$sid\" method=\"post\">"; 
echo "<postfield name=\"input\" value=\"$(input)\"/>"; 
echo "<postfield name=\"custid\" value=\"$custid\"/>"; 
echo "</go>"; 
echo "</anchor><br/>"; 
}else{ 
echo "Now you can chat with our ChatBot<br/> Her name is PirateBabe, have fun!<br/>"; 
echo "<input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>"; 
echo " Write"; 
echo "<go href=\"ravebabe.php?sid=$sid\" method=\"post\">"; 
echo "<postfield name=\"input\" value=\"$(input)\"/>"; 
echo "<postfield name=\"custid\" value=\"$custid\"/>"; 
echo "</go>"; 
echo "</anchor><br/>"; 
} 
echo "<br/><br/><a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a><br/>"; 
echo "</p>"; 
echo "</card>"; 

function unhtmlspecialchars( $string ){ 
$string = str_replace ( '&amp;', '&', $string ); 
$string = str_replace ( '&#039;', '\'', $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; 
} 
?>