Submitted by rinvizle on Wednesday, August 17, 2016 - 10:20.
In this tutorial we will create a Live Chat Using PHP and jQuery. This live chat application we will be creating is a simple web-based application that creates a chat or message through the other users of this application. And it will include a login and logout system using Ajax features and it will also support for multiple users. See the example code below.
Sample Code
Index.php - For creating a login form using PHP that will ask the user their name before they continue to the chatting area.
';
}
if(isset($_POST['enter'])){
if($_POST['name'] != ""){
$_SESSION['name'] = stripslashes(htmlspecialchars($_POST['name']));
}
else{
echo 'Please type in a name';
}
}
?>Post.php - We have created a data that being sent to the post.php file each time the user submits the form and sends a new message. It will now create a script to get the data and display it to the chat log.
(".date("g:i A").") ".$_SESSION['name'].": ".stripslashes(htmlspecialchars($text))." ");
fclose($cb);
}
?>
Hope that you learn in my tutorial. Don't forget to LIKE & SHARE this website. Enjoy Coding.