⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wappybabe.php

📁 wap 程序 手器电脑通用
💻 PHP
字号:
<?php
/** 
*
* @package wappyCULT: wap community script
* @version 1.00 2006/09/12 21:53:27 wappy
* @copyright (c) 2004-2006 wappyCULT 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
*/
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
print "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php

include("config.php"); //load config
include("core.php"); //load main functions
connectdb();

        
        //clearnc();
$action=$_GET["action"];
$id=$_GET["id"];
$sid = $_GET["sid"];
$botid = "e1bfa150fe3664ce";
$input = $_POST["input"];
$custid=$_POST["custid"];
$hostname = "www.pandorabots.com";
$hostpath = "/pandora/talk-xml";
if(islogged($sid)==false)
    {
        echo "<card id=\"main\" title=\"wappyCULT\">";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    $uid = getuid_sid($sid);
    if(isbanned($uid))
    {
        echo "<card id=\"main\" title=\"wappyCULT\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
      echo "You are <b>Banned</b><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg<br/><br/>";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }


 echo "<card id=\"main\" title=\"wappyCULT\">";                   //start of main card
        echo "<p align=\"center\">";
        echo "<br/>";
        
        
        addonline(getuid_sid($sid),"Chatting to wappyBABE","");
    if ($input!="")
    {

        $sendData = "botid=".$botid."&input=".urlencode($input)."&custid=".$custid;
    	// Send the request to Pandorabot
    	$result = PostToHost($hostname, $hostpath, $sendData);
    	//TODO: Process the returned XML as an XML document instead of a big string.
    	// Use string manipulations to pull out the 'custid' and 'that' values.
    	$pos = strpos($result, "custid=\"");

    	// Extract the custid
    	if ($pos === false) {
    		$custid = "";
    	} else {
    		$pos += 8;
    		$endpos = strpos($result, "\"", $pos);
    		$custid = substr($result, $pos, $endpos - $pos);
    	}
    	// Extrat <that> - this is the reply from the Pandorabot
    	$pos = strpos($result, "<that>");
    	if ($pos === false) {
    		$reply = "";
    	} else {
    		$pos += 6;
    		$endpos = strpos($result, "</that>", $pos);
    		$reply = unhtmlspecialchars(substr($result, $pos, $endpos - $pos));
    	}

        //echo htmlspecialchars( $reply);
        $hers = $reply;
        $hers = parsemsg($hers);
             $input=htmlspecialchars($input);
             $nick = getnick_uid($uid);
             echo "<br/><b>$nick: </b>$input<br/>";
             echo "<b>wappyBABE: </b>$hers<br/>";
        echo "<br/><input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>";
        	echo " Say!";
		echo "<go href=\"wappybabe.php?sid=$sid\" method=\"post\">";
		echo "<postfield name=\"input\" value=\"$(input)\"/>";
		echo "<postfield name=\"custid\" value=\"$custid\"/>";
		echo "</go>";
		echo "</anchor><br/>";
    }else{
      echo "Hello, now you can chat with chatbot<br/> her name is wappyBABE, have fun<br/>";
      echo "<input type=\"text\" name=\"input\" maxlength=\"120\" value=\"$input\"/><anchor>";
		echo " Say!";
		echo "<go href=\"wappybabe.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&amp;sid=$sid\"><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;
}

?>
</wml>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -