• HTML/CSS
  • jQuery
  • PHP
  • JS
  • AJAX
  • MySQL
  • Res
  • XSLT
  • Contact Us
  • HTML/CSS
    • Game Development →
      • HTML5 Game Development - Lesson 1
      • HTML5 Game Development - Lesson 2
      • HTML5 Game Development - Lesson 3
      • HTML5 Game Development - Lesson 4
      • HTML5 Game Development - Lesson 5
      • HTML5 Game Development - Lesson 6
      • HTML5 Game Development - Lesson 7
    • Menus →
      • CSS3 multilevel menu with transition and animation
      • Marble Style CSS3 Navigation Menu
      • Toggle CSS3 Bottom Navigation Bar
      • Accordian like CSS3 Onclick Vertical Navigation
      • Multilevel CSS3 Metal Navigation with icons
      • Click-action CSS3 Dropdown Menu with jQuery
      • Click action Multi-level CSS3 Dropdown Menu
      • CSS3 Animated Menu
      • CSS3/jQuery crossbrowser Drop-down menu with tabs
      • CSS3 Drop sliding list Menu #6
      • CSS3 Slideout Menu #5
      • CSS3 Dropdown Menu #4
      • CSS3 Dropdown Menu #3
      • CSS3 Dropdown Menu #2
      • Cool CSS3 Dropdown Menu
    • Templates →
      • Robo Splash Page Layout
      • 'Mono' HTML5 CSS3 Single Page Layout
      • HTML5/CSS3 single page layout - Art theme
      • Attractive HTML CSS Anime Theme Website Layout
      • HTML CSS website layout #4 - Gray theme
      • Dark and clean HTML CSS website layout
      • HTML5&CSS3 single page layout - Rock portal
      • E-Store HTML5 CSS3 Single Page Layout
      • Under Water Themed HTML5 & CSS3 single page Layout
      • HTML5 & CSS3 Single Page Web Layout
    • HTML5 tutorials →
      • HTML5 Canvas Slideshow
      • HTML5 canvas - Custom brush #2 (Bubble brush)
      • HTML5 canvas - Custom brush (BezierCurveBrush)
      • HTML5 Face Builder
      • Pure HTML5 file upload
      • HTML5 image crop tool
      • HTML5 animation - patterns with loops
      • HTML5 3D circle text with shadows
      • HTML5 canvas pixelate effect
      • Animated Moving Clouds using HTML5
      • Animated Fireplace in HTML5
      • 3D Animated Box HTML5 WebGL Photo Slideshow
      • Your Own Paint Program
      • Image Zoomer in HTML5 Canvas
      • Photo Array in WebGL
      • HTML5 Canvas Image Color Picker
      • HTML5 Image Effects App - Adding Horizontal Flip
      • Keyboard Sensitive 3D Twisted Images in WebGl
      • Animated 3D WebGL Demonstration
      • HTML5 Image Effects App - Adding Noise and Invert
      • HTML5 Canvas Image Effects App - Adding Blur
      • Attractive Presentation with HTML5
      • HTML5 Canvas App for Online Image Enhancements
      • Water Ripple effect using HTML5 canvas
      • Animated 3D canvas object in HTML5
    • CSS3 tutorials →
      • CSS3 Image Hover Effects
      • CSS3 Modal Popups
      • Isometric interactive interior guide
      • Analog Clock with Pure CSS3
      • CSS3 Optical Illusions
      • CSS3 Animated Photo Slider
      • CSS3 Christmas Tree with Snow
      • How to Create a Pure CSS3 Slideshow
      • CSS3 Drop Caps
      • Pure CSS3 Slider
      • Fantastic Animated Buttons using CSS3
      • How to Create a Pure CSS3 Animated Photo Gallery
      • Toggle CSS3 Bottom Navigation Bar
      • How to Generate Runtime Multi-columns with CSS3
      • Multiple backgrounds and Animation with CSS3
  • jQuery
    • Photo album with jQuery Fotorama
    • Photo album with jQuery Chop Slider
    • Cool Background Image Sliding effect with jQuery
    • jQuery Templates - Usage Practice
    • Photo Album with Galleriffic jQuery plugin
    • Fantastic Photo Album with TN3
    • Ajaxy Photo Gallery (jQuery) with Custom Images Sets
    • Rotating Slider with Easing Effects in jQuery
    • Animated jQuery Progressbar Plugin
    • Nice CSS3 Lightbox Gallery
    • Photo Album with Highslide
    • Using Flux Slider jQuery plugin
    • Ajaxy Chained Selects
    • Modern jQuery Pagination for Content
    • Your own jQuery Slider Plugin
    • Attractive Photo Gallery using SmartGallery
    • Animated Photo Gallery using jQuery (Slider Kit)
  • PHP
    • Powerful Chat System - Lesson 3
    • Powerful Chat System - Lesson 2
    • Powerful Chat System
    • Access Control with Bit Masks
    • Own XML/JSON/HTML API with PHP
    • Your Own Ajax Poll System
    • Diary style PHP Guestbook
    • Smooth Curve Graphs with PHP and GD
    • Your Own Commenting System from Scratch
    • Autocomplete with PHP, jQuery, MySQL and XML
    • Your Own 5 Stars Voting System
    • How to use Memcache with PHP
    • How to install APC on Linux
    • How to Use APC Caching with PHP
    • Watermark processing on images using PHP and GD
    • ID3 Tags Reader with PHP
    • Advance Level Login system with Logic captcha
    • Protection and Methodologies of Security Vulnerabilities
    • How to Resize images on Server Side
    • How to Protect any Site from Spam using Akismet
    • Phar - PHP archiving practice
  • JS
    • Form Validation with Javascript and PHP
    • Fullscreen Javascript Slide navigation
    • Photo Scrambler grid in javascript
    • Photo Slideshow (zoom fading) effect
    • Custom scrollbars - cross-browser solution
    • Flare Lens Effect
    • Own RSS Reader Using Google Feed API
    • Cross-browser Wave Effects
    • Cross-browser Supported Image Skew effect
  • Res
    • ← Infographic
      • The Evolution of Languages
    • ← jQuery plugin roundups
      • December 2011
      • November 2011
      • 10 fresh jQuery Tutorials
      • October 2011
      • September 2011
      • 10 fresh Ajax related jQuery plugins
      • August 2011
      • 10 Oven Fresh jQuery Plugins for UI
      • 10 Most creative jQuery plugins for tables
      • 10 Most Creative jQuery Navigation Plugins
      • 10 fresh jQuery plugins for working with forms and UI
      • 10 superb jQuery plugins for working with images
    • ← HTML5 stuff
      • HTML5 and Games
      • 10 Fresh HTML5 Tutorials
      • Fresh impressing WebGL demonstrations
      • Most impressing HTML5 with WebGL demonstrations
      • 10 Fresh & Impressive HTML5 Canvas (and WebGL) Examples
      • 10 Exceptional Examples of HTML5 Canvas and Applications
    • ← Mobile
      • How to start developing own applications for Android
      • 10 Fresh Android tutorials
      • 10 Attractive Tutorials for Developing iPhone Applications
      • 10 Attractive android tutorials for developers
      • 10 Fresh iPad Apps for Web Designers & Developers
      • 10 Fresh Android Apps for Web Designers & Developers
      • 10 Fresh iPhone Apps for Web Designers & Developers
      • Top 10 iPhone apps for working with graphics
    • 12 Unique Navigation Menu Designs For Your Inspiration
    • 15 Unique and Creative Layouts 2011
    • 12 Beautifully Creative Flash Websites of 2011
    • Fresh collection of Original Captchas
  • XSLT
    • Animated forums using XSLT and Ajaxy
    • Multilevel Menu using XSLT
    • Delicious bookmarks using XSLT transformation
    • XPath visually
    • Tags cloud using XSLT transformation
    • Youtube videos using XSLT transformation
  • Contact Us
KEEP IN TOUCH

How to Easily Make a PHP Chat Application

May07
2010
37 Comments Written by admin

How to Easily Make Chat application with PHP + SQL

Today I will tell you about creating simple Chat application using our existing login system. This will useful and most simple solution. We will able to chat with our logged members. We will use database to store messages.

Here is a sample:

  • Live Chat Demo
  • download in package

So download the example files and lets start coding!


Step 1. HTML

As usual, we start with the HTML.

This main chat window.

index.html

<frameset rows="65%,35%" framespacing="1" frameborder="yes" border="1" bordercolor="#FF0000">
    <frame src="messages.php" name="main_frame">
    <frame src="main.php" name="login_frame" scrolling="no" noresize target="middle">
</frameset>

This is login form code.

login_form.html

<link type="text/css" rel="stylesheet" href="styles.css" />

<form class="login_form" method="post" action="main.php">
 <div>Username: <input type="text" name="username" /></div>
 <div>Password: <input type="password" name="password" /></div>
 <div><input type="submit" value="Login" name="Login" /></div>
</form>
<div>You can use username "User1" or "User2" or "User3" and password "qwerty" to login in system</div>

Here are new 3 template files to chat (2 to messages box and 1 to send message form):

chat_begin.html

<link type="text/css" rel="stylesheet" href="styles.css" />

<div class="chat_main">
 <h3>Chat</h3>

chat_end.html

</div>

chat_input.html

<link type="text/css" rel="stylesheet" href="styles.css" />

<form class="submit_form" method="post" action="main.php">
 <div><input type="text" name="s_message" /><input type="submit" value="Say" name="s_say" /></div>
</form>
<div>You can type anything in chat</div>

Step 2. CSS

Here are used CSS styles.

styles.css

.login_form {
 border: 1px solid #AAA;
 padding:10px;
}

h3 {margin-top:3px;}

.chat_main {
 border:1px solid #AAA;
 -moz-box-shadow:0 0 10px #ccc;
 -webkit-box-shadow: 0 0 10px #ccc;
 width:350px;
 padding:10px;
 background:#f3f3f3;
}

.message {
 border:1px solid #AAA;
 margin:4px;
 padding:5px;
 -moz-border-radius:7px;
 -webkit-border-radius:7px;
 background:#ffffff;
}

.textf {
-moz-box-shadow:0 0 10px #CCCCCC;
-webkit-box-shadow:0 0 10px #CCCCCC;
border:1px solid #CCCCCC;
height:40px;
}

.submit {
-moz-border-radius:7px;
-webkit-border-radius:7px;
background:#F3F3F3;
border:1px solid #CCCCCC;
font-size:16px;
font-weight:bold;
height:35px;
margin-left:10px;
padding:5px;
}
.message span {
 font-size:10px;
 color:#888;
 margin-left:10px;
}

.submit_form {
 margin:10px 0px;
}

Step 3. SQL

We will need to execute next SQL in our database.

CREATE TABLE `s_chat_messages` (
`id` INT(11) NOT NULL AUTO_INCREMENT ,
`user` VARCHAR(255) NOT NULL ,
`message` VARCHAR(255) NOT NULL ,
`when` INT(11) NOT NULL ,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Step 4. PHP

As you remember – we had ready easy authentication system. I moved it to external library file (inc/login.inc.php). This will useful for us – now code more structured and it comfortable to use in different places of code.

After I created new library to work with chat (inc/chat.inc.php). This class have next functions:

acceptMessages – function accept sent messages and store it in DB table

getMessages – return list of last 15 messages

After I created 2 last files: messages.php and main.php. First file used to draw list of messages. It have autoupdate each 5 second (I thing this is enough to our chat). Second draw login form and input field of chat. Where we due logged able to post text in chat.

Ok, here are all used PHP files:

main.php

<?php

// set error reporting level
if (version_compare(phpversion(), "5.3.0", ">=") == 1)
 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
else
 error_reporting(E_ALL & ~E_NOTICE);

require_once('inc/login.inc.php');
require_once('inc/chat.inc.php');

// initialization of login system and generation code
$oSimpleLoginSystem = new SimpleLoginSystem();

$oSimpleChat = new SimpleChat();

// draw login box
echo $oSimpleLoginSystem->getLoginBox();

// draw chat application
$sChatResult = 'Need login before using';
if ($_COOKIE['member_name'] && $_COOKIE['member_pass']) {
 if ($oSimpleLoginSystem->check_login($_COOKIE['member_name'], $_COOKIE['member_pass'])) {
 $sChatResult = $oSimpleChat->acceptMessages();
 }
}
echo $sChatResult;

?>

messages.php

<meta http-equiv="refresh" content="5">
<?php

require_once('inc/chat.inc.php');
$oSimpleChat = new SimpleChat();
echo $oSimpleChat->getMessages();

?>

inc/chat.inc.php

<?php

// simple chat class
class SimpleChat {

    // DB variables
    var $sDbName;
    var $sDbUser;
    var $sDbPass;

    // constructor
    function SimpleChat() {
        //mysql_connect("localhost","username","password");
        $this->sDbName = 'database_name';
        $this->sDbUser = 'username';
        $this->sDbPass = 'password';
    }

    // adding to DB table posted message
    function acceptMessages() {
        if ($_COOKIE['member_name']) {
            if(isset($_POST['s_say']) && $_POST['s_message']) {
                $sUsername = $_COOKIE['member_name'];

                //the host, name, and password for your mysql
                $vLink = mysql_connect("localhost", $this->sDbUser, $this->sDbPass);

                //select the database
                mysql_select_db($this->sDbName);

                $sMessage = mysql_real_escape_string($_POST['s_message']);
                if ($sMessage != '') {
                    mysql_query("INSERT INTO `s_chat_messages` SET `user`='{$sUsername}', `message`='{$sMessage}', `when`=UNIX_TIMESTAMP()");
                }

                mysql_close($vLink);
            }
        }

        ob_start();
        require_once('chat_input.html');
        $sShoutboxForm = ob_get_clean();

        return $sShoutboxForm;
    }

    function getMessages() {
        $vLink = mysql_connect("localhost", $this->sDbUser, $this->sDbPass);

        //select the database
        mysql_select_db($this->sDbName);

        //returning the last 15 messages
        $vRes = mysql_query("SELECT * FROM `s_chat_messages` ORDER BY `id` ASC LIMIT 15");

        $sMessages = '';

        // collecting list of messages
        if ($vRes) {
            while($aMessages = mysql_fetch_array($vRes)) {
                $sWhen = date("H:i:s", $aMessages['when']);
                $sMessages .= '<div class="message">' . $aMessages['user'] . ': ' . $aMessages['message'] . '<span>(' . $sWhen . ')</span></div>';
            }
        } else {
            $sMessages = 'DB error, create SQL table before';
        }

        mysql_close($vLink);

        ob_start();
        require_once('chat_begin.html');
        echo $sMessages;
        require_once('chat_end.html');
        return ob_get_clean();
    }
}

?>

inc/login.inc.php

<?

// class SimpleLoginSystem
class SimpleLoginSystem {

    // variables
    var $aExistedMembers; // Existed members array

    // constructor
    function SimpleLoginSystem() {
        $this->aExistedMembers = array(
            'User1' => 'd8578edf8458ce06fbc5bb76a58c5ca4',
            'User2' => 'd8578edf8458ce06fbc5bb76a58c5ca4',
            'User3' => 'd8578edf8458ce06fbc5bb76a58c5ca4'
        );
    }

    function getLoginBox() {
        ob_start();
        require_once('login_form.html');
        $sLoginForm = ob_get_clean();

        $sLogoutForm = '<a href="'.$_SERVER['PHP_SELF'].'?logout=1">logout</a>';

        if ((int)$_REQUEST['logout'] == 1) {
            if (isset($_COOKIE['member_name']) && isset($_COOKIE['member_pass']))
                $this->simple_logout();
        }

        if ($_REQUEST['username'] && $_REQUEST['password']) {
            if ($this->check_login($_REQUEST['username'], MD5($_REQUEST['password']))) {
                $this->simple_login($_REQUEST['username'], $_REQUEST['password']);
                return 'Hello ' . $_REQUEST['username'] . '! ' . $sLogoutForm;
            } else {
                return 'Username or Password is incorrect' . $sLoginForm;
            }
        } else {
            if ($_COOKIE['member_name'] && $_COOKIE['member_pass']) {
                if ($this->check_login($_COOKIE['member_name'], $_COOKIE['member_pass'])) {
                    return 'Hello ' . $_COOKIE['member_name'] . '! ' . $sLogoutForm;
                }
            }
            return $sLoginForm;
        }
    }

    function simple_login($sName, $sPass) {
        $this->simple_logout();

        $sMd5Password = MD5($sPass);

        $iCookieTime = time() + 24*60*60*30;
        setcookie("member_name", $sName, $iCookieTime, '/');
        $_COOKIE['member_name'] = $sName;
        setcookie("member_pass", $sMd5Password, $iCookieTime, '/');
        $_COOKIE['member_pass'] = $sMd5Password;
    }

    function simple_logout() {
        setcookie('member_name', '', time() - 96 * 3600, '/');
        setcookie('member_pass', '', time() - 96 * 3600, '/');

        unset($_COOKIE['member_name']);
        unset($_COOKIE['member_pass']);
    }

    function check_login($sName, $sPass) {
        return ($this->aExistedMembers[$sName] == $sPass);
    }
}

?>

View Live Demo of our sample

download in package


Conclusion

I described how to make easy chat application based on PHP and MySQL. You can use this material to create own scripts into your startups. Good luck!

About: admin:
I am web developer with huge experience (in web languages and even in system languages). Also I am the founder of current website (and several another). I like to write blogs about web development/design. Feel free to Follow us on Twitter: tweetmeme_screen_name='AramisGC';
If you Enjoyed our article don't forget to Share the love with your friends.
    Tweet
   
   
Written by: admin on May 7, 2010.

Related Stuff You Will Love!

  1. How to Easily Make AJAX Style PHP Chat Application
    How to Easily Make AJAX Style PHP Chat Application
  2. How to Easily Make a PHP Shoutbox Application
    How to Easily Make a PHP Shoutbox Application
  3. How to Easily Make an Advance Level Login system
    How to Easily Make an Advance Level Login system
  4. Powerful Chat System
    Powerful Chat System
Posted in HTML/CSS, MySQL, PHP - Tagged chat application, chat script, chat system, free, free download, shout box
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« How to Easily Make a PHP Shoutbox Application
» How to Easily Make AJAX Style PHP Chat Application

34 Comments

  1. Hermitbiker's GravatarHermitbiker
    May 8, 2010 at 5:15 am | Permalink

    …. so if you want your blog subscribers to contact you about something or anything…. put in your very own “Chat Room”…. a great tutorial for adding one to your own blog, very cool !! :)

  2. Ameneh's GravatarAmeneh
    February 13, 2011 at 7:36 pm | Permalink

    Hi thanks for your help, I used the code and every thing seems ok except that in this way two users can have a same user_name or name in your s_members table because the primary key is id. also we cannot have primary key (id, name) because the id differes for every user but they may have same names. I am doing this for my project and I am really in hurry, I do not know what to do. please help me. Thanks.

  3. Ameneh's GravatarAmeneh
    February 13, 2011 at 8:28 pm | Permalink

    I found that we can use unique keys, they work almost like primary keys. if you add the below code at the end of the code for your s_members table :
    UNIQUE name (name)
    the users cannot have same user names.

  4. admin's Gravataradmin
    February 14, 2011 at 11:35 am | Permalink

    Hello, thanks for informative comment,
    yes, you can (and this will better) to keep your members in own SQL table (as example `s_members`). And of course name of user (Nickname field) should be unique. In this case you will able easy to separate content. So, each user will have own ID (unsigned, auto_increment PRIMARY KEY). And you will able to link this ID with any content. As example chat message owner ID. In current article I using name of member, but you can use ID too (even will better).

  5. ambig's Gravatarambig
    February 20, 2011 at 9:31 pm | Permalink

    Thank u very much for this application…… it works perfect 4 me.

  6. alam's Gravataralam
    March 15, 2011 at 8:18 pm | Permalink

    i need code for timer
    can u please

  7. admin's Gravataradmin
    March 20, 2011 at 5:30 am | Permalink

    Timer for what?

  8. tasya's Gravatartasya
    March 30, 2011 at 5:49 am | Permalink

    hi.. i’m beginner to learn chat application.. now, im using wamp server as my localhost.. but still cannot run and error.. please help me

  9. admin's Gravataradmin
    March 30, 2011 at 3:22 pm | Permalink

    Yes, sure, just tell us which error you got (no need show real url – but you can show error itself)

  10. sammi's Gravatarsammi
    April 4, 2011 at 5:19 am | Permalink

    HI,i get this error yet I have the class SimpleLoginSystem in login.inc.php

    Fatal error: Class ‘SimpleLoginSystem’ not found in D:\wamp\www\source\main.php on line 17

    What do i do

  11. admin's Gravataradmin
    April 4, 2011 at 5:54 pm | Permalink

    Firstly make sure that you have this file:
    D:\wamp\www\source\inc\login.inc.php
    just because this file already have class SimpleLoginSystem
    .. try to re-link this from another place as example

  12. no name's Gravatarno name
    May 4, 2011 at 2:32 am | Permalink

    i only skimmed, and new at coding as everyone here is…

    however, im wondering about custom colors etc… is this possible with this example?

    thank you for your tutorial :-)

  13. admin's Gravataradmin
    May 4, 2011 at 3:42 am | Permalink

    2 no name
    Of course possible. Look to my CSS file :)

  14. sairam's Gravatarsairam
    June 25, 2011 at 5:59 am | Permalink

    That was nice application ………
    But I need something that looks like Facebook chat….
    Please send the code to my mail
    Thanks in advance

  15. admin's Gravataradmin
    June 30, 2011 at 5:02 pm | Permalink

    2 sairam
    I see, but, this can be like custom work, or you asking me to prepare one of next my posts about creating similar chats as facebook have?

  16. alexander's Gravataralexander
    July 17, 2011 at 6:16 pm | Permalink

    It’s a nice php chat example. Good Job!

  17. Hypertargeting's GravatarHypertargeting
    October 10, 2011 at 9:25 pm | Permalink

    Awesome stuff.
    I had a question is this chat application works on word press . Because i had a word press site for my friends. Please replay me. Am bit worry to work with database.

  18. admin's Gravataradmin
    October 11, 2011 at 4:11 pm | Permalink

    2 Hypertargeting
    Don`t worry – it can be Any script. I don`t making tutorials for some particular scripts, this is for everything

  19. Obizzie's GravatarObizzie
    October 22, 2011 at 4:26 am | Permalink

    Hey man this is very impressive id like to refference this in a current academic project iam working on hope thats okay. thanks

  20. Biggy's GravatarBiggy
    October 22, 2011 at 5:31 pm | Permalink

    How are you. I created all these files and tried to run them. Am using a xampp database. Am having a problem such that when I try to run the main.php file, after login in with the username and password, am getting these error messages:
    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:9) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 125

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:9) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 127

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:9) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 111

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:9) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 115. he t
    When I check in my database, am seeing nothing in the table s_chat_messages. Where did I go wrong. Will appreciate very much if i get a response from you. Thank you.

  21. admin's Gravataradmin
    October 28, 2011 at 2:47 pm | Permalink

    2 Biggy
    Hello, thanks, we are fine. By the way, why
    inc\login.inc.php
    contain >125 lines in your version? By default it contain only 72 lines. Check – maybe you Printing some empty row in these places?

  22. Biggy's GravatarBiggy
    October 31, 2011 at 9:23 am | Permalink

    Thanks Admin for the effort you made trying to solve my problem. I deleted all the empty lines in my php and html documents, but the following errors are still coming out.

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:8) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 56

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:8) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 57

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:8) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 50

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\My Site\Web Page\Another\main.php:8) in C:\xampp\htdocs\My Site\Web Page\Another\login.inc.php on line 52.

    Am currently working on a project that is due very soon. Will be happy to receive ideas on how to deal with this. Thank you

  23. moses's Gravatarmoses
    November 24, 2011 at 8:38 pm | Permalink

    what of having a moderator to chatting with logged user

  24. rithi's Gravatarrithi
    November 25, 2011 at 8:52 am | Permalink

    Hi ,Plz tell me how to add this into blogger?

  25. admin's Gravataradmin
    November 30, 2011 at 6:04 am | Permalink

    2 rithi,
    You can create separated page with chat application, or embed this into any your existed pages.

  26. Saleem Memon's GravatarSaleem Memon
    December 7, 2011 at 6:12 am | Permalink

    Nice source of information………………

    But there is a problem in script……….it is XSS-able.

    Anyone can easy XSS attack on this script.

  27. admin's Gravataradmin
    December 8, 2011 at 12:30 pm | Permalink

    Hello Saleem,
    What do you mean – ‘xss-able’ ?

    acceptMessages can accept custom-made scripts? You always can enhance this function if need (add extra protection methods)

  28. admin's Gravataradmin
    December 8, 2011 at 4:08 pm | Permalink

    Hi moses,

    In this case you have to create own necessary functional to moderate messages (maybe using some special member with extra possibilities)

  29. admin's Gravataradmin
    December 8, 2011 at 5:00 pm | Permalink

    Hello Biggy,

    Sorry for long response. You always can ask me by PM (email) in our case. Or, try to understand (or tell here) what you have at your line 52?

  30. Darren's GravatarDarren
    December 29, 2011 at 10:00 pm | Permalink

    Do you know how I could add the following features:

    *Registration
    *Make your own chat box
    *Ranking system
    *Private messages
    *Avatars
    *Profiles
    *Banning system

    PLEASE get back to me on this. Email me. darrendude104@gmail.com

  31. admin's Gravataradmin
    January 8, 2012 at 1:21 pm | Permalink

    Thanks for your comment Darren,
    I will try to organize my time and start new thread of articles regarding creating powerful chat system

  32. gorki's Gravatargorki
    January 9, 2012 at 4:08 pm | Permalink

    Fatal error: Class ‘SimpleLoginSystem’ not found in C:\wamp\www\source\main.php on line 17 …..What do i do

    I CANT THE CODE..PLS SOMEONE HELP ME…I AM NEW WEB DEVELOPER…..PLS MAIL ME COMPLETE CODE

  33. admin's Gravataradmin
    January 11, 2012 at 7:14 am | Permalink

    Hi,
    Complete code always here: http://www.script-tutorials.com/demos/6/source.zip
    Make sure that you have inc\chat.inc.php file in your ‘www’

  34. patel chirag's Gravatarpatel chirag
    January 18, 2012 at 7:30 pm | Permalink

    Awesome coding.By this coding i create the chatting facility.thanks a lot

1 Trackback

  1. designfloat.com on May 7, 2010 at 5:06 pm
  2. Tweets that mention How to make a #php Chat Application - -- Topsy.com on May 7, 2010 at 6:24 pm
  3. How to Easily Make a PHP Chat Application – Script tutorials | Neorack Tutorials on May 7, 2010 at 6:47 pm

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

CAPTCHA Image
Refresh Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Popular Tutorials

  • How to create easy pagination with jQuery
  • Animated jQuery Progressbar Plugin
  • Pure HTML5 file upload
  • Creating a HTML5 & CSS3 Single Page Web Layout
  • HTML5 Game Development – Lesson 6
  • How to Create Animated Photo Gallery using jQuery (Slider Kit)
  • Developing Your First HTML5 Game – Lesson 1
  • How to Easily Make a PHP Chat Application

Tags

3d AJAX android animated animation app application applications apps canvas captcha chat system coding creating css css3 developers effect effects flash fresh gallery how-to html html5 image images iphone javascript jQuery layout menu navigation new photo PHP plugin plugins slideshow system tutorial tutorials webgl website xslt

Recent Tutorials

  • Infographic: The Evolution of Languages
  • 12 Unique Navigation Menu Designs For Your Inspiration
  • Form Validation with Javascript and PHP
  • 10 fresh jQuery plugins (january 2012)
  • Powerful Chat System – Lesson 3
  • Invoicera offer results
  • CSS3 Image Hover Effects
  • HTML5 Canvas Slideshow

Friends

  • X-Musics

Tutorials for Web Developers Copyright © 2009-2011 Script tutorials · All rights reserved