Smilies Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Smilies Function

    Code:
    <?php
    
    /**
     * @author Zangz
     * @copyright 2009
     */
    
    function Smiles($text) {
        
        $path = "http://localhost/smilies/smilies/";
        $arr = array(
        ":D" => $path. "biggrin.gif", 
        ":-/" => $path. "confused.gif", 
        "B-)" => $path. "cool.gif", 
        ":-S" => $path. "worried.gif", 
        ":-)" => $path. "happy.gif", 
        ":(" => $path. "sad.gif",
        ";)" => $path. "winking.gif",  
        ">:D<" => $path. "bighug.gif", 
        ":x" => $path. "lovestuck.gif", 
        ":'>" => $path. "blushing.gif", 
        ":P" => $path. "tongue.gif", 
        ":-*" => $path. "kiss.gif", 
        "=((" => $path. "brokenheart.gif",
        ":-0" => $path. "surprise.gif",  
        "X(" => $path. "angry.gif", 
        ":>" => $path. "smug.gif",
        "#:-S" => $path. "whew.gif",
        ">:)" => $path. "devil.gif",
        ":((" => $path. "crying.gif",
        ":))" => $path. "laughing.gif",
        ":|" => $path. "straightface.gif",
        );
      //  http://messenger.yahoo.com/features/emoticons/
        foreach ($arr as $smile => $paths) {
            
        $text =    str_ireplace($smile, '<img src="'.$paths.'"align = middle" />', $text);
                
        }
        
        return $text;
        
    }
    
    $txt = "test :D test"; //example text
    echo Smiles($txt);
    ?>
    http://ngeo.ro

    #2
    SQL

    PHP Code:
    -- 
    -- 
    Table structure for table `smiles`
    -- 

    CREATE TABLE `smiles` (
      `
    scodetext NOT NULL,
      `
    spathtext NOT NULL
    ENGINE=MyISAM DEFAULT CHARSET=latin1
    BBCODE

    Code:
    function smiles($text)
    {
      $sql = "SELECT * FROM smiles";
      $smiles = mysql_query($sql);
      while($smile=mysql_fetch_array($smiles))
      {
        $text = str_replace("$smile[0]","[smile]$smile[1][/smile]",$text);
      }
      return $text;
    }

    Place this in your bbcode

    Code:
    $text = smiles($text);
    
    if(substr_count($text,"[smile]")<=3)
              {
              $text=preg_replace("/\[smile\](.*?)\[\/smile\]/i","<img src=\"F_/smiles/$1\" alt=\"*\"/>", $text);
              }else{
              $text = "Too Many Smiles 3 is alot !";
              }
    Last edited by subzero; 02.12.09, 09:31.
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      do you have .sql file with all codes?not like what i found:




      2 -fight- smilies/aggressive.gif
      3 -rebel- smilies/rebel.gif
      http://ngeo.ro

      Comment


        #4
        the smile folder where you have it

        replace smilies/ just the image


        Anyway i put my smiles here enjoy
        PHP Code:
        -- 
        -- 
        Table structure for table `smiles`
        -- 

        CREATE TABLE `smiles` (
          `
        scodetext NOT NULL,
          `
        spathtext NOT NULL
        ENGINE=MyISAM DEFAULT CHARSET=latin1;

        -- 
        -- 
        Dumping data for table `smiles`
        -- 

        INSERT INTO `smilesVALUES (':)''smile.gif');
        INSERT INTO `smilesVALUES (':admin:''admin.gif');
        INSERT INTO `smilesVALUES (':wacky:''whacky.gif');
        INSERT INTO `smilesVALUES (':alien:''alien6.gif');
        INSERT INTO `smilesVALUES (':alien2:''alien8.gif');
        INSERT INTO `smilesVALUES (':anyone:''anyone.gif');
        INSERT INTO `smilesVALUES (':ban:''ban.gif');
        INSERT INTO `smilesVALUES (':beerfunnel:''beerfunnel.gif');
        INSERT INTO `smilesVALUES (':bevile:''bevile.gif');
        INSERT INTO `smilesVALUES (':bump:''bump.gif');
        INSERT INTO `smilesVALUES (':fingidiot:''fingidiot.gif');
        INSERT INTO `smilesVALUES (':confused:''confused004.gif');
        INSERT INTO `smilesVALUES (':cya:''cya.gif');
        INSERT INTO `smilesVALUES (':dance:''dance001.gif');
        INSERT INTO `smilesVALUES (':drinks:''eatdrink004.gif');
        INSERT INTO `smilesVALUES (':eatdrink:''eatdrink020.gif');
        INSERT INTO `smilesVALUES (':err:''err.gif');
        INSERT INTO `smilesVALUES (':fart:''fart001.gif');
        INSERT INTO `smilesVALUES (':football:''football.gif');
        INSERT INTO `smilesVALUES (':search:''gen003.gif');
        INSERT INTO `smilesVALUES (':search2:''gen044.gif');
        INSERT INTO `smilesVALUES (':order:''gen045.gif');
        INSERT INTO `smilesVALUES (':hello:''gen.gif');
        INSERT INTO `smilesVALUES (':goodnight:''goodnight.gif');
        INSERT INTO `smilesVALUES (':happy:''happy10.gif');
        INSERT INTO `smilesVALUES (':happy1:''happy14.gif');
        INSERT INTO `smilesVALUES (':happy2:''happy23.gif');
        INSERT INTO `smilesVALUES (':happy3:''happy95.gif');
        INSERT INTO `smilesVALUES (':hijacked:''hijacked.gif');
        INSERT INTO `smilesVALUES (':hug1:''hug001.gif');
        INSERT INTO `smilesVALUES (':hug3:''hug003.gif');
        INSERT INTO `smilesVALUES (':hug4:''hug015.gif');
        INSERT INTO `smilesVALUES (':rofl:''laughing008.gif');
        INSERT INTO `smilesVALUES (':lol:''laughing014.gif');
        INSERT INTO `smilesVALUES (':lol2:''laughing015.gif');
        INSERT INTO `smilesVALUES (':lol3:''laughing019.gif');
        INSERT INTO `smilesVALUES (':lol4:''laughing021.gif');
        INSERT INTO `smilesVALUES (':mailbox:''mailboxhappy.gif');
        INSERT INTO `smilesVALUES (':music:''music005.gif');
        INSERT INTO `smilesVALUES (':music1:''music011.gif');
        INSERT INTO `smilesVALUES (':new:''newhere.gif');
        INSERT INTO `smilesVALUES (':nicethread:''nicethread.gif');
        INSERT INTO `smilesVALUES (':nospam:''nospamhere.gif');
        INSERT INTO `smilesVALUES (':waste:''nothingtoadd.gif');
        INSERT INTO `smilesVALUES (':offtopic:''offtopic.gif');
        INSERT INTO `smilesVALUES (':popcorn:''popcorn.gif');
        INSERT INTO `smilesVALUES (':rolleyes:''rolleyes010.gif');
        INSERT INTO `smilesVALUES (':ninja:''rpg013.gif');
        INSERT INTO `smilesVALUES (':ghost:''rpg027.gif');
        INSERT INTO `smilesVALUES (':ninja2:''rpg033.gif');
        INSERT INTO `smilesVALUES (':rulez:''rulez.gif');
        INSERT INTO `smilesVALUES (':scared:''scared003.gif');
        INSERT INTO `smilesVALUES (':scared2:''scared007.gif');
        INSERT INTO `smilesVALUES (':scared3:''scared008.gif');
        INSERT INTO `smilesVALUES (':scared4:''scared010.gif');
        INSERT INTO `smilesVALUES (':t1:''t1.gif');
        INSERT INTO `smilesVALUES (':thumbsup:''thumbsup.gif');
        INSERT INTO `smilesVALUES (':welcome:''welcome.gif');
        INSERT INTO `smilesVALUES (':wtf:''wtf.gif');
        INSERT INTO `smilesVALUES (':2guns:''2guns.gif');
        INSERT INTO `smilesVALUES (':2thumb:''2thumbs_up.gif');
        INSERT INTO `smilesVALUES (':ache:''ache.gif');
        INSERT INTO `smilesVALUES (':advices:''advices.gif');
        INSERT INTO `smilesVALUES (':afraid:''afraid.gif');
        INSERT INTO `smilesVALUES (':agree:''agree.gif');
        INSERT INTO `smilesVALUES (':airkiss:''airkiss.gif');
        INSERT INTO `smilesVALUES (':alien1:''alien8.gif');
        INSERT INTO `smilesVALUES (':ambulance:''ambulance.gif');
        INSERT INTO `smilesVALUES (':angel2:''angel2.gif');
        INSERT INTO `smilesVALUES (':angel:''angel.gif');
        INSERT INTO `smilesVALUES (':angry2:''angry2.gif');
        INSERT INTO `smilesVALUES (':angry4:''angry4.gif');
        INSERT INTO `smilesVALUES (':annoy:''annoy.gif');
        INSERT INTO `smilesVALUES (':anvil:''anvil.gif');
        INSERT INTO `smilesVALUES (':anyone:''anyone.gif');
        INSERT INTO `smilesVALUES (':argue:''argue.gif');
        INSERT INTO `smilesVALUES (':ashamed:''ashamed.gif');
        INSERT INTO `smilesVALUES (':aww:''aww.gif');
        INSERT INTO `smilesVALUES (':aww_yeah:''aww_yeah.gif');
        INSERT INTO `smilesVALUES (':baby:''baby.gif');
        INSERT INTO `smilesVALUES (':bad_idea:''bad_idea.gif');
        INSERT INTO `smilesVALUES (':badgrin:''badgrin.gif');
        INSERT INTO `smilesVALUES (':badidea:''badidea.gif');
        INSERT INTO `smilesVALUES (':bam:''bam.gif');
        INSERT INTO `smilesVALUES (':ban:''ban.gif');
        INSERT INTO `smilesVALUES (':banghead:''banghead.gif');
        INSERT INTO `smilesVALUES (':banned:''banned.gif');
        INSERT INTO `smilesVALUES (':base:''base.gif');
        INSERT INTO `smilesVALUES (':bash:''bash.gif');
        INSERT INTO `smilesVALUES (':beat:''beat.gif');
        INSERT INTO `smilesVALUES (':beaten:''beaten.gif');
        INSERT INTO `smilesVALUES (':beee:''beee.gif');
        INSERT INTO `smilesVALUES (':beerbong:''beerbong.gif');
        INSERT INTO `smilesVALUES (':beg:''beg.gif');
        INSERT INTO `smilesVALUES (':bike_rider:''bike_rider.gif');
        INSERT INTO `smilesVALUES (':birthday:''birthday.gif');
        INSERT INTO `smilesVALUES (':blink:''blink3.gif');
        INSERT INTO `smilesVALUES (':blossom:''blossom.gif');
        INSERT INTO `smilesVALUES (':boat:''boat.gif');
        INSERT INTO `smilesVALUES (':boo:''boo.gif');
        INSERT INTO `smilesVALUES (':boobies:''boobies.gif');
        INSERT INTO `smilesVALUES (':bounce:''bounce.gif');
        INSERT INTO `smilesVALUES (':box:''box.gif');
        INSERT INTO `smilesVALUES (':boxing:''boxing.gif');
        INSERT INTO `smilesVALUES (':brainslug:''brainslug.gif');
        INSERT INTO `smilesVALUES (':brasnapper:''brasnapper.gif');
        INSERT INTO `smilesVALUES (':brb:''brb.gif');
        INSERT INTO `smilesVALUES (':bump:''bump.gif');
        INSERT INTO `smilesVALUES (':censored:''censored.gif');
        INSERT INTO `smilesVALUES (':banhim:''banhim.gif');
        INSERT INTO `smilesVALUES (':google:''google.gif');
        INSERT INTO `smilesVALUES (':idiot:''idiot.gif');
        INSERT INTO `smilesVALUES (':ioPhu:''ioPhu.gif');
        INSERT INTO `smilesVALUES (':mf_pullup:''mf_pullup.gif');
        INSERT INTO `smilesVALUES (':mf_pcwhack:''mf_pcwhack.gif');
        INSERT INTO `smilesVALUES (':newbie:''newbie.gif');
        INSERT INTO `smilesVALUES (':picsstfu:''picsstfu.gif');
        INSERT INTO `smilesVALUES (':moonie:''moonie.gif');
        INSERT INTO `smilesVALUES (':sparta:''sparta.gif'); 
        Attached Files
        Last edited by subzero; 02.12.09, 13:13.
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          that its correct but i thought you may have the universal codes already written like : ) : - ) : ) )
          http://ngeo.ro

          Comment


            #6
            yeah as its just like or use :-) as the code then make sure your smile is smile.gif no need for adding a folder for them.
            Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
            Visit: WapMasterz Coming Back Soon!
            _______
            SCRIPTS FOR SALE BY SUBZERO
            Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
            FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment


              #7
              i will try sun : ) thx
              http://ngeo.ro

              Comment


                #8
                in my site, smilies doesnt appear, but i try this! Thanks,

                Comment

                Working...
                X