Page 1 of 1

PHP Chat Script - Set Interval

Posted: 08 Mar 2015, 16:45
by hups
Hello
In the PHP Chat script from https://coursesweb.net/php-mysql/script-chat-simple_s2 where can i set intervall?

PHP Chat Script - Set Interval

Posted: 10 Mar 2015, 10:15
by Admin
If you refer to the interval that the Ajax function accesses the php file, modify the number 1900 (milliseconds) to this line of code (line 431) in the chatfunctions.js file.

Code: Select all

setTimeout('apelAjax()', 1900);

PHP Chat Script - Set Interval

Posted: 10 Mar 2015, 12:07
by hups
ok thanks,
The var callphp is another constant ?

PHP Chat Script - Set Interval

Posted: 10 Mar 2015, 13:03
by Admin
The callphp variable is used to control when to load the chat data from php or directly from the txt file with chatroom.
Reading a txt file with data in json format uses less resources than accessing the php script.
It is a logic around the callphp var that I implement it to make the script to use less server resources.
The php file is accessed when a new chat message is added, and when the number of online users is changed (to actualize them)

Code: Select all

callphp = 2.8 + (getNrChatUsers() * 0.3);  // sets to call "setchat" according to number of online users
In the rest, chats data are loaded directly from txt file.