I need a programmer who can help add smileys to my message board. It is not a forum board so keep that in mind. Right now, the message board allows only text so if I typed in : ) , it will display : ) I want it so when the person types in : ) , it will display (smiley face gif) in their message. And if they typed in : ( , it will display (sad face gif), etc.... At the same time, if the user is too lazy to type in the ascii code of the smiley, I want an option of the smileys displayed underneath the message box so the user can just select the smiley face they want to use and it will display the smiley pic in their message (exactly the way Digital Point has theirs setup). The message board file is below. Can what I want be done without the need to modify the database? Is there a quick easy way of doing this by modifying the file below. Need this done quick and cheap. Unfortunately I cannot grant access to the server for security issue since the site holds personal info including logins/passwords. Hope the file below is sufficient enough to work with. If anyone can do this job, please let me know. Once again, the cheaper the better Thanks in advance <? include("../headers.php"); if(!$session[id]){ header("Location: index.php"); } if($send == yes){ if(!$message){ $attempt=msg; } elseif(fetch("SELECT id FROM $tab[contact] WHERE player='$pid' AND contact='$session[id]' AND status='4';")){ $attempt=ignore; } else{ $session['online']=$time; mysql_query("UPDATE $tab[player] SET messages=messages+1, reset='1' WHERE id='$pid';"); mysql_query("UPDATE $tab[player] SET online='$session[online]' WHERE id='$session[id]';"); $message=filter($message); mysql_query("INSERT INTO $tab[mail] (src,dest,msg,time,type) VALUES ('$session[id]','$pid','$message','$time',0);"); $attempt=success; $showbox=no; } } $player = mysql_fetch_array(mysql_query("SELECT name FROM $tab[player] WHERE id='$pid';")); gameheader("messenging $player[name]"); ?> <form method="post" action="message.php?pid=<?=$pid?>&return=<?=$return?>"> <?if($attempt==ignore){?><b><font color="#FFCC00">This kingdom has you on his ignore list, message not sent!</font></b><br><?}?> <?if($attempt==msg){?><b><font color="#FFCC00">You cannot send a blank message</font></b><br><?}?> <?if($attempt==success){?><br><br>message sent to <a href="player.php?pid=<?=$pid?>"><?=$player['name']?></a> (<font color="white">#<?=$pid?></font>)<br><br><a href="<?=$return?>">click here to go back</a><br><?}?> <?if($showbox != no){?> <br>send message to <a href="player.php?pid=<?=$pid?>"><?=$player['name']?></a> (<font color="white">#<?=$pid?></font>) <table align="center" width="60%"> <tr> <td align="center"> <textarea class="input" cols="57" rows="6" name="message" onKeyDown="limitText(this.form.message,this.form.countdown,500);" onKeyUp="limitText(this.form.message,this.form.countdown,500);"></textarea> <br>You have <input readonly type="text" name="countdown" size="1" value="500" style="border: 0;background-color: #000000;color: #FFFFFF;font-size:10pt;">characters left. <input type="hidden" name="send" value="yes"><input class="button" type="submit" value="send message"> </td> </tr> </table> </form> <?}?> <br> <br> <?=bar()?> <br> <?
Below is a pic of how the message board should look like. This picture is of another site which is using the identical message board as myself and he has smileys setup on his site
Hi This can be done on the display / output side of your board. (just by scanning your code, this doesn't seem like the bit copy and pasted above) Basically, save it in your database as and when it is pulled from your database, scan the result and replace with <img src = "http://www.path.to/smiley.gif"> <?php $ascii = array('/:)/i', '/;)/i'); $emoticons = array('<img src = "http://www.path.to/smiley.gif">', '<img src = "http://www.path.to/wink.gif">'); $content = preg_replace ($ascii, $emoticons, $content); ?> PHP: Here is how you could do the clicking the smileys: <script language="javascript" type="text/javascript"> function addsmile() { var newtext = document.getelementbyid['textarea'].value; document.getelementbyid['textarea'] = newtext+':)'; } function addwink() { var newtext = document.getelementbyid['textarea'].value; document.getelementbyid['textarea'] = newtext+';)'; } function addcry() { var newtext = document.getelementbyid['textarea'].value; document.getelementbyid['textarea'] = newtext+':*('; } function addsad() { var newtext = document.getelementbyid['textarea'].value; document.getelementbyid['textarea'] = newtext+':('; } </script> <a href = "javascript:void(0)" onclick="addsmile()">:)</a> | <a href = "javascript:void(0)" onclick="addwink()">;)</a> | <a href = "javascript:void(0)" onclick="addcry()">:*)</a> | <a href = "javascript:void(0)" onclick="addsad()">:(</a> PHP: * all code untested If you need further assistance PM me / add on MSN. Dan