now browsing by category
Please note that the code above will enter our script label, where we placed the logout code that is jQuery.
PHP The post.php File
At the brief minute, we have POST data being sent to the post.php register each time the consumer submits the form and delivers a new message. Our goal now is to grab this data and write it into our chat log.
We need to start the post.php before we do anything file with the session_start() function as we’ll be utilising the session regarding the user’s title in this file.
Utilising the isset b lean, we verify that the session for ‘name’ exists before doing whatever else. We now grab the POST data which was being provided for this file by jQuery. We shop this information to the $text variable. This information, like all the overall individual input data, will likely be kept in the log.html file. We just make use of the file_put_contents() function to write all the information towards the file.
The message we shall be writing is going to be enclosed within the .msgln div. It’ll support the date and time created by the date() function, the session for the individual’s title, and the text, which is also surrounded by the htmlspecialchars() function to avoid XSS.
Step 5 Displaying the Chat Log Articles
Everything the user has published is handled and published jQuery international cupid dating and marriage that is using its written towards the chat log with PHP. The only thing left to do would be to display the updated chat log to the user with log.php.
To conserve ourselves some time, we’ll preload the log that is chat the #chatbox div if this has any content.
We work with a comparable routine as we used in the post.php file, except this right time we’re just reading and outputting the articles of this file.
The jQuery.ajax Request
Read the rest of this page »