Wml Chat Errors

Started on the old forum in June 2007 · view the original in the archive · old links redirect here

5 replies · 541 views · started 19 years ago · 1 min read

3 participants
linkrx7 #1

on wap 1.0 phones most them get file format unknown or cannot display content in chat here is my code can any1 help i cant see y they do it plus dnt have a old wap version mobile grrrz lol

any help wif this be very appreciated hav tried lots things but to no success

<?php
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
</head>
<?php

include("config.php"); 
include("core.php"); 
connectdb();
$action=$_GET["action"];
$id=$_GET["id"];
$sid = $_GET["sid"];
$rid=$_GET["rid"];
$rpw=$_GET["rpw"];
$uid = getuid_sid($sid);
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];  
$uexist = isuser($uid);

if((islogged($sid)==false)||!$uexist)
    {
        echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    
if(isbanned($uid))
    {
      echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/>
";
      echo "[b]You are Banned[/b]

";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
    $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "[b]Time Left: [/b]$rmsg
";
      $nick = getnick_uid($banto[2]);
    echo "[b]By: [/b]$nick
";
    echo "[b]Reason: [/b]$banto[1]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    $isroom = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rooms WHERE id='".$rid."'"));
    if($isroom[0]==0)
    {
        echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "This room doesn't exist anymore
";
      echo ":P see in another room

";
      echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    $passworded = mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_rooms WHERE id='".$rid."'"));
    if($passworded[0]!="")
    {
      if($rpw!=$passworded[0])
      {
        echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "You can't enter this room
";
      echo ":P stay away

";
      echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
      }
    }
    if(!canenter($rid,$sid))
    {
        echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "You can't enter this room
";
      echo ":P stay away

";
      echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    addtochat($uid, $rid);
        //This Chat Script is by Ra'ed Far'oun
        //raed_mfs@yahoo.com
        //want to see main menu...
        $timeto = 300;
        $timenw = time();
        $timeout = $timenw-$timeto;
        $deleted = mysql_query("DELETE FROM ibwf_chat WHERE timesent<".$timeout."");
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        $nick = getnick_sid($sid);

        if ($action=="")
        {
      $unreadpopup=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups WHERE unread='1' AND touid='".$uid."'"));
      if ($unreadpopup[0]<1)
      {
      echo "<card id=\"chat\" title=\"$sitename\" ontimer=\"chat.php?time=";
      echo date('dmHis');
      echo "&sid=$sid&rid=$rid&rpw=$rpw";
      echo "\">";
      }else{
      echo "<card id=\"chat\" title=\"$sitename\">";
      }
      echo "<timer value=\"200\"/>";
      addonline($uid,"Chating in $rname","chat.php?rid=$rid&rpw=$rpw");
      echo popup($sid);
      echo "<a href=\"chat.php?action=say&sid=$sid&rid=$rid&rpw=$rpw\">Write</a>
";
      echo "<a href=\"chat.php?action=options&sid=$sid&rid=$rid&rpw=$rpw\">Options</a>
";
      echo "<a href=\"chat.php?time=date('dmHis')&sid=$sid&rid=$rid&rpw=$rpw\">Refresh</a>
";
      $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'"));
      $unrd="".$unreadinbox[0]."";
      if ($unreadinbox[0]>0)
      {
      echo "<a href=\"inbox.php?action=main&sid=$sid&lstloc=cht&rid=$rid\">$unrd New Inbox!</a>
";
      }
      //echo "</p>";
      //echo "

";

        $message=$_POST["message"];
        $who = $_POST["who"];
        $rinfo = mysql_fetch_array(mysql_query("SELECT censord, freaky FROM ibwf_rooms WHERE id='".$rid."'"));
        if (trim($message) != "")
        {
          $nosm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE msgtext='".$message."'"));
          if($nosm[0]==0){
    if(!isblocked($message,$uid))
    {

      $chatok = mysql_query("INSERT INTO ibwf_chat SET  chatter='".$uid."', who='".$who."', timesent='".time()."', msgtext='".$message."', rid='".$rid."';");
      $lstmsg = mysql_query("UPDATE ibwf_rooms SET lastmsg='".time()."' WHERE id='".$rid."'");
            
      $hehe=mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$uid."'"));
      $totl = $hehe[0]+1;
      $msgst= mysql_query("UPDATE ibwf_users SET chmsgs='".$totl."' WHERE id='".$uid."'");
    }else{
    $bantime = time() + (30*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Post Msg

";
    echo "You just tried sending a msg with a link to one of the crapiest sites on earth
 The members of these sites spam here a lot, so go to that site and stay there if you don't like it here
 as a result of your stupid action:
1. you have lost your sheild
2. you have lost all your plusses
3. You are BANNED!";
        $user = getnick_sid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='[b]Wap Desire[/b] auto banned $user for spamming chat', actdt='".time()."'");
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='1', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'");
    echo "</card>";
    echo "</wml>";
    exit();
  }
            if($rinfo[1]==2)
            {
              //oh damn i gotta post this message to ravebabe :(
              //will it succeed?
              $botid = "eeb070e74e366473";
              $hostname = "www.pandorabots.com";
              $hostpath = "/pandora/talk-xml";
              $sendData = "botid=".$botid."&input=".urlencode($message)."&custid=".$custid;
              
              $result = PostToHost($hostname, $hostpath, $sendData);
              
              $pos = strpos($result, "custid=\"");
              $pos = strpos($result, "<that>");
        if ($pos === false) {
            $reply = "";
        } else {
            $pos += 6;
            $endpos = strpos($result, "</that>", $pos);
            $reply = unhtmlspecialchars2(substr($result, $pos, $endpos - $pos));
            $reply = mysql_escape_string($reply);
        }
        
        $chatok = mysql_query("INSERT INTO ibwf_chat SET  chatter='1', who='', timesent='".time()."', msgtext='".$reply." @".getnick_uid($uid)."', rid='".$rid."';");
            }
          }
          $message = "";
            }
            
            echo "
";
            $chats = mysql_query("SELECT chatter, who, timesent, msgtext, exposed FROM ibwf_chat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC");
            $counter=0;

            while($chat = mysql_fetch_array($chats))
            {
                $canc = true;
               
                
                if($counter<15)
                {
                  if(istrashed($chat[0])){
                        if($uid!=$chat[0])
                        {
                          $canc = false;
                        }
                  }
                //////good
                /*if(isignored($chat[0],$uid)){
                  $canc = false;
                }*/
                //////////good
                if($chat[0]!=$uid)
                {
                  if($chat[1]!=0)
                  {
                    if($chat[1]!=$uid)
                    {
                      $canc = false;
                    }
                  }
                }
                if($chat[4]=='1' && ismod($uid))
                {
                  $canc = true;
                }
                if($canc)
                {
                   $cmid = mysql_fetch_array(mysql_query("SELECT  chmood FROM ibwf_users WHERE id='".$chat[0]."'"));
                   
                   $iml = "";
                if(($cmid[0]!=0))
                {
                  $mlnk = mysql_fetch_array(mysql_query("SELECT img, text FROM ibwf_moods WHERE id='".$cmid[0]."'"));
                  $iml = "<img src=\"$mlnk[0]\" alt=\"$mlnk[1]\"/>";

                }
                  $chnick = getnick_uid($chat[0]);
                    $optlink = $iml.$chnick;
                  if(($chat[1]!=0)&&($chat[0]==$uid))
                  {
                    ///out
                    $iml = "<img src=\"../moods/out.gif\" alt=\"!\"/>";
                    $chnick = getnick_uid($chat[1]);
                    $optlink = $iml."PM to ".$chnick;
                  }
                  if($chat[1]==$uid)
                  {
                    ///out
                    $iml = "<img src=\"../moods/in.gif\" alt=\"!\"/>";
                    $chnick = getnick_uid($chat[0]);
                    $optlink = $iml."PM by ".$chnick;
                  }
                    if($chat[4]=='1')
                  {
                    ///out
                    $iml = "<img src=\"../moods/point.gif\" alt=\"!\"/>";
                    $chnick = getnick_uid($chat[0]);
                    $tonick = getnick_uid($chat[1]);
                    $optlink = "$iml by ".$chnick." to ".$tonick;
                  }
                  
                  $ds= date("H.i.s", $chat[2]);
                  $text = parsepm($chat[3], $sid);
                  $nos = substr_count($text,"<img src=");
                  if(isspam($text))
                  {
                    $chnick = getnick_uid($chat[0]);
                    echo "[b]Chat system:»[i]*oi! $chnick, no spamming*[/i][/b]
";
                  }
                  else if($nos>2){
                    $chnick = getnick_uid($chat[0]);
                    echo "[b]Chat system:»[i]*hey! $chnick, you can only use 2 smilies per msg*[/i][/b]
";
                  }else{
                    $sres = substr($chat[3],0,3);
                    
                    if($sres == "/me")
                    {
                        $chco = strlen($chat[3]);
                        $goto = $chco - 3;
                        $rest = substr($chat[3],3,$goto);
                        $tosay = parsepm($rest, $sid);
                        
                        echo "[b][i]*$chnick $tosay*[/i][/b]
";
                    }else{
                      if($rinfo[0]==0){
                      $tosay = getbbcode($chat[3], $sid, 0);
                      }else{
                      $tosay = parsepm($chat[3], $sid, 1);
                      }
                      
                      if($rinfo[1]==1)
                      {
                          $tosay = htmlspecialchars($chat[3]);
                          $tosay = strrev($tosay);
                        }
                  echo "<a href=\"chat.php?action=say2&sid=$sid&who=$chat[0]&rid=$rid&rpw=$rpw\">$optlink</a> - ";
                  echo $tosay."
";
                  }
                }
               
                  $counter++;
                }
                }
            }
            //echo "</p>";
        
        echo "
";
      echo "
<a href=\"chat.php?action=say&sid=$sid&rid=$rid&rpw=$rpw\">Write</a>
";
        $chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline where rid='".$rid."'"));
        echo "<a href=\"chat.php?action=inside&sid=$sid&rid=$rid&rpw=$rpw\">Who's Inside($chatters[0])</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
        echo "</card>";
}
/////////////////////////////////////////////////////SAY
        else if ($action=="say")                   {
        echo "<card id=\"say\" title=\"$sitename\">";
        
        addonline($uid,"Writing Chat Message","");
          
          echo "

Message:<input name=\"message\" type=\"text\" value=\"\" maxlength=\"255\"/>
";
          echo "<anchor>Say";
          echo "<go href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\" method=\"post\">";
          echo "<postfield name=\"message\" value=\"$(message)\"/>";
          echo "</go></anchor>

";
          //echo "<a href=\"lists.php?action=chmood&sid=$sid&page=1\">Chat mood</a>
";
          //echo "<a href=\"chat.php?action=inside&sid=$sid&rid=$rid&rpw=$rpw\">Who's Inside</a>
";
          //echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Chatroom</a>
";
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Back To $rname</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</card>";
}
/////////////////////////////////////////////////////SAY2
        else if ($action=="say2")                   {
        echo "<card id=\"say\" title=\"$sitename\">";
        echo "<p align=\"center\">";
        $unick = getnick_uid($who);
        echo "[b]Private to $unick[/b]";
        echo "</p>";
        
        addonline($uid,"Writing chat message","");
         
          echo "

Message:<input name=\"message\" type=\"text\" value=\" \" maxlength=\"255\"/>
";
          echo "<anchor>Private Msg";
          echo "<go href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\" method=\"post\">";
          echo "<postfield name=\"message\" value=\"$(message)\"/>";
          echo "<postfield name=\"who\" value=\"$who\"/>";
          echo "</go></anchor>

";
          echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$who&lstloc=cht&rid=$rid\">View $unick's Profile</a>
";
          echo "<a href=\"chat.php?action=expose&sid=$sid&who=$who&rid=$rid&rpw=$rpw\">Expose $unick</a>
";
          //echo "<a href=\"chat.php?action=inside&sid=$sid&rid=$rid&rpw=$rpw\">Who's Inside</a>
";
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Back To $rname</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</card>";
}
/////////////////////////////////////////////////////CHAT OPTIONS

        else if ($action=="options")   
                        {
        echo "<card id=\"say\" title=\"$sitename\">";        
        addonline($uid,"Chat Options","");
        echo "<p align=\"center\">";
        echo "[b]Chat Options[/b]";
        echo "</p>";
        echo "

";
        echo "<a href=\"lists.php?action=chmood&sid=$sid&page=1\">Chat Mood</a>
";
        echo "<a href=\"lists.php?action=smilies&sid=$sid\">Smilies List</a>
";
        echo "<a href=\"chat.php?action=inside&sid=$sid&rid=$rid&rpw=$rpw\">Who's Inside</a>

";
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Back To $rname</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</card>";
}
//////////////////////////////inside//////////
        else if ($action=="inside")           {
          
          addonline($uid,"Chat inside list","");
        echo "<card id=\"main\" title=\"Inside list\">";
        echo "<p align=\"center\">[b]Whos Inside[/b]";
        echo "</p>";
        echo "

";
        $inside=mysql_query("SELECT DISTINCT * FROM ibwf_chonline WHERE rid='".$rid."' and uid IS NOT NULL");
        
        while($ins=mysql_fetch_array($inside))
        {
          $unick = getnick_uid($ins[1]);
          $userl = "<a href=\"chat.php?action=say2&sid=$sid&who=$ins[1]&rid=$rid&rpw=$rpw\">$unick</a>
";
          echo "$userl";
        }
        echo "</p>";
        echo "

";
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Back To $rname</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</card>";
                                           }
        else if ($action=="expose")           {

          addonline($uid,"Chat inside list","");
        echo "<card id=\"main\" title=\"Inside list\">";
        echo "<p align=\"center\">
";
        mysql_query("UPDATE ibwf_chat SET exposed='1' WHERE chatter='".$who."' AND who='".$uid."'");
        $unick = getnick_uid($who);
        echo "$unick messages to you have been exposed to staff";
        echo "</p>";
        echo "

";
        $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
        $rname = $rooms[1];
        echo "<a href=\"chat.php?sid=$sid&rid=$rid&rpw=$rpw\">Back To $rname</a>
";
        echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox</a>
";
        echo "<a href=\"lists.php?action=buds&sid=$sid\">BuddyList</a>
";
        echo "<a href=\"index.php?action=chat&sid=$sid\">Chatrooms</a>
";
        echo forumlink($sid);
        echo "</p>";
        echo "<p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
        echo "</card>";
                                           }
        
        
?>
</wml>
amylee Principal · 1,092 posts #2

i hate reading a shit load of coding just for a small little error post the error you are getting and might be more clear to what is wrong

linkrx7 #3

i hate reading a shit load of coding just for a small little error post the error you are getting and might be more clear to what is wrong

im not getting it my users wif old mobiles are they get cannot display content or file format unknown

wizard Senior · 493 posts #4
<head>
<meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
</head>

take that out

WhiteWarrior Principal · 1,419 posts #5

take out

<head> <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/> <meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/> </head>

it should work then

WhiteWarrior Principal · 1,419 posts #6

oooo sorry wiz, was adding reply when you replyed lol

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