PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 1st, 2013, 05:43 AM
mohnish mohnish is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Location: Visakhapatnam
Posts: 11 mohnish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 57 m 40 sec
Reputation Power: 0
PHP-General - Emotions for chat

Hello all,hw r u? Recently i have done chat module withphp,mysql,javascript and jquery.Chat module is working correctly.Now i want to insert emotions.I have tried and its working in weird manner.Anyone plz help...
mail me il mail u d scripts so that you can understand.
Thank you.

Reply With Quote
  #2  
Old February 1st, 2013, 07:07 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,877 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 9 h 54 m 2 sec
Reputation Power: 581
Post the script here. That is what this form is for. Be sure to read ManiacDan's New User Guide first.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old February 1st, 2013, 08:32 AM
mohnish mohnish is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Location: Visakhapatnam
Posts: 11 mohnish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 57 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by gw1500se
Post the script here. That is what this form is for. Be sure to read ManiacDan's New User Guide first.


Hi if u dnt mind can i mail u my scripts??

Reply With Quote
  #4  
Old February 1st, 2013, 08:40 AM
Jacques1's Avatar
Jacques1 Jacques1 is online now
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,862 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 23 m 21 sec
Reputation Power: 813
Hi,

please use standard English, this "chat speak" is really hard to read -- at least for non-native speakers. Kthx.

And he just told you to post the code. Or upload it somewhere and post the link (you have to obfuscate the URL).

Reply With Quote
  #5  
Old February 1st, 2013, 08:44 AM
mohnish mohnish is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Location: Visakhapatnam
Posts: 11 mohnish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 57 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by Jacques1
Hi,

please use standard English, this "chat speak" is really hard to read -- at least for non-native speakers. Kthx.

And he just told you to post the code. Or upload it somewhere and post the link (you have to obfuscate the URL).


Thank you.

Reply With Quote
  #6  
Old February 1st, 2013, 11:01 PM
mohnish mohnish is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Location: Visakhapatnam
Posts: 11 mohnish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 57 m 40 sec
Reputation Power: 0
my code

Quote:
Originally Posted by mohnish
Hi if u dnt mind can i mail u my scripts??

Hello here is my script,please check once and correct me.
PHP Code:
<?php include("connection.php"); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">

.chatbox
{
border:2px solid #990000;
height:220px;
width:450px;
overflow-y: auto;
}
.textbox
{
min-height:35px;
border:2px solid #666666;
width:450px;
margin-top:-14px;
}
</style>
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" >
//$(document).ready(function()
//{
//      $("#chat").emotions();
//});
function smile_display(e)
{
        if (e.keyCode == 13)
    {
        SmileyConvert();
    }
}
function SmileyConvert()
{
  //alert('hi');
  var text = document.getElementById('tarea').value;
  //alert(text);
  text = text.replace(':D', '<img src="emotions/grin.gif" border="0">');
  text = text.replace('o:)', '<img src="emotions/angel.gif" border="0">');
  text = text.replace(':3', '<img src="emotions/colonthree.gif" border="0">');
  
  text = text.replace("\n", '<br>');  // How to globally replace this character ???
  document.getElementById('chat').innerHTML = text;
}


//var refreshId = setInterval(function()
//{
//    $('#chat').emotions();
//    $('#chat').load('refreshd.php');        
//}, 5000);

var user;
function user(a)
{
  user=a;
  document.getElementById("usr").innerHTML="you login as "+a;
}
function smiles(e)
{
   //alert(event.keyCode);
    if(e.keyCode == 13)
    {
       if((user!="user1")&&(user!="user2"))
       {
         alert("please login");
         return false;
       }
       var content=document.getElementById('tarea').value;
       if(content!="")
       {
        // document.getElementById('tarea').value="";
         $.ajax({type:"post",cache:false,url:"insert.php",data:"cont="+content+"&user="+user,success:function(html)
                                                                             {
                                                                               //$('#chat').html(html);
                                                                               $("#chat").scrollTop = $("#chat").scrollHeight; 
                                                                             }
            });
       }
    }
    else
    {
      return false;
    }
}
function insertSmiley(smiley)
{
   document.getElementById("tarea").value=document.getElementById("tarea").value+smiley;
   tarea.focus();


</script>
</head>

<body>

<div id="usr">u want to login as :<input type="button" value="user1" onClick="user('user1')" />
                                  <input type="button" value="user2" onClick="user('user2')" /></div>
<div id="chat" class="chatbox">
<table cellpadding="4px" >
<?php
$chatdata
=mysql_query("select * from (select * from chatdata order by id desc limit 13) AS T1 order by id asc");
while(
$chatdata_exe=mysql_fetch_array($chatdata))
{
  echo 
"<tr><td>".$chatdata_exe['user']." </td><td>:</td><td style='word-break:break-all;'>".$chatdata_exe['data']."</td></tr>";
}
?>
</table>
</div>

<table>
 <tr><td> 
   <input type="text" class="textbox" id="tarea" onKeyPress="smiles(event);" onKeyUp="smile_display(event);" value="" />
 </td><td>
        <table>
        <tr>
                <td><img src='emotions/grin.gif'  onclick="insertSmiley(':D')" /></td>
                <td><img src="emotions/angel.gif" onClick="insertSmiley('o:)')" /></td>
                <td><img src="emotions/colonthree.gif" onClick="insertSmiley(':3')" /></td>
                <td><img src="emotions/confused.gif" onClick="insertSmiley('o.O')" /></td>
            </tr>
            <tr>    
                <td><img src="emotions/cry.gif" onClick="insertSmiley(':'(')" /></td>
                <td><img src="emotions/devil.gif" onClick="insertSmiley('3:)')" /></td>
                <td><img src="emotions/pacman.gif" onClick="insertSmiley(':v')" /></td>
                <td><img src="emotions/gasp.gif" onClick="insertSmiley(':O')" /></td>
            </tr>
            <tr>    
                <td><img src="emotions/glasses.gif" onClick="insertSmiley('8)')" /></td>
                <td><img src="emotions/grumpy.gif" onClick="insertSmiley('^_^')" /></td>
                <td><img src="emotions/heart.gif" onClick="insertSmiley('<3')" /></td>
                <td><img src="emotions/wink.gif" onClick="insertSmiley(';)')" /></td>
            </tr>
        </table>
</td></tr>
</table>
</body>
</html>

[[ Almost got that. To show PHP code, paste your code into the text editor, select it, and hit the button. --requinix

Last edited by requinix : February 2nd, 2013 at 12:59 AM.

Reply With Quote
  #7  
Old February 2nd, 2013, 10:09 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,877 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 9 h 54 m 2 sec
Reputation Power: 581
Is it generating the output you expect? The only thing I see wrong at the moment is that you are using the deprecated MySQL extensions. You should be using PDO.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Emotions for chat

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap