Jump to content

[SOLVED] Need Help With Checking User...


gaza165

Recommended Posts

Hello I am designing a private messaging service on a browser.

 

At the moment i have created the code which allows the user to click on the user they wish to have a PM with and then display the div to send a message to that user.

 

I need to come up with a way of checking that the user is not 'already' having a private conversation with the user they click on.

 

So if they click on 'Admin', then the box to write a PM will come up... but if they click 'Admin' again, a box should not appear.

 

Below is my function....

<script>
function Get_Users() { 

$.ajax({               
type: "GET",             
url: "action/whosonline.php",       
  success: function(data){  
   $("ul.whosonline").html(data); 
   $('ul.whosonline li:even').css('background-color','#DEDEDE'); 
        $('ul.whosonline li:odd').css('background-color','#EDEDED');  

  $('ul.whosonline li').click(function() { //if the user clicks on another user 

  
  if(id != 4 && data != '<li>No Users Online</li>' && lock != 1) { 
    id = id+1; 
    $("#slidebottom").append( 
   "<div class='"+id+"' id='chatinner'><div class='username'>"+user+"</div><ul class='pm'><li></li></ul><input type='text' name='message'></div>"); 
     right = right + 220 
     $('.'+id).css('right',right); 
      $('.'+id).hide(); 
      $('.'+id).fadeIn(); 
  }    
  }); 
  } 
}); 
} 
</script>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.