Jump to content

Need PHP Chat Application help


ilayaraja

Recommended Posts

Hi,

 

I need to develop a module called chat with doctor. User can able to chat with the doctor for that he has to pay some amount to website. Say example user got purchase the Package worth : 2$ =>5min. After 5 min chat will be closed , timer should be shown while chatting. How can we do this?

Link to comment
Share on other sites

A simple way would have a chat input form and a div.  When you submit form, have the default action cancelled and use AJAX to submit to the PHP page that processes the messages and stores them in the database.  The database should hold the information on how long you can chat, or more precisely the time in which your chat should end.  Use Javascript to show the countdown timer on the chat page, and just load the end time from the database into a session variable so you don't have to query it every time.  Also, you could just insert the start/end time and by the insert query, you would have the end time to store in the session.

 

The payments would be set up separately and just put it in the user table how much time or credits (whatever you want), that they have and take away as much as necessary when they chat.  You would probably want a failsafe to save their time if they quit the chat early so they don't spend money and because of a number of reasons, they could lose their page and with that, the chat.  You could do that completely in PHP on the chat page mentioned earlier, and you could use Javascript/AJAX to give a few more options like manually stopping the convo and saving your time left, and a number of other things.

 

Chats are easy, but make sure you don't screw up the time/money usage or you will have some angry customers.

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.