Avatar billede partymann Nybegynder
04. december 2002 - 18:13 Der er 13 kommentarer og
1 løsning

hmm HJÆLP

hej alle sammen...
Jeg sidder med et problem...

Jeg har nogle smilyes der skal ind i en chat...
men chatten er lavet  til at kun tage billeder i 16*16 og det vil jeg ændre hvordan får jeg den til at tage billede i den str. som billede er lavet i...
koden ser sådan ud.:
$smileyclose = ".gif\" WIDTH=\"16\" HEIGHT=\"16\">";

Jeg har prøvet at lave den til hvor der står 100% der hvor der står 16 men så kommer den til at fylde det hele....altså bliver den meget stor...
Det er til denne side www.toyotaklub.dk og så under chatten...

Mvh
  Partymann
Avatar billede htm Nybegynder
04. december 2002 - 18:16 #1
Avatar billede htm Nybegynder
04. december 2002 - 18:17 #2
Du kan fjerne atributterne width og height helt! Så vil de blive smidt ind i chatten i den faktiske størrelse!
Avatar billede htm Nybegynder
04. december 2002 - 18:18 #3
$smileyclose = ".gif\">";
Avatar billede partymann Nybegynder
04. december 2002 - 18:19 #4
nej så kommer den med en fejl
Avatar billede htm Nybegynder
04. december 2002 - 18:25 #5
Hvilken fejl?
Avatar billede partymann Nybegynder
04. december 2002 - 18:27 #6
her er hele koden:

<?// -*- C++ -*-
/*  ********************************************************************  **
**  Copyright (C) 1995-2000 Michael Oertel, Frerk Meyer                    **
**  Copyright (C) 2000-    PHPOpenChat Development Team                  **
**  http://www.ortelius.de/phpopenchat/                                    **
**                                                                          **
**  This program is free software. You can redistribute it and/or modify  **
**  it under the terms of the PHPOpenChat License Version 1.0              **
**                                                                          **
**  This program is distributed in the hope that it will be useful,        **
**  but WITHOUT ANY WARRANTY, without even the implied warranty of        **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  **
**                                                                          **
**  You should have received a copy of the PHPOpenChat License            **
**  along with this program.                                              **
**  ********************************************************************  */


/**
* Replace ASCII Emoticons with images
*
* A user has the possibility of calling its own icon if it exist.
* With ':me' if the user speaks to somebody, with :you if somebody
* speaks to the user.
*
* @param string $chat
* @param string $nick
* @param string $to_nick
* @author Michael Oertel <Michael@ortelius.de>
* @global $PRIVAT_ICON_PATH,$ICON_PATH,$NO_NO_WORDS,$IRC_COMMANDS
* @return string contains the modified chat line
*/
function filter ($chat,$nick,$to_nick){

  /**
  * To interpret IRC like commands
  */
  global $IRC_COMMANDS;
  if($IRC_COMMANDS && substr($chat,0,1)=="/"){ //parse here only if IRC-commands are allowed and an irc-command is given
    if(substr($chat,0,5) == "/join"){ //the nick 'join' is not allowed by default
      global $db_handle;

      eregi("^/([^ ]*) (.*)$",$chat,$split);

      //check if the channel exists
      $result = mysql_query("SELECT Name FROM channels WHERE User_Channel=0 AND Name LIKE '$split[2]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $tmp_channel = mysql_result($result,0,"Name");

        //check how many chatters are in the choosen channel
        $check = mysql_query("SELECT count(*) AS count FROM chat WHERE Raum = '$tmp_channel'",$db_handle);
        $num = mysql_result($check,0,"count");
        mysql_free_result($check);

        //check how many chatters are allowed in the channel
        $check = mysql_query("SELECT Teilnehmerzahl FROM channels WHERE Name = '$tmp_channel'",$db_handle);
        $num_allowed = mysql_result($check,0,"Teilnehmerzahl");
        mysql_free_result($check);

        if(($num_allowed==0)||($num<$num_allowed)){
          global $oldchannel,$channel,$enters,$leaves,$chancode,$salt_channels,$chancrypt;
          $oldchannel  = $channel;
          $channel      = $tmp_channel;
          $chancode    = urlencode($channel);

          //get the specific data of the new channel
          $checkchannel = 1;
          global $chanpasswd,$chanbgcolor,$channickcolor,$oldchan_is_moderated,$is_moderated,$chanthese,$chanexit,$old_user_channel,$user_channel,$changrafik;
          include("channels_inc.php");

          //the user has access permission for this page
          //calculate the check sum of the current channel
          $chancrypt=Crypt($channel,$salt_channels);

          $enters    = 1;
          $leaves    = 1;
        }
      }
      $chat = "";
      unset ($split);
      unset ($tmp_channel);
      @mysql_free_result($result);
    }elseif(substr($chat,0,3) == '/me'){ //the nick 'me' is not allowed by default
      global $me_comment;
      $me_comment=true;
      $chat=str_replace('/me','',$chat);
    }elseif(substr($chat,0,9) == '/announce'){
      global $db_handle,$channel,$SAYS;
      // check if the current chatter a godfather
      $result    = mysql_query("SELECT count(*) AS count FROM paten WHERE Nick = '$nick'");
      $godfather = mysql_result($result,0,"count");
      if($godfather){
        eregi("^/[^ ]* (.*)$",$chat,$split);
        $chat = str_replace('/announce','',$chat);
        $chat = '';
        $line = '<!-- |'.$nick.'|0|0|0|-->&nbsp;<font color="#ffffff">'.$SAYS.':</font><font color="#ee0000"><h3> '.$split[1].'</h3></font>';
        $result=mysql_query("SELECT Name FROM channels",$db_handle);
        while($row=mysql_fetch_object($result)){
          schreib_zeile($line,$row->Name);
        }
        global $ownLine;
        $ownLine=$line;
        unset($line);
      }else{
        $chat = '';
      }
      @mysql_free_result($result);
    }elseif(substr($chat,0,7) == "/locate"){ //the nick 'locate' is not allowed by default
      global $db_handle,$wispers_to_nick;
      $wispers_to_nick=$nick;
      eregi("^/[^ ]* (.*)$",$chat,$split);

      //check if the channel exists
      $result = mysql_query("SELECT Nick,Raum FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        global $IS_CHATTING_IN;
        $chat=mysql_result($result,0,"Nick") . " $IS_CHATTING_IN \"" . mysql_result($result,0,"Raum") . "\"";
      }else{
        global $NOT_ONLINE;
        $chat="$split[1] $NOT_ONLINE";
      }
      global $sys_msg;
      $sys_msg    = true;
      mysql_free_result($result);
    }elseif(substr($chat,0,4) == "/msg"){ //the nick 'join' is not allowed by default
      global $says_to_nick,$say_to_nick,$wispers_to_nick,$db_handle;

      eregi("^/[^ ]* ([^ ]*).*$",$chat,$split);

      //check if the user exists
      $result = mysql_query("SELECT Nick FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $says_to_nick = "";
        $speaking = "wispers_to_nick";
        $$speaking = mysql_result($result,0,"Nick");
        $wistpers_to_nick = $$speaking;
        $say_to_nick = $$speaking;
      }
      $chat = str_replace("/msg $split[1]","",$chat);
      unset ($split);
      mysql_free_result($result);
    }elseif(substr($chat,0,1) == "/"){
      global $says_to_nick,$say_to_nick,$wispers_to_nick,$db_handle;

      eregi("^/([^ ]*).*$",$chat,$split);

      //check if the user exists
      $result = mysql_query("SELECT Nick FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $wispers_to_nick = "";
        $speaking = "says_to_nick";
        $$speaking = mysql_result($result,0,"Nick");
        $say_to_nick = $$speaking;
      }
      $chat = str_replace("/$split[1]","",$chat);
      unset ($split);
      mysql_free_result($result);
    }
  }

  /**
  * Array containing the possible Emoticons
  *
  * @var array $smiley
  */
  if (empty($smiley)) {
    unset ($smileyfile);
    $smiley[]=":-))"; $smileyfile[]="bigsmile";
    $smiley[]="B-))"; $smileyfile[]="evilsmile";
    $smiley[]="=:-)"; $smileyfile[]="punk";
    $smiley[]=":-)="; $smileyfile[]="oldman";
    $smiley[]="~:-)"; $smileyfile[]="sunburn";
    $smiley[]="[:-)"; $smileyfile[]="hat";
    $smiley[]=":-)"; $smileyfile[]="smile";
    $smiley[]=";-)"; $smileyfile[]="blink";
    $smiley[]=":-x"; $smileyfile[]="kiss";
    $smiley[]=":h)"; $smileyfile[]="heart";
    $smiley[]=":-P"; $smileyfile[]="tongue";
    $smiley[]=":-("; $smileyfile[]="sad";
    $smiley[]="%-)"; $smileyfile[]="peer";
    $smiley[]=":*)"; $smileyfile[]="drunk";
    $smiley[]=":-/"; $smileyfile[]="hmmm";
    $smiley[]=":-p"; $smileyfile[]="tongue";
    $smiley[]=":ct"; $smileyfile[]="ct";
    $smiley[]="@}--"; $smileyfile[]="flower";
    $smiley[]="@}X-"; $smileyfile[]="rose";
    $smiley[]="8)"; $smileyfile[]="frog";
    $smiley[]="B-)"; $smileyfile[]="glasses";
    $smiley[]=":-D"; $smileyfile[]="laugh";
    $smiley[]=":T::"; $smileyfile[]="toffline";
    $smiley[]=":-G-"; $smileyfile[]="cigarette";
    $smiley[]=":-|"; $smileyfile[]="hmm";
    $smiley[]=":-O"; $smileyfile[]="amaze";
    $smiley[]=":o)"; $smileyfile[]="clown";
    $smiley[]=":o"; $smileyfile[]="clown";
    $smiley[]=":ei:"; $smileyfile[]="eggs";
    $smiley[]=".-)"; $smileyfile[]="oneeye";
    $smiley[]="(:(="; $smileyfile[]="ghost";
    $smiley[]=":viv"; $smileyfile[]="vivian";
    $smiley[]=":-Q"; $smileyfile[]="smoker";
    $smiley[]=":-]"; $smileyfile[]="sarcasm";
    $smiley[]="&gt;-"; $smileyfile[]="female";
    $smiley[]=":-"; $smileyfile[]="male";
    $smiley[]="(*)"; $smileyfile[]="sun";
    $smiley[]='(\")'; $smileyfile[]="rain";
    $smiley[]="*(~)"; $smileyfile[]="littlesun";
    $smiley[]="(~)"; $smileyfile[]="cloud";
    $smiley[]="~=="; $smileyfile[]="candle";
    $smiley[]="~--"; $smileyfile[]="dynamite";
    $smiley[]=":[=]"; $smileyfile[]="basket";
    $smiley[]=":pkl)"; $smileyfile[]="piss";
    $smiley[]=":mm)"; $smileyfile[]="colored";
    $smiley[]=":ms)"; $smileyfile[]="alien";
    $smiley[]="|-)"; $smileyfile[]="yawn";
    $smiley[]="|-O"; $smileyfile[]="yawn";
    $smiley[]=":,-)"; $smileyfile[]="luckytear";
    $smiley[]=":,-("; $smileyfile[]="sadtear";
    $smiley[]=":.|"; $smileyfile[]="fingers";
    $smiley[]=":#D"; $smileyfile[]="boat";
    $smiley[]="~o"; $smileyfile[]="bomb";
    $smiley[]=":santa"; $smileyfile[]="santa";
  }

  if(ereg("-|:|\~|\||)",$chat)){
    unset ($s);
    $pattern = "\:me";
    ereg("(.*)($pattern)(.*)",$chat,$s);
    if ($s[2]) {

      global $PRIVAT_ICON_PATH;
      $smileydir=$PRIVAT_ICON_PATH;
      $smileypath=$smileydir.strtolower(str_replace(" ","_",$nick)).".gif";
      if(@LinkInfo($smileypath)>=0){
    $smileypath=$smileydir.urlencode(strtolower(str_replace(" ","_",$nick))).".gif";
    $chat = $s[1]."<IMG SRC=\"".$smileypath."\" WIDTH=\"16\" HEIGHT=\"16\">".$s[3];
      }
    }
    unset($s);
    $pattern="\:you";
    ereg("(.*)($pattern)(.*)",$chat,$s);
    if ($s[2]) {

      global $PRIVAT_ICON_PATH;
      $smileydir=$PRIVAT_ICON_PATH;
      $smileypath=$smileydir.strtolower(str_replace(" ","_",$to_nick)).".gif";
      if(@LinkInfo($smileypath)>=0){
    $smileypath=$smileydir.urlencode(strtolower(str_replace(" ","_",$to_nick))).".gif";
    $chat = $s[1]."<IMG SRC=\"".$smileypath."\" WIDTH=\"16\" HEIGHT=\"16\">".$s[3];
      }
    }
    unset($s);

    global $ICON_PATH;
    $smileydir=$ICON_PATH;
    $smileyopen = "<IMG SRC=\"".$smileydir;
    $smileyclose = ".gif\">";
    reset($smiley);
    reset($smileyfile);
    $error=error_reporting(0);
    do {
      $pattern=preg_quote(current($smiley));
      ereg("(.*)($pattern)(.*)",$chat,$s);
      if ($s[2]) {
        /*$s[2] = rawurlencode(str_replace("/","\\",str_replace("&gt;",">",$s[2])));*/
        $chat = $s[1].$smileyopen.current($smileyfile).$smileyclose.$s[3]; break;}
        next($smileyfile);
    } while (next($smiley));
    error_reporting($error);
  }
  global $NO_NO_WORDS;
  $chat = eregi_replace($NO_NO_WORDS,"...oops...",$chat);

  return $chat;
}//end func filter
?>
Avatar billede partymann Nybegynder
04. december 2002 - 18:28 #7
den fejl der kom var pga jeg glemte > men nu kommer den ikke med nogen fejl men de er stadig i 16*16
Avatar billede htm Nybegynder
04. december 2002 - 18:33 #8
Størrelsen står også defineret hele vejen ned i scriptet! Prøv og slet de steder hvor atribbuttet width og height optræder med værdien 16 eks her:

$smileypath=$smileydir.urlencode(strtolower(str_replace(" ","_",$nick))).".gif";
    $chat = $s[1]."<IMG SRC=\"".$smileypath."\" WIDTH=\"16\" HEIGHT=\"16\">".$s[3];
Avatar billede partymann Nybegynder
04. december 2002 - 18:39 #9
Parse error: parse error in /home/httpd/http/toyotaklub.dk/www/chat/filter_inc.php on line 239

Fatal error: Call to undefined function: filter() in /home/httpd/http/toyotaklub.dk/www/chat/input.php on line 287
Avatar billede partymann Nybegynder
04. december 2002 - 18:39 #10
og koden ser så ledes ud nu:

<?// -*- C++ -*-
/*  ********************************************************************  **
**  Copyright (C) 1995-2000 Michael Oertel, Frerk Meyer                    **
**  Copyright (C) 2000-    PHPOpenChat Development Team                  **
**  http://www.ortelius.de/phpopenchat/                                    **
**                                                                          **
**  This program is free software. You can redistribute it and/or modify  **
**  it under the terms of the PHPOpenChat License Version 1.0              **
**                                                                          **
**  This program is distributed in the hope that it will be useful,        **
**  but WITHOUT ANY WARRANTY, without even the implied warranty of        **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  **
**                                                                          **
**  You should have received a copy of the PHPOpenChat License            **
**  along with this program.                                              **
**  ********************************************************************  */


/**
* Replace ASCII Emoticons with images
*
* A user has the possibility of calling its own icon if it exist.
* With ':me' if the user speaks to somebody, with :you if somebody
* speaks to the user.
*
* @param string $chat
* @param string $nick
* @param string $to_nick
* @author Michael Oertel <Michael@ortelius.de>
* @global $PRIVAT_ICON_PATH,$ICON_PATH,$NO_NO_WORDS,$IRC_COMMANDS
* @return string contains the modified chat line
*/
function filter ($chat,$nick,$to_nick){

  /**
  * To interpret IRC like commands
  */
  global $IRC_COMMANDS;
  if($IRC_COMMANDS && substr($chat,0,1)=="/"){ //parse here only if IRC-commands are allowed and an irc-command is given
    if(substr($chat,0,5) == "/join"){ //the nick 'join' is not allowed by default
      global $db_handle;

      eregi("^/([^ ]*) (.*)$",$chat,$split);

      //check if the channel exists
      $result = mysql_query("SELECT Name FROM channels WHERE User_Channel=0 AND Name LIKE '$split[2]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $tmp_channel = mysql_result($result,0,"Name");

        //check how many chatters are in the choosen channel
        $check = mysql_query("SELECT count(*) AS count FROM chat WHERE Raum = '$tmp_channel'",$db_handle);
        $num = mysql_result($check,0,"count");
        mysql_free_result($check);

        //check how many chatters are allowed in the channel
        $check = mysql_query("SELECT Teilnehmerzahl FROM channels WHERE Name = '$tmp_channel'",$db_handle);
        $num_allowed = mysql_result($check,0,"Teilnehmerzahl");
        mysql_free_result($check);

        if(($num_allowed==0)||($num<$num_allowed)){
          global $oldchannel,$channel,$enters,$leaves,$chancode,$salt_channels,$chancrypt;
          $oldchannel  = $channel;
          $channel      = $tmp_channel;
          $chancode    = urlencode($channel);

          //get the specific data of the new channel
          $checkchannel = 1;
          global $chanpasswd,$chanbgcolor,$channickcolor,$oldchan_is_moderated,$is_moderated,$chanthese,$chanexit,$old_user_channel,$user_channel,$changrafik;
          include("channels_inc.php");

          //the user has access permission for this page
          //calculate the check sum of the current channel
          $chancrypt=Crypt($channel,$salt_channels);

          $enters    = 1;
          $leaves    = 1;
        }
      }
      $chat = "";
      unset ($split);
      unset ($tmp_channel);
      @mysql_free_result($result);
    }elseif(substr($chat,0,3) == '/me'){ //the nick 'me' is not allowed by default
      global $me_comment;
      $me_comment=true;
      $chat=str_replace('/me','',$chat);
    }elseif(substr($chat,0,9) == '/announce'){
      global $db_handle,$channel,$SAYS;
      // check if the current chatter a godfather
      $result    = mysql_query("SELECT count(*) AS count FROM paten WHERE Nick = '$nick'");
      $godfather = mysql_result($result,0,"count");
      if($godfather){
        eregi("^/[^ ]* (.*)$",$chat,$split);
        $chat = str_replace('/announce','',$chat);
        $chat = '';
        $line = '<!-- |'.$nick.'|0|0|0|-->&nbsp;<font color="#ffffff">'.$SAYS.':</font><font color="#ee0000"><h3> '.$split[1].'</h3></font>';
        $result=mysql_query("SELECT Name FROM channels",$db_handle);
        while($row=mysql_fetch_object($result)){
          schreib_zeile($line,$row->Name);
        }
        global $ownLine;
        $ownLine=$line;
        unset($line);
      }else{
        $chat = '';
      }
      @mysql_free_result($result);
    }elseif(substr($chat,0,7) == "/locate"){ //the nick 'locate' is not allowed by default
      global $db_handle,$wispers_to_nick;
      $wispers_to_nick=$nick;
      eregi("^/[^ ]* (.*)$",$chat,$split);

      //check if the channel exists
      $result = mysql_query("SELECT Nick,Raum FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        global $IS_CHATTING_IN;
        $chat=mysql_result($result,0,"Nick") . " $IS_CHATTING_IN \"" . mysql_result($result,0,"Raum") . "\"";
      }else{
        global $NOT_ONLINE;
        $chat="$split[1] $NOT_ONLINE";
      }
      global $sys_msg;
      $sys_msg    = true;
      mysql_free_result($result);
    }elseif(substr($chat,0,4) == "/msg"){ //the nick 'join' is not allowed by default
      global $says_to_nick,$say_to_nick,$wispers_to_nick,$db_handle;

      eregi("^/[^ ]* ([^ ]*).*$",$chat,$split);

      //check if the user exists
      $result = mysql_query("SELECT Nick FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $says_to_nick = "";
        $speaking = "wispers_to_nick";
        $$speaking = mysql_result($result,0,"Nick");
        $wistpers_to_nick = $$speaking;
        $say_to_nick = $$speaking;
      }
      $chat = str_replace("/msg $split[1]","",$chat);
      unset ($split);
      mysql_free_result($result);
    }elseif(substr($chat,0,1) == "/"){
      global $says_to_nick,$say_to_nick,$wispers_to_nick,$db_handle;

      eregi("^/([^ ]*).*$",$chat,$split);

      //check if the user exists
      $result = mysql_query("SELECT Nick FROM chat WHERE Nick LIKE '$split[1]%'",$db_handle);
      if(mysql_num_rows($result) == 1){
        $wispers_to_nick = "";
        $speaking = "says_to_nick";
        $$speaking = mysql_result($result,0,"Nick");
        $say_to_nick = $$speaking;
      }
      $chat = str_replace("/$split[1]","",$chat);
      unset ($split);
      mysql_free_result($result);
    }
  }

  /**
  * Array containing the possible Emoticons
  *
  * @var array $smiley
  */
  if (empty($smiley)) {
    unset ($smileyfile);
    $smiley[]=":-))"; $smileyfile[]="bigsmile";
    $smiley[]="B-))"; $smileyfile[]="evilsmile";
    $smiley[]="=:-)"; $smileyfile[]="punk";
    $smiley[]=":-)="; $smileyfile[]="oldman";
    $smiley[]="~:-)"; $smileyfile[]="sunburn";
    $smiley[]="[:-)"; $smileyfile[]="hat";
    $smiley[]=":-)"; $smileyfile[]="smile";
    $smiley[]=";-)"; $smileyfile[]="blink";
    $smiley[]=":-x"; $smileyfile[]="kiss";
    $smiley[]=":h)"; $smileyfile[]="heart";
    $smiley[]=":-P"; $smileyfile[]="tongue";
    $smiley[]=":-("; $smileyfile[]="sad";
    $smiley[]="%-)"; $smileyfile[]="peer";
    $smiley[]=":*)"; $smileyfile[]="drunk";
    $smiley[]=":-/"; $smileyfile[]="hmmm";
    $smiley[]=":-p"; $smileyfile[]="tongue";
    $smiley[]=":ct"; $smileyfile[]="ct";
    $smiley[]="@}--"; $smileyfile[]="flower";
    $smiley[]="@}X-"; $smileyfile[]="rose";
    $smiley[]="8)"; $smileyfile[]="frog";
    $smiley[]="B-)"; $smileyfile[]="glasses";
    $smiley[]=":-D"; $smileyfile[]="laugh";
    $smiley[]=":T::"; $smileyfile[]="toffline";
    $smiley[]=":-G-"; $smileyfile[]="cigarette";
    $smiley[]=":-|"; $smileyfile[]="hmm";
    $smiley[]=":-O"; $smileyfile[]="amaze";
    $smiley[]=":o)"; $smileyfile[]="clown";
    $smiley[]=":o"; $smileyfile[]="clown";
    $smiley[]=":ei:"; $smileyfile[]="eggs";
    $smiley[]=".-)"; $smileyfile[]="oneeye";
    $smiley[]="(:(="; $smileyfile[]="ghost";
    $smiley[]=":viv"; $smileyfile[]="vivian";
    $smiley[]=":-Q"; $smileyfile[]="smoker";
    $smiley[]=":-]"; $smileyfile[]="sarcasm";
    $smiley[]="&gt;-"; $smileyfile[]="female";
    $smiley[]=":-"; $smileyfile[]="male";
    $smiley[]="(*)"; $smileyfile[]="sun";
    $smiley[]='(\")'; $smileyfile[]="rain";
    $smiley[]="*(~)"; $smileyfile[]="littlesun";
    $smiley[]="(~)"; $smileyfile[]="cloud";
    $smiley[]="~=="; $smileyfile[]="candle";
    $smiley[]="~--"; $smileyfile[]="dynamite";
    $smiley[]=":[=]"; $smileyfile[]="basket";
    $smiley[]=":pkl)"; $smileyfile[]="piss";
    $smiley[]=":mm)"; $smileyfile[]="colored";
    $smiley[]=":ms)"; $smileyfile[]="alien";
    $smiley[]="|-)"; $smileyfile[]="yawn";
    $smiley[]="|-O"; $smileyfile[]="yawn";
    $smiley[]=":,-)"; $smileyfile[]="luckytear";
    $smiley[]=":,-("; $smileyfile[]="sadtear";
    $smiley[]=":.|"; $smileyfile[]="fingers";
    $smiley[]=":#D"; $smileyfile[]="boat";
    $smiley[]="~o"; $smileyfile[]="bomb";
    $smiley[]=":santa"; $smileyfile[]="santa";
  }

  if(ereg("-|:|\~|\||)",$chat)){
    unset ($s);
    $pattern = "\:me";
    ereg("(.*)($pattern)(.*)",$chat,$s);
    if ($s[2]) {

      global $PRIVAT_ICON_PATH;
      $smileydir=$PRIVAT_ICON_PATH;
      $smileypath=$smileydir.strtolower(str_replace(" ","_",$nick)).".gif";
      if(@LinkInfo($smileypath)>=0){
    $smileypath=$smileydir.urlencode(strtolower(str_replace(" ","_",$nick))).".gif";
    $chat = $s[1]."<IMG SRC=\"".$smileypath."\"">".$s[3];
      }
    }
    unset($s);
    $pattern="\:you";
    ereg("(.*)($pattern)(.*)",$chat,$s);
    if ($s[2]) {

      global $PRIVAT_ICON_PATH;
      $smileydir=$PRIVAT_ICON_PATH;
      $smileypath=$smileydir.strtolower(str_replace(" ","_",$to_nick)).".gif";
      if(@LinkInfo($smileypath)>=0){
    $smileypath=$smileydir.urlencode(strtolower(str_replace(" ","_",$to_nick))).".gif";
    $chat = $s[1]."<IMG SRC=\"".$smileypath."\"">".$s[3];
      }
    }
    unset($s);

    global $ICON_PATH;
    $smileydir=$ICON_PATH;
    $smileyopen = "<IMG SRC=\"".$smileydir;
    $smileyclose = ".gif\" ">";
    reset($smiley);
    reset($smileyfile);
    $error=error_reporting(0);
    do {
      $pattern=preg_quote(current($smiley));
      ereg("(.*)($pattern)(.*)",$chat,$s);
      if ($s[2]) {
        /*$s[2] = rawurlencode(str_replace("/","\\",str_replace("&gt;",">",$s[2])));*/
        $chat = $s[1].$smileyopen.current($smileyfile).$smileyclose.$s[3]; break;}
        next($smileyfile);
    } while (next($smiley));
    error_reporting($error);
  }
  global $NO_NO_WORDS;
  $chat = eregi_replace($NO_NO_WORDS,"...oops...",$chat);

  return $chat;
}//end func filter
?>
Avatar billede htm Nybegynder
04. december 2002 - 18:43 #11
filter()- funktionen er den funktion du har defineret i dette script! Du har vist glemt at inkludere scriptet før du kaldte funktionen!
Avatar billede partymann Nybegynder
05. december 2002 - 08:41 #12
oki jeg er ikke den store php mand*G* men hvad skal jeg gøre*G*
Avatar billede htm Nybegynder
05. december 2002 - 08:52 #13
I dit script herover har du defineret en funktion!
eks.
gem ovenstående som fil.php
lav så en ny fil du kalder chat.php
den fil skal indeholde:
<?php
include("fil.php");
filter(chat,nick,to_nick);
?>

Jeg kan anbefale dig at læse arktiklerne om php på www.webcafe.dk så er du hjulpet godt på vej til at forstå php!
Avatar billede partymann Nybegynder
05. december 2002 - 09:01 #14
nej det er løst du kan komme ind på chatten og kigge..... mange tak
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester