hej, har et mindre problem, har en chat i php, ligeså snart man går ind på den så er der smileyer, men ligeså snart den refresher sletter den smileyerne... håber i kan hjælpe.
Chat.php:
-  <?
-  session_start();
-  
-  if(isset($_GET['logout'])){    
-      
-      //Simple exit message
-      $fp = fopen("log.html", 'a');
-      fwrite($fp, "<div class='msgln'><i>Bruger ". $_SESSION['username'] ." har forladt chatten.</i><br></div>");
-      fclose($fp);
-      
-      session_destroy();
-      header("Location: index.php"); //Redirect the user
-  }
-  
-  ?>
-  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-  <title>Miino - Chat</title>
-  <link type="text/css" rel="stylesheet" href="chat/chat.css" />
-  </head>
-  
-  <?php
-  include('smile.php');
-  ?>
-  <div id="wrapper">
-      <div id="menu">
-          <p class="welcome">Velkommen, <b><?php echo $_SESSION['username']; ?></b></p>
-          <p class="logout"><a id="exit" href="#">Forlad Chatten</a></p>
-          <div style="clear:both"></div>
-      </div>    
-      <div id="chatbox"><?php
-      if(file_exists("chat/log.html") && filesize("chat/log.html") > 0){
-          $handle = fopen("chat/log.html", "r");
-          $contents = fread($handle, filesize("chat/log.html"));
-          fclose($handle);
-          echo Smiles($contents);
-      }
-      ?></div>
-      
-      <form name="message" action="">
-          <input name="usermsg" type="text" id="usermsg" size="63" />
-          <input name="submitmsg" type="submit"  id="submitmsg" value="Send" />
-      </form>
-  </div>
-  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
-  <script type="text/javascript">
-  // jQuery Document
-  $(document).ready(function(){
-      //If user submits the form
-      $("#submitmsg").click(function(){    
-          var clientmsg = $("#usermsg").val();
-          $.post("chat/post.php", {text: clientmsg});                
-          $("#usermsg").attr("value", "");
-          return false;
-      });
-      
-      //Load the file containing the chat log
-      function loadLog(){        
-          var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
-          $.ajax({
-              url: "chat/log.html",
-              cache: false,
-              success: function(html){        
-                  $("#chatbox").html(html); //Insert chat log into the #chatbox div                
-                  var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
-                  if(newscrollHeight > oldscrollHeight){
-                      $("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
-                  }                
-                },
-          });
-      }
-      setInterval (loadLog, 2500);    //Reload file every 2.5 seconds
-      
-      //If user wants to end session
-      $("#exit").click(function(){
-          var exit = confirm("Er du sikker på du vil forlade chatten?");
-          if(exit==true){window.location = 'profil.php';}        
-      });
-  });
-  </script>
-  <?php
-  ?>
-  </body>
-  </html>
Smile.php
-  <?php
-  
-  /**
-   * @author Zangz
-   * @copyright 2009
-   */
-  
-  function Smiles($text) {
-      
-      $path = "http://www.miino.net/smilies/";
-      $arr = array(
-      ":D" => $path. "biggrin.gif", //biggrin.gif is the emo image name
-      );
-      
-      foreach ($arr as $smile => $paths) {
-          
-      $text =    str_ireplace($smile, '<img src="'.$paths.'" style="vertical-align:middle" />', $text);
-              
-      }
-      
-      return $text;
-      
-  }
-  
-  
-  ?>