How can I put an instant web messenger on my website?
Printable View
How can I put an instant web messenger on my website?
When you say instant messenger, do you mean to communicate with MSN, AIM, GTalk etc, or do you want like an instant chat feature, where you can type in messages to anyone currently viewing the site?
Also, do you have an example of another website that has an IM function similar to what you desire?
I was looking for something that doesnt use yahoo, msn, or any other service like that. The users would still need to log in. I was looking for something similar to php121 (www.php121.com). Thanks for the help!
I suppose you don't want to use PHP121 then?
You can create your own using AJAX. Confirm this is what you want, and i can give you the basic steps for that.
I do not want to use php121. I am new to this and dont know AJAX or php or anything like that.
Well this is the basic process of the whole thing:
- User A Starts conversation #1234 With User B
- User A sents the message "Hello" which is stored in a database under convo #1234
- User B send the message "Hey, whats up" which is also stored in the db under convo #1234
- While all of this is happening, both windows are refreshing automatically (or using ajax) to query the database looking for convo #1234 messages.
Does that make any sense? I feel like i was not clear enough.
Then you are posting in the wrong forum.Quote:
Originally Posted by red_bull_NRG
No. :wave:Quote:
Originally Posted by dclamp
yeah but see, you know how to do it... so be quiet.Quote:
Originally Posted by visualAd
Sorry, but it didnt make sense. As I said, I have absolutely no experience with stuff like this.Quote:
Originally Posted by dclamp
Ok no problem. Maybe i can make a illustration.
here. this is the best i can do. If you still dont understand, i can just start writing sample code :)Quote:
Originally Posted by dclamp
thanks for the illustration, now I understand how it works. But how can I program it?
I am glad you understand that. To make it easier for both of us, i am going to create the tutorial on my computer and upload it when i am done. Should be done tonight.
I advise you take a look at the MySQL Help link in my signature. That explains MySQL queries, and well as using it with PHP.
ok, here is a VERY basic IM system in php. The code is somewhat sloppy because i wrote it in 2 hours. there are comments everywhere.
Please ask questions regarding it, i am happy to answer.
Thanks so much for the help with the messenger. It's working great. I still have a couple questions though:
How can I set up a MySQL database to handle the passwords and usernames?
Also, how can I make a register page so people can set up a username and password?
oops, i forgot to add the databases in the file.
Code:SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `subsoft_chatdb`
--
-- --------------------------------------------------------
--
-- Table structure for table `chatsessions`
--
CREATE TABLE IF NOT EXISTS `chatsessions` (
`chatID` int(10) unsigned NOT NULL auto_increment,
`sessionID` text NOT NULL,
`fromuserID` varchar(45) default NULL,
`startTime` varchar(45) NOT NULL,
`endTime` varchar(45) NOT NULL,
`touserID` varchar(45) NOT NULL,
`status` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`chatID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
--
-- Dumping data for table `chatsessions`
--
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE IF NOT EXISTS `messages` (
`messageID` int(10) unsigned NOT NULL auto_increment,
`sessionID` varchar(45) NOT NULL,
`fromuserID` varchar(45) NOT NULL,
`touserID` varchar(45) NOT NULL,
`sendTime` varchar(45) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`messageID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `messages`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`userID` int(10) unsigned NOT NULL auto_increment,
`username` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userID`, `username`, `password`) VALUES
(1, 'dclamp', '5f4dcc3b5aa765d61d8327deb882cf99'),
(2, 'penagate', '5f4dcc3b5aa765d61d8327deb882cf99'),
(3, 'robdog', '5f4dcc3b5aa765d61d8327deb882cf99');
Make a form with a username field and a password field and set the form action to that page, and at the top use mysql functions to add it to the database.Quote:
Originally Posted by red_bull_NRG
I am not here do make your whole project for you, but i am more than happy to assist you when you have problems.
For more information on mysql fuctions, have a look at the link in my signature. When you get something made up, post it here and we can have a look at it.
:wave:
no offence mate, but maybe a good start would be to learn to program? ;)Quote:
Originally Posted by red_bull_NRG
Dude, I am trying to implement an Instant Messenger on a Web Browser. Which database should the login page be access/query to store the username and password details?Quote:
Originally Posted by dclamp
Thanks!
Thanks!
Your better off going with an already made program. The one i wrote was made in 5 minutes, and looks (and works) like crap.
php121 is a great PHP IM application that is easily integrated into your site.
We would be more then happy to assist you in integration.
Thanks for your help!Quote:
Originally Posted by dclamp
Actually, I wanted to learn how to do it myself rather than use something already present. If you could help me in that, I'd be glad.
Or even ajax-im for that matter seems good, if I can manage to get it working myself.
I am still trying to figure out which database does login query?
Any tutorials that can help me better understand the code?
thnx a lot!!
table users controls the login. And it uses md5 encryption to store the password.
It's never a bad idea to look at other examples, if only to see how the code works.
http://www.hotscripts.com/PHP/Script...pts/index.html