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
https://forums.phpfreaks.com/topic/173027-solved-need-help-with-checking-user/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.