Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Creating a private messaging system
Old 08-11-2004, 05:40 PM Creating a private messaging system
andrewsco's Avatar
Super Talker

Posts: 130
Trades: 0
Hi guys.

I am trying to create a private messaging system which is similar to the one which this forum has, but only not in a forum? Is this possible? I have searched high and low for a tutorial on this, but have not found one thing.! I have managed to sort out a membership system, but wondered if anyone knows a tutorial on getting membership info? If this isnt clear I mean, when on a site it says, "there are three members logged in" and then lists them. Is this just a code using sessions? Any info on putting info in for each member and displaying it would be appreciated as this seems to me to be pretty hard.

Andy
__________________
My Webpage:
Please login or register to view this content. Registration is FREE
andrewsco is offline
Reply With Quote
View Public Profile Visit andrewsco's homepage!
 
 
Register now for full access!
Old 08-11-2004, 08:10 PM
Skilled Talker

Posts: 63
Trades: 0
it's not hard, it's... strange. they do use sessions. they also have a field for each user in database, which records the time&date of last activity. everytime the user accesses a page - their last_activity is updated. then another script counts the number of users with last_activity date 5 minutes ago or less. it can be 15, 30 minutes or any other value. the reason why this approach is "strange" is because you do not really know if the user is still there or not. you assume they are active if they did something in the last 5 minutes.

could you be more clear on what you are trying to achieve?

a PM system simply records all messages in a table in database and also records who they are from and who wrote them. for example, such table could have these fields:

sender_id - ID of sender user (there should be another table with users)
recepient_id - ID of recepient
message_date - when was the message sent
message_title - title of the message
message_body - body...
is_new - have they seen it already? (value can be 1 or 0)

does this help?
antoshka is offline
Reply With Quote
View Public Profile Visit antoshka's homepage!
 
Old 08-11-2004, 08:54 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Hey andrewsco,

As for knowing how many users are online, I use this method.

make a table in your database to hold this information:

on_now //This is the ID number for this insert (AUTO_INCREMENT)
user_id //The users ID number
user_timestamp //A Unix Time stamp value


Then when the user logs into your site create a session that will hold their ID number (user_id).

Now create a script that checks to see if the users ID number is alread in the (above) database. If it is do not update the database. If it is not add the user to the database.

Then on the side or front page you can just pull all of the info from the database and display it.

Be sure to also use that unix timestamp to remove old entries.

Save the script you just made and call it in an include on all of your pages.
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 08-12-2004, 06:41 AM
andrewsco's Avatar
Super Talker

Posts: 130
Trades: 0
Il have a go in a few days when I have some time on my hands, and il get back to you with any problems. Thanks for your help

Andy
__________________
My Webpage:
Please login or register to view this content. Registration is FREE
andrewsco is offline
Reply With Quote
View Public Profile Visit andrewsco's homepage!
 
Old 08-12-2004, 05:54 PM
andrewsco's Avatar
Super Talker

Posts: 130
Trades: 0
Does anyone know a tutorial on this, as I am still a beginer really, so need a sort of thourough tutorial. If anyone could post a relevant one that would be great.

Andy
__________________
My Webpage:
Please login or register to view this content. Registration is FREE
andrewsco is offline
Reply With Quote
View Public Profile Visit andrewsco's homepage!
 
Old 08-12-2004, 06:06 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Think of the very basic requirements of such a project...

A form to send/reply to messages
Some form of storage be it mysql or flatfiles (to store messages)
User management so that people can send messages to the right person

This is the most simple requirements of such a system. Don't get caught up in this feature or that feature right off the bat. Don't try and make it just like the pm system here, just start with the most basic thing you can make and build upon your experiences from there.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-12-2004, 08:49 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
cpt is right. Always start small. I created a VERY QUICK (I apologize for coding errors lol) tutorial for you to look at.

I am sure its not 100% correct but it will give you the idea.

http://www.cytech-services.com/PM_system.html

So please not comments on the code LOL
I juts a basic idea of what to do
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 08-12-2004, 09:45 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Good job AC. That will put him on the right track indeed.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-12-2004, 11:29 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Thanks

I hope andrew likes it as well. Also andrew if you need furthur help you can contact me at acjavascript@aol.com. I have created a PM system similir to the one used on this forum here: www.atlantissgc.com so I am sure I can answer any of your questions.
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Reply     « Reply to Creating a private messaging system
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40481 seconds with 12 queries